ALib C++ Library
by
Library Version:
2412 R0
Documentation generated by
Loading...
Searching...
No Matches
home
dev
A-Worx
ALib
src
alib
enums
iterablebitset.hpp
Go to the documentation of this file.
1
//==================================================================================================
2
/// \file
3
/// This header file is part of module \alib_enums of the \aliblong.
4
///
5
/// \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
6
/// Published under \ref mainpage_license "Boost Software License".
7
//==================================================================================================
8
#ifndef HPP_ALIB_ENUMS_ITERABLE_BITSET
9
#define HPP_ALIB_ENUMS_ITERABLE_BITSET 1
10
#pragma once
11
#include "
alib/enums/iterable.hpp
"
12
13
ALIB_ASSERT_MODULE
(ENUMS)
14
15
#include "alib/lang/bitset.hpp"
16
17
namespace
alib
{
namespace
enums {
18
#if DOXYGEN
19
//==================================================================================================
20
/// This is a using statement which is available (enabled) for enumerations for which traits struct
21
/// \alib{enums;T_EnumIsIterable} is specialized. With this, the interface methods of templated
22
/// class \alib{lang;TBitSet} accept and return enumeration elements.
23
///
24
/// @see For a quick tutorial on the use of this type, see chapter
25
/// \ref alib_enums_iter_bitset "3.5 Using Class TBitSet with Iterable Enums" of the Programmer's
26
/// Manual of module \alib_enums_nl.
27
///
28
/// @tparam TEnum The enum type to use with class \alib{lang;TBitSet}.
29
/// \note Other than documented here, this using statement has a second template parameter
30
/// \p{TEnableIf}. This parameter has a default expressions and <b>must not</b> be provided
31
/// because it is used internally to ensure that only if a specialization of
32
/// \alib{enums;T_EnumIsIterable;T_EnumIsIterable<TEnum>} exists, this type definition becomes
33
/// available.
34
/// (..and this is why it was explicitly 'faked out' of this documentation).
35
//==================================================================================================
36
template
<
typename
TEnum>
37
using
EnumBitSet
= TBitSet<TEnum, enums::T_EnumIsIterable<TEnum>::End,
38
enums::T_EnumIsIterable<TEnum>::Begin
>;
39
#else
40
template
<
typename
TEnum,
typename
TEnableIf
41
=
ATMP_VOID_IF
(
ATMP_EQ
(
const
TEnum,
decltype
(
alib::enums::T_EnumIsIterable<TEnum>::Begin
)) ) >
42
using
EnumBitSet
=
lang::TBitSet<TEnum, enums::T_EnumIsIterable<TEnum>::End
,
43
enums::T_EnumIsIterable<TEnum>::Begin
>;
44
#endif
45
}
// namespace alib[::enums]
46
47
#if DOXYGEN
48
49
/// Type alias in namespace \b alib.
50
/// @see For more information, consult type definition \alib{enums;EnumBitSet}.
51
template
<
typename
TEnum>
52
using
EnumBitSet
=
lang::TBitSet<TEnum, enums::T_EnumIsIterable<TEnum>::End
,
53
enums::T_EnumIsIterable<TEnum>::Begin
>;
54
#else
55
template
<
typename
TEnum,
typename
TEnableIf
56
=
ATMP_VOID_IF
(
ATMP_EQ
(
const
TEnum,
decltype
(
alib::enums::T_EnumIsIterable<TEnum>::Begin
)) ) >
57
using
EnumBitSet
=
lang::TBitSet<TEnum, enums::T_EnumIsIterable<TEnum>::End
,
58
enums::T_EnumIsIterable<TEnum>::Begin
>;
59
#endif
60
61
}
// namespace [alib]
62
63
#endif
// HPP_ALIB_ENUMS_ITERABLE_BITSET
64
alib::lang::TBitSet
Definition
bitset.hpp:70
ALIB_ASSERT_MODULE
#define ALIB_ASSERT_MODULE(modulename)
Definition
alib.hpp:223
ATMP_VOID_IF
#define ATMP_VOID_IF(Cond)
Definition
tmp.hpp:47
ATMP_EQ
#define ATMP_EQ( T, TEqual)
Definition
tmp.hpp:27
iterable.hpp
alib::enums::EnumBitSet
TBitSet< TEnum, enums::T_EnumIsIterable< TEnum >::End, enums::T_EnumIsIterable< TEnum >::Begin > EnumBitSet
Definition
iterablebitset.hpp:37
alib
Definition
alib.cpp:69
alib::enums::T_EnumIsIterable
Definition
iterable.hpp:67