| 
    occ
    
   | 
 
Class to generate all possible combinations of a integers. More...
#include <combinations.h>
Public Types | |
| using | Result = std::vector< int > | 
Public Member Functions | |
| Combinations (int n, int r) | |
| Combinations constructor.   | |
| bool | is_completed () const | 
| Check if the sequence of unique combinations is exhausted/completed.   | |
| int | num_generated () const | 
| The current total count of unique combinations generated.   | |
| const Result & | next () | 
| The next combination in the sequence.   | |
Class to generate all possible combinations of a integers.
The role of the Combinations class is to serve as a generator for all possible combinations (i.e. permutations where order is not important) of integers up to some maximum, of a specific length.
| using occ::core::Combinations::Result = std::vector<int> | 
| occ::core::Combinations::Combinations | ( | int | n, | 
| int | r | ||
| ) | 
Combinations constructor.
| n | maximum possible value for the integer (exclusive, i.e. range will be [0,n)) | 
| r | length of the combination sequences | 
Internally, combinations holds a std::vector<int> of length r, and returns a const reference to this for each generated sequence.
For example to generate all combinations of length 3 of containing integers in the range [0, 10) i.e. up to 9, you would call
| bool occ::core::Combinations::is_completed | ( | ) | const | 
Check if the sequence of unique combinations is exhausted/completed.
| const Result & occ::core::Combinations::next | ( | ) | 
The next combination in the sequence.
| int occ::core::Combinations::num_generated | ( | ) | const | 
The current total count of unique combinations generated.