![]() |
Auxiliary class for the generation of random indices. More...
#include <Indices.h>
Public Types | |
typedef std::vector< size_t >::const_iterator | ConstIterator |
Iterator over the generated indices. | |
Public Member Functions | |
Constructors | |
Indices (size_t min, size_t max, size_t number) | |
The constructor for the Indices class. More... | |
Utility functions | |
size_t | size () const |
Returns the total number of random indices. More... | |
ConstIterator | begin () const |
Returns an iterator to the beginning of the vector. More... | |
ConstIterator | end () const |
Returns an iterator just past the last element of the vector. More... | |
Private Attributes | |
Member variables | |
std::vector< size_t > | indices_ |
The generated indices. | |
Auxiliary class for the generation of random indices.
This auxiliary class can be used to generate a set of random indices.
The constructor for the Indices class.
min | The lower limit of the random indices. |
max | The upper limit of the random indices. |
number | The number of random indices to generate. |
std::invalid_argument | Invalid index range. |
std::invalid_argument | Invalid number of indices. |
This constructor initializes an Indices object by generating number random, unique indices in the range min to max. In case number is larger than the possible number of incides in the specified range, a std::invalid_argument exception is thrown.
|
inline |
Returns an iterator to the beginning of the vector.
|
inline |
Returns an iterator just past the last element of the vector.
|
inline |
Returns the total number of random indices.