PolyVox
0.2.1
Open source voxel management library
|
The ArraySizes class provide a convienient way to specify the dimensions of an Array. More...
#include <ArraySizes.h>
Public Member Functions | |
ArraySizes (uint32_t uSize) | |
Constructor. | |
ArraySizesImpl< 2 > | operator() (uint32_t uSize) |
Duplicates this object but with an extra dimension. | |
operator UIntArray1 () const | |
Converts this object to an array of integers. |
The ArraySizes class provide a convienient way to specify the dimensions of an Array.
The Array class requires an array of integers to be passed to the constructor to specify the dimensions of the Array to be built. C++ does not allow this to be done in place, and so it typically requires an extra line of code - something like this:
The ArraySizes class can be constructed in place, and also provides implicit conversion to an array of integers. Hence it is now possible to declare the above Array as follows:
Usage of this class is therefore very simple, although the template code behind it may appear complex. For reference, it is based upon the article here: http://www.drdobbs.com/cpp/184401319/
Definition at line 56 of file ArraySizes.h.
|
explicit |
Constructor.
uSize | The size of the first dimension. |
Definition at line 31 of file ArraySizes.cpp.
PolyVox::ArraySizes::operator UIntArray1 | ( | ) | const |
Converts this object to an array of integers.
Definition at line 51 of file ArraySizes.cpp.
ArraySizesImpl< 2 > PolyVox::ArraySizes::operator() | ( | uint32_t | uSize | ) |
Duplicates this object but with an extra dimension.
This class only directly implements one dimensional sizes.
Higher numbers of dimensions are implemented via the ArraySisesImpl class. This function create an object of the next dimensionality up.
uSize | The size of the next dimension. |
Definition at line 43 of file ArraySizes.cpp.