ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
enumops.prepro.hpp File Reference

Description:

This header-file is part of the ALib C++ Framework.

© 2013-2025 A-Worx GmbH, Germany. Published under Boost Software License.

Definition in file enumops.prepro.hpp.

#include "alib/alib.inl"

Go to the source code of this file.

Macros

#define ALIB_ENUMS_MAKE_ARITHMETICAL(TEnum)
#define ALIB_ENUMS_MAKE_BITWISE(TEnum)
#define ALIB_ENUMS_MAKE_ITERABLE(TEnum, StopElement)
#define ALIB_ENUMS_MAKE_ITERABLE_BEGIN_END(TEnum, StartElement, StopElement)

Macro Definition Documentation

◆ ALIB_ENUMS_MAKE_ARITHMETICAL

#define ALIB_ENUMS_MAKE_ARITHMETICAL ( TEnum)
Value:
namespace alib::enumops { \
template<> struct ArithmeticalTraits<TEnum> : std::true_type {}; } \

Specializes the type trait ArithmeticalTraits to inherit std::true_type to enable a set of arithmetic operators on the elements of TEnum.

Usually, this macro is placed in a header-file, probably close to the enum type definition. However, it has to be placed in global (no) namespace.

See also
Chapter 2.1 Standard Arithmetical Operators of the Programmer's Manual of module ALib EnumOps for more information.
Parameters
TEnumType of a scoped or non-scoped enumeration that is to be declared an arithmetical type.

Definition at line 19 of file enumops.prepro.hpp.

◆ ALIB_ENUMS_MAKE_BITWISE

#define ALIB_ENUMS_MAKE_BITWISE ( TEnum)
Value:
namespace alib::enumops { \
template<> \
struct BitwiseTraits<TEnum> : std::true_type {}; }

Specializes the type trait BitwiseTraits to inherit std::true_type.

Usually, this macro is placed in a header-file, probably close to the enum type definition. However, it has to be placed in global (no) namespace.

See also
Chapter 2.2 Bitwise Operators of the Programmer's Manual of module ALib EnumOps for more information.
Parameters
TEnumType of a scoped or non-scoped enumeration that is to be declared a bitwise type.

Definition at line 23 of file enumops.prepro.hpp.

◆ ALIB_ENUMS_MAKE_ITERABLE

#define ALIB_ENUMS_MAKE_ITERABLE ( TEnum,
StopElement )
Value:
ALIB_ENUMS_MAKE_ITERABLE_BEGIN_END( TEnum, TEnum(0), StopElement )
#define ALIB_ENUMS_MAKE_ITERABLE_BEGIN_END(TEnum, StartElement, StopElement)

Shortcut to ALIB_ENUMS_MAKE_ITERABLE_BEGIN_END, providing TEnum(0) as macro parameter StartElement.

Usually, this macro is placed in a header-file, probably close to the enum type definition. However, it has to be placed in global (no) namespace.

See also
Sibling macro ALIB_ENUMS_MAKE_ITERABLE_BEGIN_END and chapter 3. Iterable Enums of the Programmer's Manual of module ALib EnumOps for more information.
Parameters
TEnumType of a scoped or non-scoped enumeration that is to be declared an iterable enum type.
StopElementThe enum element after the last "valid" element in the enumeration.
Will be used as constexpr static constexpr TEnum End.

Definition at line 36 of file enumops.prepro.hpp.

◆ ALIB_ENUMS_MAKE_ITERABLE_BEGIN_END

#define ALIB_ENUMS_MAKE_ITERABLE_BEGIN_END ( TEnum,
StartElement,
StopElement )
Value:
namespace alib::enumops { \
template<> struct IterableTraits<TEnum> : std::true_type \
{ \
static constexpr TEnum Begin = StartElement; \
static constexpr TEnum End = StopElement; \
};}

Specializes the type trait IterableTraits to implement methods:

  • Begin to return StartElement
  • End to return StopElement

Usually, this macro is placed in a header-file, probably close to the enum type definition. However, it has to be placed in global (no) namespace.

See also
Sibling macro ALIB_ENUMS_MAKE_ITERABLE and chapter 3. Iterable Enums of the Programmer's Manual of module ALib EnumOps for more information.
Parameters
TEnumType of a scoped or non-scoped enumeration that is to be declared an iterable enum type.
StartElementThe first element of the enumeration.
Will be used as constexpr static constexpr TEnum End.
StopElementThe enum element after the last "valid" element in the enumeration.
Will be used as constexpr static constexpr TEnum End.

Definition at line 28 of file enumops.prepro.hpp.