11#ifndef PERMUTAHEDRAL_REPRESENTATION_INTEGER_COMBINATION_ITERATOR_H_
12#define PERMUTAHEDRAL_REPRESENTATION_INTEGER_COMBINATION_ITERATOR_H_
15#include <boost/range/iterator_range.hpp>
19namespace coxeter_triangulation {
28 :
public boost::iterator_facade<Integer_combination_iterator, std::vector<uint> const,
29 boost::forward_traversal_tag> {
30 using value_t = std::vector<uint>;
33 friend class boost::iterator_core_access;
37 value_t
const& dereference()
const {
return value_; }
42 while (value_[j1] == 0 && j1 < k_) j1++;
44 while (value_[j2] == bounds_[j2]) {
45 if (bounds_[j2] != 0) {
60 while (s >= bounds_[i]) {
61 value_[i] = bounds_[i];
69 template <
class Bound_range>
71 : value_(k + 2), is_end_(n == 0 || k == 0), k_(k) {
72 bounds_.reserve(k + 2);
74 for (
auto b : bounds) {
80 if (n > sum_radices) {
86 while (s >= bounds_[i]) {
87 value_[i] = bounds_[i];
93 while (i < k_) value_[i++] = 0;
106 std::vector<uint> bounds_;
Class that allows the user to generate combinations of k elements in a set of n elements....
Definition: Integer_combination_iterator.h:29