24 template <
class spec_t,
class gen_t>
88 const T total, choices;
134 #include "impl/Generators.ipp"
Contains general operations on vectors: hashing, computing degrees.
Constant iterator that is used in a ranged for loop to generate the combinations.
Definition: Generators.hpp:103
Generates all combinations on a number of letters making a number of choices.
Definition: Generators.hpp:87
CombinationGenerator(T total, T choices)
Sets up the generator.
auto size() const
Computes total number of combinations.
Prototype for coroutine-like iterators that generate elements such as combinations.
Definition: Generators.hpp:26
bool operator!=(const FactoryGenerator &other) const
Inequality of iterators (used to detect if generation has been completed)
spec_t & operator++()
Generates next element.
static spec_t end()
Terminal iterator.
bool completed
1 if the iterator is end() i.e. if all elements have been generated
Definition: Generators.hpp:33
const gen_t & operator*() const
Returns the generated element.
gen_t generated
The currently generated element.
Definition: Generators.hpp:34
Constant iterator that is used in a ranged for loop to generate the permutations.
Definition: Generators.hpp:62
Generates all permutations on a number of letters.
Definition: Generators.hpp:47
size_t size() const
Computes total number of permutations.
PermutationGenerator(T n)
Constructor sets up the generator.
ConstIterator begin() const
Begin iterator.
The namespace which contains every method and class in the library.
Definition: General.hpp:16
std::vector< std::vector< T > > all_combinations(T n, T m)
Returns vector of all combinations on n letters choosing m many.
std::vector< std::vector< T > > all_permutations(T n)
Returns vector of all permutations on n letters.