What is gsl::multi_span to be used for?

假如想象 提交于 2019-12-04 06:49:09

In short, it is a span over contiguous piece of memory, which represents multidimensional array.

Here is an example of use:

int data[6] = {0, 1, 2, 3, 4, 5};
multi_span<int, 2, 3> span{data, 6};
std::cout << span[1][1] << '\n'; //Outputs 4

From the linked source, it seems, that it also supports runtime bounds, but I am not sure about proper syntax for those.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!