EnumIterator< Enum > Class Template Reference
An iterator over enum types. More...
#include <EnumIface.hh>
Public Types | |
| using | difference_type = std::ptrdiff_t |
| using | iterator_category = std::bidirectional_iterator_tag |
| using | pointer = Enum * |
| using | reference = Enum & |
| using | value_type = Enum |
Public Member Functions | |
| EnumIterator ()=default | |
| Constructor. | |
| EnumIterator (const Enum &_c) | |
| Constructor. | |
| Enum | operator* () const |
| Dereference operator. | |
| EnumIterator & | operator++ () |
| Prefix increment operator. | |
| EnumIterator | operator++ (const int) |
| Postfix increment operator. | |
| EnumIterator & | operator-- () |
| Prefix decrement operator. | |
| EnumIterator | operator-- (const int) |
| Postfix decrement operator. | |
| EnumIterator & | operator= (const Enum &_c) |
| Equal operator. | |
| Enum | Value () const |
| Get the enum value. | |
Detailed Description
template<typename Enum>
class gz::common::EnumIterator< Enum >
class gz::common::EnumIterator< Enum >
An iterator over enum types.
Example:
/// enum MyType
/// {
/// MY_TYPE_BEGIN = 0,
/// TYPE1 = MY_TYPE_BEGIN,
/// TYPE2 = 1,
/// MY_TYPE_END
/// };
///
/// auto myTypeIface = gzEnum(MY_TYPE_BEGIN, MY_TYPE_END,
/// {"TYPE1",
/// "TYPE2",
/// "MY_TYPE_END"});
///
/// int main()
/// {
/// EnumIterator<MyType> i = MY_TYPE_BEGIN;
/// std::cout << "Type Number[" << *i << "]\n";
/// std::cout << "Type Name[" << myTypeIface.Str(*i) << "]\n";
/// i++;
/// std::cout << "Type++ Number[" << *i << "]\n";
/// std::cout << "Type++ Name[" << myTypeIface.Str(*i) << "]\n";
/// }
/// Member Typedef Documentation
◆ difference_type
template<typename Enum >
| using difference_type = std::ptrdiff_t |
◆ iterator_category
template<typename Enum >
| using iterator_category = std::bidirectional_iterator_tag |
◆ pointer
template<typename Enum >
| using pointer = Enum* |
◆ reference
template<typename Enum >
| using reference = Enum& |
◆ value_type
template<typename Enum >
| using value_type = Enum |
Constructor & Destructor Documentation
◆ EnumIterator() [1/2]
template<typename Enum >
|
default |
Constructor.
◆ EnumIterator() [2/2]
template<typename Enum >
|
inlineexplicit |
Constructor.
- Parameters
-
[in] _c Enum value
Member Function Documentation
◆ operator*()
template<typename Enum >
|
inline |
Dereference operator.
- Returns
- Value of the iterator
◆ operator++() [1/2]
template<typename Enum >
|
inline |
Prefix increment operator.
- Returns
- Iterator pointing to the next value in the enum.
◆ operator++() [2/2]
template<typename Enum >
|
inline |
Postfix increment operator.
- Returns
- Iterator pointing to the next value in the enum.
◆ operator--() [1/2]
template<typename Enum >
|
inline |
Prefix decrement operator.
- Returns
- Iterator pointing to the previous value in the enum
◆ operator--() [2/2]
template<typename Enum >
|
inline |
Postfix decrement operator.
- Returns
- Iterator pointing to the previous value in the enum
◆ operator=()
template<typename Enum >
|
inline |
Equal operator.
- Parameters
-
[in] _c Enum value to copy
◆ Value()
template<typename Enum >
|
inline |
The documentation for this class was generated from the following file: