|
HDK
|
#include <readIteratorRange.h>
This class allows for construction of iterable ranges of input values. The underlying iterator used is VdfReadIterator. The VdfReadIteratorRange::begin() and VdfReadIteatorRange::end() methods return an instance of VdfReadIterator<T> denoting the iterable range. The class satisfies the STL API requirements that make it suitable for use in range- based for loops.
For example: ```{.cpp} VdfReadIteratorRange<double> range(context, _tokens->in); for (const double x : range) { ... } ```
This class can also be used to copy ranges of input values into STL containers. It can be used in range constructors, for example.
```{.cpp} VdfReadIteratorRange<double> range(context, _tokens->in); std::vector<double> values(range.begin(), range.end()); ```
Determining the number of input values in a range is not trivial, and might be costly. Invoking std::distance on VdfReadIterator is slightly more expensive than calling VdfReadIteratorRange::ComputeSize() (i.e. VdfReadIterator::ComputeSize().)