ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::enumops Namespace Reference

Description:

This is the reference documentation of sub-namespace enumops of the ALib C++ Library, which holds types of library module ALib EnumOps.

Extensive documentation for this module is provided with ALib Module Enums - Programmer's Manual.

Attention
All operators are declared in the global namespace, other than this namespace documentation indicates!

Nested Namespaces:

namespace  arithmetical
 
namespace  bitwise
 
namespace  iterable
 

Type Index:

struct  ArithmeticalTraits
 
struct  BitwiseTraits
 
struct  EnumIterator
 
struct  IterableTraits
 

Concepts

concept  IsArithmetical
 
concept  IsBitwise
 
concept  IsIterable
 

Type Definition Index:

template<typename TEnum>
using EnumBitSet
 

Function Index:

template<typename TEnum>
requires std::is_enum_v<TEnum>
std::underlying_type_t< TEnum > constexpr UnderlyingIntegral (TEnum element) noexcept
 

Type Definition Details:

◆ EnumBitSet

template<typename TEnum>
using alib::enumops::EnumBitSet
Initial value:

This is a type alias (using statement) that is available (enabled) for enumerations for which the type trait IterableTraits is specialized. With this, the interface methods of templated class TBitSet accept and return enumeration elements.

See also
For a quick tutorial on the use of this type, see chapter 3.5 Using Class TBitSet with Iterable Enums of the Programmer's Manual of the module ALib EnumOps.
Template Parameters
TEnumThe enum type to use with class TBitSet.

Definition at line 24 of file iterablebitset.inl.

Function Details:

◆ UnderlyingIntegral()

template<typename TEnum>
requires std::is_enum_v<TEnum>
std::underlying_type_t< TEnum > constexpr alib::enumops::UnderlyingIntegral ( TEnum element)
constexprnoexcept

Simple alias to the nested statement static_cast and type trait std::underlying_type, which

  • is selected by the compiler only if template parameter TEnum represents an enum type, and
  • is probably better readable.

ALib uses this function only in templated code, where the destination type is not determined. In other cases, ALib chooses to convert enum values directly using function-style casts.

Note
While documented in namespace alib::enumops in fact this function resides in namespace alib.
See also
Class Enum introduced with module ALib Boxing.
Template Parameters
TEnumEnumeration type. Deduced by the compiler.
Parameters
elementThe enumeration element.
Returns
true if all bits of testFor are set in tested.

Definition at line 37 of file underlyingintegral.inl.