template<typename _Container, typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
class CASM::IsoCounter< _Container, _value_type, _size_type, _Access, _Compare >
A IsoCounter allows looping over many incrementing variables in one loop.
- Template Parameters
-
Container | The type of container containing the variables begin looped over. Container should be fully specified, so 'std::vector<int>', not 'std::vector'. |
value_type | The type of variable contained by the Container. Must have valid operators '+=' and '+'. |
size_type | The type of the index into the Container. |
Access | A Functor or function with signature 'value_type& Access::operator()(Container &, size_type);', which provides a reference to a element of the Container. |
Compare | A Functor or function with signature 'bool Compare::operator()(const value_type& A, const value_type& B);', which provides a less than comparison, like 'operator<'. |
Default container access using the CASM_TMP::BracketAccess functor is identical to 'container[index]'. Parentheses access, like 'container(index)', can be obtained by setting the Access parameter using the CASM_TMP::ParenthesesAccess functor.
Default value_type comparison is as 'value_type < value_type'. Custom comparison can be provided using the Compare functor.
The first element of the container is the inner loop, and the last element of the container is the outer loop.
Example:
std::vector<int>
final(
size, 1);
do {
for( int i=0; i<counter.size(); i++) {
std::cout << counter()[i] << " ";
}
std::cout << std::endl;
} while(counter++);
const Container & initial() const
const value_type & increment() const
Output:
0 0 0
1 0 0
0 1 0
1 1 0
0 0 1
1 0 1
0 1 1
1 1 1
Definition at line 94 of file IsoCounter.hh.
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
Default construct a IsoCounter Container must be default constructible value_type must be constructible with zero.
Definition at line 126 of file IsoCounter.hh.
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
Construct a IsoCounter-type object.
- Parameters
-
_initial | the initial Container values |
_final | the final valid Container values |
_increment | the amount to increment each Container value by |
Definition at line 133 of file IsoCounter.hh.
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
bool CASM::IsoCounter< _Container, _value_type, _size_type, _Access, _Compare >::_compute_validity |
( |
| ) |
|
|
inlineprivate |
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
void CASM::IsoCounter< _Container, _value_type, _size_type, _Access, _Compare >::_init |
( |
| ) |
|
|
inlineprivate |
Called from the constructor to set m_lower and m_upper appropriately.
Definition at line 292 of file IsoCounter.hh.
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
void CASM::IsoCounter< _Container, _value_type, _size_type, _Access, _Compare >::operator++ |
( |
int |
| ) |
|
|
inline |
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
void CASM::IsoCounter< _Container, _value_type, _size_type, _Access, _Compare >::reset |
( |
| ) |
|
|
inline |
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
void CASM::IsoCounter< _Container, _value_type, _size_type, _Access, _Compare >::set_current |
( |
const Container & |
new_current | ) |
|
|
inline |
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>
template<typename _Container , typename _value_type = typename _Container::value_type, typename _size_type = typename _Container::size_type, typename _Access = CASM_TMP::BracketAccess<_Container, _value_type, _size_type>, typename _Compare = CASM_TMP::MuchLessThan<_value_type>>