#include <SortedSequence.hpp>
Public Member Functions | |
SortedSequence () | |
Creates an empty sorted sequence. | |
SortedSequence (int max, int num) | |
Creates a seq with max values max, and num indices. | |
SortedSequence (int max, const std::vector< int > &seq) | |
Creates a sequence with max value max and current indices seq; seq must be strictly increasing. | |
bool | finished () const |
Returns true if no more valid sequences. | |
int & | operator[] (int n) |
Returns a reference to the nth index. | |
void | operator++ () |
Updates indices to next valid sorted sequence. | |
std::vector< int > & | indices () |
Returns the indices as a vector of integers. | |
Private Attributes | |
int | m_max |
std::vector< int > | m_seq |
Definition at line 20 of file SortedSequence.hpp.
SortedSequence::SortedSequence | ( | ) | [inline] |
Creates an empty sorted sequence.
Definition at line 54 of file SortedSequence.hpp.
SortedSequence::SortedSequence | ( | int | max, | |
int | num | |||
) | [inline] |
Creates a seq with max values max, and num indices.
Definition at line 59 of file SortedSequence.hpp.
SortedSequence::SortedSequence | ( | int | max, | |
const std::vector< int > & | seq | |||
) | [inline] |
Creates a sequence with max value max and current indices seq; seq must be strictly increasing.
Definition at line 73 of file SortedSequence.hpp.
bool SortedSequence::finished | ( | ) | const [inline] |
Returns true if no more valid sequences.
Definition at line 78 of file SortedSequence.hpp.
std::vector< int > & SortedSequence::indices | ( | ) | [inline] |
Returns the indices as a vector of integers.
Definition at line 89 of file SortedSequence.hpp.
References m_seq.
void SortedSequence::operator++ | ( | ) | [inline] |
Updates indices to next valid sorted sequence.
Definition at line 94 of file SortedSequence.hpp.
int & SortedSequence::operator[] | ( | int | n | ) | [inline] |
Returns a reference to the nth index.
If these value is changed to make the sequence not strictly increasing, further output is undefined.
Definition at line 83 of file SortedSequence.hpp.
References m_seq.
int SortedSequence::m_max [private] |
Definition at line 49 of file SortedSequence.hpp.
Referenced by finished(), operator++(), and SortedSequence().
std::vector<int> SortedSequence::m_seq [private] |
Definition at line 50 of file SortedSequence.hpp.
Referenced by finished(), indices(), operator++(), operator[](), and SortedSequence().