4 #ifndef CPPQEDCORE_UTILS_MULTIINDEXITERATOR_H_INCLUDED
5 #define CPPQEDCORE_UTILS_MULTIINDEXITERATOR_H_INCLUDED
7 #include "MultiIndexIteratorFwd.h"
11 #include <boost/operators.hpp>
13 #include <boost/mpl/identity.hpp>
23 typedef boost::mpl::false_ Begin;
24 typedef boost::mpl::true_ End ;
26 const Begin begin=Begin();
27 const End end =End ();
32 #define FORWARD_IteratorHelper boost::forward_iterator_helper<MultiIndexIterator<RANK>,IdxTiny<RANK> >
45 typedef FORWARD_IteratorHelper Base;
47 #undef FORWARD_IteratorHelper
50 typedef typename Base::value_type MultiIndex;
51 typedef typename MultiIndex::T_numtype SingleIndex;
57 const MultiIndex& ubound,
59 : lbound_(lbound), ubound_(ubound), idx_(lbound_) {}
62 : lbound_(lbound), ubound_(ubound), idx_(ubound_) {operator++();}
82 const MultiIndex& operator*()
const {
return idx_;}
83 MultiIndex& operator*() {
return const_cast<MultiIndex&
>(
static_cast<const MultiIndexIterator*
>(
this)->
operator*());}
99 void doIt(boost::mpl::int_<0>);
102 void doIt(boost::mpl::int_<N>);
104 const MultiIndex lbound_, ubound_;
115 #endif // CPPQEDCORE_UTILS_MULTIINDEXITERATOR_H_INCLUDED
Namespace comprising otherwise hard-to-classify generic utilities.
MultiIndexIterator(const MultiIndex &lbound, const MultiIndex &ubound, mii::Begin)
Initialization to the beginning of the sequence.
MultiIndexIterator(const MultiIndex &ubound, mii::End e)
friend bool operator==(const MultiIndexIterator &i1, const MultiIndexIterator &i2)
Comparison only for the actual values referred to. The user has to take care that the bounds are actu...
An iterator over all possible combinations of indices (a number of integers) between certain bounds...
MultiIndexIterator(const MultiIndex &lbound, const MultiIndex &ubound, mii::End)
” to the end of the sequence (which is in fact beyond the end by one)
Defines template aliases for blitz::TinyVectors used for characterising the size of multi-arrays and ...
MultiIndexIterator(const MultiIndex &ubound, mii::Begin b)