25 virtual const char*
what()
const throw ()
27 return "Already last combination";
44 for (
size_t i = 0; i <
k; ++i)
86 size_t last_consecutive_one = 0;
87 while (last_consecutive_one + 1 <
_data.size())
89 if (
_data[last_consecutive_one + 1] !=
_data[last_consecutive_one] + 1)
91 last_consecutive_one++;
95 _data[last_consecutive_one]++;
98 for (
size_t i = 0; i < last_consecutive_one; ++i)
115 size_t next = (c.
k() > 0 && c[0] == 0) ? 1 : 0;
118 for (
size_t i = 1; i < c.
n(); ++i)
120 if ((next < c.
k()) && c[next] == i)
Definition: combinations.hpp:32
combination(size_t n, size_t k)
Init with (1, ..., 1, 0, ..., 0)
Definition: combinations.hpp:40
std::vector< size_t > _data
Definition: combinations.hpp:34
bool is_last() const
Definition: combinations.hpp:72
size_t operator[](size_t index) const
Where is the index's 1 entry?
Definition: combinations.hpp:52
size_t n() const
Definition: combinations.hpp:57
size_t _size
Definition: combinations.hpp:35
void next()
Definition: combinations.hpp:80
size_t k() const
Definition: combinations.hpp:62
Definition: combinations.hpp:13
last_combination_exception()
Definition: combinations.hpp:15
virtual ~last_combination_exception()
Definition: combinations.hpp:20
virtual const char * what() const
Definition: combinations.hpp:25
Definition: algorithm.hpp:14
std::ostream & operator<<(std::ostream &stream, const binary_linear_space &space)
Definition: binary_linear_space.hpp:205