combos.hpp
Tools to step through combinations of items.
Step through all combinations of size K from a set of N values. For ComboIDs just return the indecies (the specific of the container don’t matter). Other versions will directly wrapper containers.
- Todo:
Allow a minimum and maximum combo size, not just a fixed combo size. If no sizes are specifed, all sizes should be explored (all possible combinations).
Create a ComboGenerator template to take a container and generate all combinations
Create a combos function that will build a ComboGenerator for the container type passed in.
-
class ComboIDs
- #include <combos.hpp>
Public Functions
-
ComboIDs(size_t in_max, size_t combo_size)
-
inline ~ComboIDs()
-
inline size_t GetComboSize() const
-
inline size_t GetNumCombos() const
-
inline size_t &operator[](const size_t index)
-
inline const size_t &operator[](const size_t index) const
-
bool NextCombo()
-
void ResizeCombos(size_t new_size)
-
inline size_t size()
Private Static Functions
-
static size_t CountCombos(size_t max_count, size_t combo_size)
-
ComboIDs(size_t in_max, size_t combo_size)