Skip to content

Sulter/span_nd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

span_nd

Try it on godbolt online Standard

Multi dimensional std::span.
The aim is to provide a std::span like interface and performance, but with multi-dimensional access and manipulation.

Usage

Try it out online!

Any type contiguous memory (C-array, std::vector, std::array) are easily converted to a span_nd:

int array[100];
span_nd<int, 2> twoD(array, 100, {10, 10});

//works like all other containers
std::iota(twoD.begin(), twoD.end(), 0);

//easy access with [] operator
twoD[{8, 8}] = -1;

//you can get cross_section of dimensions:
//fill second row with 2
std::fill(twoD.cross_section(1).begin(), twoD.cross_section(1).end(), 2);

Releases

No releases published

Packages

No packages published