1 #ifndef MULTICOUNTER_HH
2 #define MULTICOUNTER_HH
13 template <
typename SubCounterType>
16 template <
typename SubCounterType>
22 typedef typename SubCounterType::const_value_iterator
sub_iterator;
45 m_sub_iter = (*m_counter_ptr)[++
m_ind].value_begin();
74 template <
typename CounterType>
132 template <
typename CounterType>
137 template <
typename CounterType>
139 m_counters = _counters;
143 template <
typename CounterType>
145 m_is_valid = (size() != 0);
146 for (
Index i = 0; i < size(); i++) m_counters[i].reset();
149 template <
typename CounterType>
154 template <
typename CounterType>
158 while (valid() && index < size()) {
159 if (!(++m_counters[index]).valid()) {
164 for (
Index i = 0; i < index; i++) {
165 m_counters[i].reset();
170 if (index == size()) m_is_valid =
false;
175 template <
typename CounterType>
177 for (
Index i = 0; i < steps && m_is_valid; i++) (*
this)++;
182 template <
typename CounterType>
185 return stream << counter();
CounterValueIterator operator++(int)
bool operator!=(const CounterValueIterator &_it)
MultiCounter< SubCounterType > CounterType
CounterType::value_type value_type
CounterType const * m_counter_ptr
CounterType::size_type size_type
const value_type & operator*() const
bool operator==(const CounterValueIterator &_it)
CounterValueIterator & operator++()
SubCounterType::const_value_iterator sub_iterator
value_type const * operator->() const
CounterValueIterator(CounterType const *_counter_ptr=nullptr, size_type _ind=0, sub_iterator _sub_iter=sub_iterator())
reference operator*() const
CounterType const * m_counter_ptr
const CounterType & back() const
const Array< CounterType > & current() const
const_value_iterator value_end() const
const CounterType & operator[](Index i) const
bool operator+=(Index steps)
CounterType & operator[](Index i)
Array< CounterType > m_counters
CounterType::size_type size_type
void push_back(const CounterType &new_counter)
CounterValueIterator< MultiCounter > const_value_iterator
const_value_iterator value_begin() const
MultiCounter & operator++()
CounterType::value_type value_type
const Array< CounterType > & operator()() const
void push_back(const T &toPush)
std::ostream & operator<<(std::ostream &_stream, const FormattedPrintable &_formatted)
INDEX_TYPE Index
For long integer indexing: