OmniSciDB  2e3a973ef4
EnumBitmaskOps.h File Reference
#include <type_traits>
+ Include dependency graph for EnumBitmaskOps.h:

Go to the source code of this file.

Classes

struct  EnableBitmaskOps< T >
 

Macros

#define ENABLE_BITMASK_OPS(x)
 

Functions

template<typename T >
std::enable_if_t< EnableBitmaskOps< T >::enable, T > operator & (T lhs, T rhs)
 
template<typename T >
std::enable_if_t< EnableBitmaskOps< T >::enable, T > operator| (T lhs, T rhs)
 
template<typename T >
std::enable_if_t< EnableBitmaskOps< T >::enable, T > operator~ (T t)
 
template<typename T >
std::enable_if_t< EnableBitmaskOps< T >::enable, T > operator|= (T &lhs, T rhs)
 
template<typename T >
std::enable_if_t< EnableBitmaskOps< T >::enable, T > operator &= (T &lhs, T rhs)
 

Macro Definition Documentation

◆ ENABLE_BITMASK_OPS

#define ENABLE_BITMASK_OPS (   x)
Value:
template <> \
static const bool enable = true; \
};

Definition at line 71 of file EnumBitmaskOps.h.

Function Documentation

◆ operator &()

template<typename T >
std::enable_if_t<EnableBitmaskOps<T>::enable, T> operator& ( lhs,
rhs 
)

Definition at line 47 of file EnumBitmaskOps.h.

References run_benchmark_import::type.

47  {
48  using type = typename std::underlying_type_t<T>;
49  return static_cast<T>(static_cast<type>(lhs) & static_cast<type>(rhs));
50 }

◆ operator &=()

template<typename T >
std::enable_if_t<EnableBitmaskOps<T>::enable, T> operator&= ( T &  lhs,
rhs 
)

Definition at line 66 of file EnumBitmaskOps.h.

66  {
67  lhs = lhs & rhs;
68  return lhs;
69 }

◆ operator|()

template<typename T >
std::enable_if_t<EnableBitmaskOps<T>::enable, T> operator| ( lhs,
rhs 
)

Definition at line 52 of file EnumBitmaskOps.h.

References run_benchmark_import::type.

52  {
53  using type = typename std::underlying_type_t<T>;
54  return static_cast<T>(static_cast<type>(lhs) | static_cast<type>(rhs));
55 }

◆ operator|=()

template<typename T >
std::enable_if_t<EnableBitmaskOps<T>::enable, T> operator|= ( T &  lhs,
rhs 
)

Definition at line 61 of file EnumBitmaskOps.h.

61  {
62  lhs = lhs | rhs;
63  return lhs;
64 }

◆ operator~()

template<typename T >
std::enable_if_t<EnableBitmaskOps<T>::enable, T> operator~ ( t)

Definition at line 57 of file EnumBitmaskOps.h.

57  {
58  return static_cast<T>(~static_cast<std::underlying_type_t<T>>(t));
59 }