Gromacs
2022.2
|
#include <gromacs/utility/enumerationhelpers.h>
Inherits iterator_interface< EnumerationIterator< EnumType, Last, Step >, std::random_access_iterator_tag, EnumType >.
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. | |
Public Member Functions | |
constexpr | EnumerationIterator (const EnumType index) noexcept |
Conversion constructor. | |
constexpr EnumerationIterator & | operator+= (std::ptrdiff_t i) noexcept |
Addition-assignment operator. | |
constexpr EnumType | operator* () const noexcept |
Dereference operator. | |
constexpr std::ptrdiff_t | operator- (const EnumerationIterator other) const noexcept |
Difference operator. | |