Gromacs
2020.4
|
#include <gromacs/utility/enumerationhelpers.h>
Allows iterating sequential enumerators.
You can also provide an increment step > 1 if each constant is spaced by a larger value. Terminating constant is assumed to be a 'Count' member, which is never iterated. A different name for the terminating constant can also be specified on declaration.
NOTE This functionality only works for enumerations of monotonically increasing values, starting with the value zero.
See file documentation for usage example.
EnumType | The enum (class) type. |
Last | Last constant or number thereof (assumes a default 'Count' member). |
Step | Step increment. |
Public Types | |
using | IntegerType = std::underlying_type_t< EnumType > |
Convenience alias. | |
Iterator type traits | |
Satisfies the requirements for STL forward iterator. | |
using | iterator_category = std::forward_iterator_tag |
using | value_type = EnumType |
using | difference_type = std::ptrdiff_t |
using | pointer = EnumType * |
using | reference = EnumType & |
Public Member Functions | |
constexpr | EnumerationIterator (const EnumType index) noexcept |
Copy constructor. | |
EnumerationIterator | operator++ () |
Pre-increment operator. | |
EnumerationIterator | operator++ (int) |
Post-increment operator. | |
EnumType | operator* () const |
Dereference operator. | |
bool | operator== (const EnumerationIterator other) const noexcept |
Comparision operators. | |
bool | operator!= (const EnumerationIterator other) const noexcept |
bool | operator< (const EnumerationIterator other) const noexcept |
bool | operator> (const EnumerationIterator other) const noexcept |
bool | operator<= (const EnumerationIterator other) const noexcept |
bool | operator>= (const EnumerationIterator other) const noexcept |