23#ifndef ENUM_BITFIELD_H
24#define ENUM_BITFIELD_H
77template <
typename Enum >
83template <
typename Enum >
84constexpr typename std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type
87 using underlying =
typename std::underlying_type< const Enum >::type;
88 return static_cast< const Enum
>(
static_cast< underlying
>( lhs ) |
static_cast< underlying
>( rhs ) );
91template <
typename Enum >
92constexpr typename std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type
95 using underlying =
typename std::underlying_type< Enum >::type;
96 return static_cast< const Enum
>(
static_cast< underlying
>( lhs ) &
static_cast< underlying
>( rhs ) );
99template <
typename Enum >
100constexpr typename std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type
103 using underlying =
typename std::underlying_type< Enum >::type;
104 return static_cast< const Enum
>(
static_cast< underlying
>( lhs ) ^
static_cast< underlying
>( rhs ) );
107template <
typename Enum >
108typename std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type
111 using underlying =
typename std::underlying_type< Enum >::type;
112 lhs =
static_cast< Enum
>(
static_cast< underlying
>( lhs ) |
static_cast< underlying
>( rhs ) );
116template <
typename Enum >
117typename std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type
120 using underlying =
typename std::underlying_type< Enum >::type;
121 lhs =
static_cast< Enum
>(
static_cast< underlying
>( lhs ) &
static_cast< underlying
>( rhs ) );
125template <
typename Enum >
126typename std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type
129 using underlying =
typename std::underlying_type< Enum >::type;
130 lhs =
static_cast< Enum
>(
static_cast< underlying
>( lhs ) ^
static_cast< underlying
>( rhs ) );
134template <
typename Enum >
138 using underlying =
typename std::underlying_type< Enum >::type;
139 return static_cast< underlying
>( en & flag ) != 0;
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
constexpr std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type operator|(const Enum lhs, const Enum rhs)
Definition enum_bitfield.h:85
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type operator&=(Enum &lhs, Enum rhs)
Definition enum_bitfield.h:118
constexpr std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type operator&(const Enum lhs, const Enum rhs)
Definition enum_bitfield.h:93
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type operator^=(Enum &lhs, Enum rhs)
Definition enum_bitfield.h:127
std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type operator|=(Enum &lhs, Enum rhs)
Definition enum_bitfield.h:109
constexpr std::enable_if< EnableBitMaskOperators< Enum >::enable, Enum >::type operator^(const Enum &lhs, const Enum rhs)
Definition enum_bitfield.h:101
bool flag_is_set(const Enum en, const Enum flag)
Definition enum_bitfield.h:136
These methods support type-safe bitfields using C++'s enum classes.
Definition enum_bitfield.h:79
static const bool enable
Definition enum_bitfield.h:80