gsl库中的span和array_view有什么区别? [英] What's the difference between span and array_view in the gsl library?

查看:2542
本文介绍了gsl库中的span和array_view有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最近的几次会议演讲中,我听说过Bjarne Stroustrup和其他人提到了C ++和支持他们的一些类型的新编码指南。

In several recent conference presentation I've heard Bjarne Stroustrup and others mention new coding guidelines for C++ and some types supporting them.

具体来说,我还记得 作为函数的参数(在时间约32:00时),作为参数的 而不是(T * p,int n) array_view< T> 的建议。他们是两个选择,但同样的概念?还是我混淆的事情,他们实际上不是这么相关?

Specifically, I remember the example of span<T> instead of (T* p, int n) as a parameter to a function (at time about 32:00 into the talk); but I also remember the suggestion to use array_view<T>. Are they two alternatives but the same concept? Or am I confusing things and they're actually not so related?

我似乎找不到任何他们应该是什么的权威定义。

I can't seem to find any authoritative definition of what they're both supposed to be about.

推荐答案

我们与图书馆工作组中的人员在标准委员会。他们希望 array_view 他们试图进入只读的标准。对于核心指南,我们需要一个读写的抽象。为了避免(潜在)标准和指南支持库(GSL)之间的冲突,我们将我们的(读和写) array_view 重命名为 / code>: https://github.com/microsoft/gsl

We talked with people in the library working group in the standards committee. They wanted the array_view they are trying to get into the standard to be read only. For the core guidelines, we needed an abstraction that was read and write. To avoid a clash between the (potential) standards and the guidelines support library (GSL), we renamed our (read and write) array_view to span: https://github.com/microsoft/gsl .

这篇关于gsl库中的span和array_view有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆