25#define ENUM_RANGE_BY_COUNT(EnumType, Count) ENUM_RANGE_BY_FIRST_AND_LAST(EnumType, 0, (std::underlying_type_t<EnumType>)(Count) - 1)
47#define ENUM_RANGE_BY_FIRST_AND_LAST(EnumType, First, Last) \
49 struct NEnumRangePrivate::TEnumRangeTraits<EnumType> \
51 enum { RangeType = 0 }; \
52 static constexpr std::underlying_type_t<EnumType> Begin = (std::underlying_type_t<EnumType>)(First); \
53 static constexpr std::underlying_type_t<EnumType> End = (std::underlying_type_t<EnumType>)(Last) + 1; \
74#define ENUM_RANGE_BY_VALUES(EnumType, ...) \
76 struct NEnumRangePrivate::TEnumRangeTraits<EnumType> \
78 enum { RangeType = 1 }; \
79 template <typename Dummy> \
80 static const EnumType* GetPointer(bool bLast) \
82 static constexpr EnumType Values[] = { __VA_ARGS__ }; \
83 return bLast ? Values + sizeof(Values) / sizeof(EnumType) : Values; \
90 template <
typename EnumType>
96 template <
typename EnumType,
int32 RangeType>
99 static_assert(
sizeof(EnumType) == 0,
"Unknown enum type - use one of the ENUM_RANGE macros to define iteration semantics for your enum type.");
102 template <
typename EnumType>
105 using IntType = std::underlying_type_t<EnumType>;
120 return (EnumType)Value;
128 return Lhs.Value != Rhs.Value;
132 template <
typename EnumType>
156 return Lhs.Ptr != Rhs.Ptr;
160 template <
typename EnumType>
180 BeginValue < EndValue
183 TEXT(
"The provided first and last enum values must be within the available range specified in the ENUM_RANGE macro."));
190 const IntType BeginValue;
191 const IntType EndValue;
194 template <
typename EnumType>
208 template <
typename EnumType>
211 using IntType = std::underlying_type_t<EnumType>;
228 return (EnumType)Result;
236 return Lhs.Flags != Rhs.Flags;
240 template <
typename EnumType>
264template <
typename EnumType>
284template <
typename EnumType>
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::EnumFlags::Private::TRange< EnumType > MakeFlagsRange(EnumType Flags)
Definition EnumRange.h:285
Definition EnumRange.h:89
Definition EnumRange.h:207
Definition EnumRange.h:104
std::underlying_type_t< EnumType > IntType
Definition EnumRange.h:105
UE_FORCEINLINE_HINT TEnumContiguousIterator(IntType InValue)
Definition EnumRange.h:107
TEnumContiguousIterator & operator++()
Definition EnumRange.h:112
UE_FORCEINLINE_HINT friend bool operator!=(const TEnumContiguousIterator &Lhs, const TEnumContiguousIterator &Rhs)
Definition EnumRange.h:126
UE_FORCEINLINE_HINT EnumType operator*() const
Definition EnumRange.h:118
Definition EnumRange.h:92
@ RangeType
Definition EnumRange.h:93
TEnumRange_Impl(const EnumType InFirstValue, const EnumType InLastValue)
Definition EnumRange.h:175
TEnumContiguousIterator< EnumType > begin() const
Definition EnumRange.h:186
TEnumRange_Impl()
Definition EnumRange.h:165
typename TEnumContiguousIterator< EnumType >::IntType IntType
Definition EnumRange.h:163
TEnumContiguousIterator< EnumType > end() const
Definition EnumRange.h:187
UE_FORCEINLINE_HINT TEnumRange_Impl(const EnumType InFirstValue, const EnumType InLastValue)=delete
TEnumValueArrayIterator< EnumType > begin() const
Definition EnumRange.h:201
TEnumValueArrayIterator< EnumType > end() const
Definition EnumRange.h:202
UE_FORCEINLINE_HINT TEnumRange_Impl()=default
Definition EnumRange.h:98
Definition EnumRange.h:134
TEnumValueArrayIterator & operator++()
Definition EnumRange.h:140
UE_FORCEINLINE_HINT friend bool operator!=(const TEnumValueArrayIterator &Lhs, const TEnumValueArrayIterator &Rhs)
Definition EnumRange.h:154
UE_FORCEINLINE_HINT EnumType operator*() const
Definition EnumRange.h:146
UE_FORCEINLINE_HINT TEnumValueArrayIterator(const EnumType *InPtr)
Definition EnumRange.h:135
Definition EnumRange.h:266
Definition EnumRange.h:210
EnumType operator*() const
Definition EnumRange.h:225
TIterator & operator++()
Definition EnumRange.h:218
std::underlying_type_t< EnumType > IntType
Definition EnumRange.h:211
UE_FORCEINLINE_HINT friend bool operator!=(const TIterator &Lhs, const TIterator &Rhs)
Definition EnumRange.h:234
UE_FORCEINLINE_HINT TIterator(EnumType InFlags)
Definition EnumRange.h:213
Definition EnumRange.h:242
TRange(EnumType InFlags)
Definition EnumRange.h:243
Private::TIterator< EnumType > begin() const
Definition EnumRange.h:245
Private::TIterator< EnumType > end() const
Definition EnumRange.h:246