Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions
gmx::EnumerationIterator< EnumType, Last, Step > Class Template Referencefinal

#include <gromacs/utility/enumerationhelpers.h>

Inherits iterator_interface< EnumerationIterator< EnumType, Last, Step >, std::random_access_iterator_tag, EnumType >.

Description

template<typename EnumType, EnumType Last = EnumType::Count, std::ptrdiff_t Step = 1>
class gmx::EnumerationIterator< EnumType, Last, Step >

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.

Template Parameters
EnumTypeThe enum (class) type.
LastLast constant or number thereof (assumes a default 'Count' member).
StepStep increment.

Public Types

using IntegerType = std::underlying_type_t< EnumType >
 Convenience alias.
 

Public Member Functions

constexpr EnumerationIterator (const EnumType enumIndex) noexcept
 Conversion constructor.
 
constexpr EnumerationIteratoroperator+= (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.
 

The documentation for this class was generated from the following file: