AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
EnumUtils::Iterator< Enum > Class Template Reference

#include "SmartEnum.h"

Public Types

using iterator_category = std::random_access_iterator_tag
 
using value_type = Enum
 
using pointer = Enum *
 
using reference = Enum &
 
using difference_type = std::ptrdiff_t
 

Public Member Functions

 Iterator ()
 
 Iterator (std::size_t index)
 
bool operator== (const Iterator &other) const
 
bool operator!= (const Iterator &other) const
 
difference_type operator- (Iterator const &other) const
 
bool operator< (const Iterator &other) const
 
bool operator<= (const Iterator &other) const
 
bool operator> (const Iterator &other) const
 
bool operator>= (const Iterator &other) const
 
value_type operator[] (difference_type d) const
 
value_type operator* () const
 
Iteratoroperator+= (difference_type d)
 
Iteratoroperator++ ()
 
Iterator operator++ (int)
 
Iterator operator+ (difference_type d) const
 
Iteratoroperator-= (difference_type d)
 
Iteratoroperator-- ()
 
Iterator operator-- (int)
 
Iterator operator- (difference_type d) const
 

Private Attributes

difference_type _index
 

Detailed Description

template<typename Enum>
class EnumUtils::Iterator< Enum >

Member Typedef Documentation

◆ difference_type

template<typename Enum >
using EnumUtils::Iterator< Enum >::difference_type = std::ptrdiff_t

◆ iterator_category

template<typename Enum >
using EnumUtils::Iterator< Enum >::iterator_category = std::random_access_iterator_tag

◆ pointer

template<typename Enum >
using EnumUtils::Iterator< Enum >::pointer = Enum*

◆ reference

template<typename Enum >
using EnumUtils::Iterator< Enum >::reference = Enum&

◆ value_type

template<typename Enum >
using EnumUtils::Iterator< Enum >::value_type = Enum

Constructor & Destructor Documentation

◆ Iterator() [1/2]

template<typename Enum >
EnumUtils::Iterator< Enum >::Iterator ( )
inline
86: _index(EnumUtils::Count<Enum>()) {}
difference_type _index
Definition: SmartEnum.h:111

◆ Iterator() [2/2]

template<typename Enum >
EnumUtils::Iterator< Enum >::Iterator ( std::size_t  index)
inlineexplicit
87: _index(index) { }

Member Function Documentation

◆ operator!=()

template<typename Enum >
bool EnumUtils::Iterator< Enum >::operator!= ( const Iterator< Enum > &  other) const
inline
90{ return !operator==(other); }
bool operator==(const Iterator &other) const
Definition: SmartEnum.h:89

References EnumUtils::Iterator< Enum >::operator==().

◆ operator*()

template<typename Enum >
value_type EnumUtils::Iterator< Enum >::operator* ( ) const
inline
98{ return operator[](0); }
value_type operator[](difference_type d) const
Definition: SmartEnum.h:97

References EnumUtils::Iterator< Enum >::operator[]().

◆ operator+()

template<typename Enum >
Iterator EnumUtils::Iterator< Enum >::operator+ ( difference_type  d) const
inline
103{ Iterator i = *this; i += d; return i; }
Iterator()
Definition: SmartEnum.h:86

◆ operator++() [1/2]

template<typename Enum >
Iterator & EnumUtils::Iterator< Enum >::operator++ ( )
inline
101{ return operator+=(1); }
Iterator & operator+=(difference_type d)
Definition: SmartEnum.h:100

References EnumUtils::Iterator< Enum >::operator+=().

◆ operator++() [2/2]

template<typename Enum >
Iterator EnumUtils::Iterator< Enum >::operator++ ( int  )
inline
102{ Iterator i = *this; operator++(); return i; }
Iterator & operator++()
Definition: SmartEnum.h:101

References EnumUtils::Iterator< Enum >::operator++().

Referenced by EnumUtils::Iterator< Enum >::operator++().

◆ operator+=()

template<typename Enum >
Iterator & EnumUtils::Iterator< Enum >::operator+= ( difference_type  d)
inline
100{ _index += d; return *this; }

References EnumUtils::Iterator< Enum >::_index.

Referenced by EnumUtils::Iterator< Enum >::operator++().

◆ operator-() [1/2]

template<typename Enum >
Iterator EnumUtils::Iterator< Enum >::operator- ( difference_type  d) const
inline
108{ Iterator i = *this; i -= d; return i; }

◆ operator-() [2/2]

template<typename Enum >
difference_type EnumUtils::Iterator< Enum >::operator- ( Iterator< Enum > const &  other) const
inline
91{ return _index - other._index; }

References EnumUtils::Iterator< Enum >::_index.

◆ operator--() [1/2]

template<typename Enum >
Iterator & EnumUtils::Iterator< Enum >::operator-- ( )
inline
106{ return operator-=(1); }
Iterator & operator-=(difference_type d)
Definition: SmartEnum.h:105

References EnumUtils::Iterator< Enum >::operator-=().

◆ operator--() [2/2]

template<typename Enum >
Iterator EnumUtils::Iterator< Enum >::operator-- ( int  )
inline
107{ Iterator i = *this; operator--(); return i; }
Iterator & operator--()
Definition: SmartEnum.h:106

References EnumUtils::Iterator< Enum >::operator--().

Referenced by EnumUtils::Iterator< Enum >::operator--().

◆ operator-=()

template<typename Enum >
Iterator & EnumUtils::Iterator< Enum >::operator-= ( difference_type  d)
inline
105{ _index -= d; return *this; }

References EnumUtils::Iterator< Enum >::_index.

Referenced by EnumUtils::Iterator< Enum >::operator--().

◆ operator<()

template<typename Enum >
bool EnumUtils::Iterator< Enum >::operator< ( const Iterator< Enum > &  other) const
inline
92{ return _index < other._index; }

References EnumUtils::Iterator< Enum >::_index.

◆ operator<=()

template<typename Enum >
bool EnumUtils::Iterator< Enum >::operator<= ( const Iterator< Enum > &  other) const
inline
93{ return _index <= other._index; }

References EnumUtils::Iterator< Enum >::_index.

◆ operator==()

template<typename Enum >
bool EnumUtils::Iterator< Enum >::operator== ( const Iterator< Enum > &  other) const
inline
89{ return other._index == _index; }

References EnumUtils::Iterator< Enum >::_index.

Referenced by EnumUtils::Iterator< Enum >::operator!=().

◆ operator>()

template<typename Enum >
bool EnumUtils::Iterator< Enum >::operator> ( const Iterator< Enum > &  other) const
inline
94{ return _index > other._index; }

References EnumUtils::Iterator< Enum >::_index.

◆ operator>=()

template<typename Enum >
bool EnumUtils::Iterator< Enum >::operator>= ( const Iterator< Enum > &  other) const
inline
95{ return _index >= other._index; }

References EnumUtils::Iterator< Enum >::_index.

◆ operator[]()

template<typename Enum >
value_type EnumUtils::Iterator< Enum >::operator[] ( difference_type  d) const
inline
97{ return FromIndex<Enum>(_index + d); }

References EnumUtils::Iterator< Enum >::_index.

Referenced by EnumUtils::Iterator< Enum >::operator*().

Member Data Documentation

◆ _index