8#ifndef HPP_ALIB_ENUMS_ITERABLE
9#define HPP_ALIB_ENUMS_ITERABLE 1
11#if !defined (HPP_ALIB_ENUMS_BITWISE)
17#if !defined (HPP_ALIB_ENUMS_UNDERLYING_INTEGRAL)
21#if !defined (_GLIBCXX_CSTDINT) && !defined (_CSTDINT_)
25#if !defined (_GLIBCXX_ITERATOR) && !defined (_ITERATOR_)
29namespace alib {
namespace enums {
74template<
typename TEnum,
75 typename TEnableIf=
typename std::enable_if<std::is_enum<TEnum>::value>::type>
95 static constexpr TEnum
End;
106#define ALIB_ENUMS_MAKE_ITERABLE_BEGIN_END(TEnum, StartElement, StopElement ) \
107namespace alib::enums { \
108template<> struct T_EnumIsIterable<TEnum> : std::true_type \
110 static constexpr TEnum Begin = StartElement; \
111 static constexpr TEnum End = StopElement; \
114#define ALIB_ENUMS_MAKE_ITERABLE(TEnum, StopElement ) \
115ALIB_ENUMS_MAKE_ITERABLE_BEGIN_END( TEnum, TEnum(0), StopElement )
125namespace alib {
namespace enums {
149template<
typename TEnum>
151TEnum
operator+ (TEnum element,
int addend)
noexcept(
true);
153template<
typename TEnum>
156operator+ (TEnum element,
int addend)
noexcept(
true)
158 return TEnum( alib::UnderlyingIntegral(element) + addend );
174template<
typename TEnum>
176TEnum
operator- (TEnum element,
int subtrahend)
noexcept(
true);
179template<
typename TEnum>
182operator- (TEnum element,
int subtrahend)
noexcept(
true)
184 return TEnum( alib::UnderlyingIntegral(element) - subtrahend );
193 namespace alib {
namespace enums {
213template<
typename TEnum,
typename TEnableIf>
216template<typename TEnum, typename TEnableIf
234 template<
typename TPo
inter,
typename TReference>
248 using TIntegral=
typename std::underlying_type<TEnum>::type;
298 return !(*
this == other);
482template<
typename TEnum,
typename TEnableIf=
void>
487template<
typename TEnum,
typename TEnableIf
bool operator<=(TRandomAccessIterator other) const
TEnum operator[](std::ptrdiff_t n) const
std::ptrdiff_t operator-(TRandomAccessIterator other) const
constexpr TRandomAccessIterator(TEnum _p=TEnum(0))
TRandomAccessIterator operator-(TIntegral n) const
bool operator<(TRandomAccessIterator other) const
typename std::underlying_type< TEnum >::type TIntegral
bool operator>=(TRandomAccessIterator other) const
TEnum value_type
Implementation of std::iterator_traits.
TRandomAccessIterator operator+(TIntegral n) const
TRandomAccessIterator & operator++()
TRandomAccessIterator & operator-=(TIntegral n)
std::random_access_iterator_tag iterator_category
Implementation of std::iterator_traits.
constexpr bool operator==(TRandomAccessIterator other) const
TRandomAccessIterator & operator+=(TIntegral n)
bool operator>(TRandomAccessIterator other) const
TRandomAccessIterator operator--(int)
TPointer pointer
Implementation of std::iterator_traits.
TRandomAccessIterator & operator--()
constexpr bool operator!=(TRandomAccessIterator other) const
std::ptrdiff_t difference_type
Implementation of std::iterator_traits.
TRandomAccessIterator operator++(int)
TReference reference
Implementation of std::iterator_traits.
constexpr TEnum operator*() const
#define ALIB_ASSERT_MODULE(modulename)
#define ATMP_VOID_IF(Cond)
#define ATMP_EQ( T, TEqual)
#define ATMP_T_IF(T, Cond)
constexpr TEnum operator+(TEnum element, int addend) noexcept(true)
constexpr TEnum operator-(TEnum element, int subtrahend) noexcept(true)
constexpr std::underlying_type< TEnum >::type UnderlyingIntegral(TEnum element) noexcept(true)
constexpr int MSB(TIntegral value)
ConstIterator end() const
TRandomAccessIterator< const TEnum *, const TEnum & > ConstIterator
ConstIterator begin() const
static constexpr TEnum Begin
static constexpr TEnum End