npstat::ArrayNDScanner Class Reference
Detailed DescriptionThis class can be used to iterate over array indices without actually building the array or requesting any memory from the heap. Typical use: for (ArrayNDScanner scanner(shape); scanner.isValid(); ++scanner)
{
scanner.getIndex(indexArray, indexArrayLen);
.... Do what is necessary with multidimensional index ....
.... Extract linear index: ...............................
scanner.state();
}
This can be useful, for example, in case one needs to iterate over slices of some array (so that the array itself can not be used to obtain similar information easily). Constructor & Destructor Documentation◆ ArrayNDScanner()
Constructor from a multidimensional array shape Member Function Documentation◆ dim()
Dimensionality of the scan ◆ getIndex()
Retrieve current multidimensional index ◆ isValid()
Returns false when iteration is complete ◆ maxState()
Maximum possible state (i.e., linear index of the scan) ◆ operator++() [1/2]
Prefix increment ◆ operator++() [2/2]
Postfix increment (distinguished by the dummy "int" parameter) ◆ reset()
Reset the state (as if the object has just been constructed) ◆ setState()
Set the state directly ◆ state()
Retrieve current state (i.e., linear index of the scan) The documentation for this class was generated from the following file: Generated by 1.9.1 |