OmniSciDB  d2f719934e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 > constexpr 
operator& (T lhs, T rhs)
 
template<typename T >
std::enable_if_t
< EnableBitmaskOps< T >
::enable, T > constexpr 
operator| (T lhs, T rhs)
 
template<typename T >
std::enable_if_t
< EnableBitmaskOps< T >
::enable, T > constexpr 
operator~ (T t)
 
template<typename T >
std::enable_if_t
< EnableBitmaskOps< T >
::enable, T > constexpr 
operator|= (T &lhs, T rhs)
 
template<typename T >
std::enable_if_t
< EnableBitmaskOps< T >
::enable, T > constexpr 
operator&= (T &lhs, T rhs)
 
template<typename T >
std::enable_if_t
< EnableBitmaskOps< T >
::enable, bool > constexpr 
any_bits_set (T t)
 

Macro Definition Documentation

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

Definition at line 82 of file EnumBitmaskOps.h.

Function Documentation

template<typename T >
std::enable_if_t<EnableBitmaskOps<T>::enable, bool> constexpr any_bits_set ( t)

Definition at line 76 of file EnumBitmaskOps.h.

References t, and run_benchmark_import::type.

76  {
77  using type = typename std::underlying_type_t<T>;
78  constexpr type zero{};
79  return static_cast<type>(t) != zero;
80 }
char * t
template<typename T >
std::enable_if_t<EnableBitmaskOps<T>::enable, T> constexpr operator& ( lhs,
rhs 
)

Definition at line 47 of file EnumBitmaskOps.h.

References omnisci.dtypes::T, and run_benchmark_import::type.

48  {
49  using type = typename std::underlying_type_t<T>;
50  return static_cast<T>(static_cast<type>(lhs) & static_cast<type>(rhs));
51 }
template<typename T >
std::enable_if_t<EnableBitmaskOps<T>::enable, T> constexpr operator&= ( T &  lhs,
rhs 
)

Definition at line 69 of file EnumBitmaskOps.h.

70  {
71  lhs = lhs & rhs;
72  return lhs;
73 }
template<typename T >
std::enable_if_t<EnableBitmaskOps<T>::enable, T> constexpr operator| ( lhs,
rhs 
)

Definition at line 53 of file EnumBitmaskOps.h.

References omnisci.dtypes::T, and run_benchmark_import::type.

54  {
55  using type = typename std::underlying_type_t<T>;
56  return static_cast<T>(static_cast<type>(lhs) | static_cast<type>(rhs));
57 }
template<typename T >
std::enable_if_t<EnableBitmaskOps<T>::enable, T> constexpr operator|= ( T &  lhs,
rhs 
)

Definition at line 63 of file EnumBitmaskOps.h.

64  {
65  lhs = lhs | rhs;
66  return lhs;
67 }
template<typename T >
std::enable_if_t<EnableBitmaskOps<T>::enable, T> constexpr operator~ ( t)

Definition at line 59 of file EnumBitmaskOps.h.

References omnisci.dtypes::T, and t.

59  {
60  return static_cast<T>(~static_cast<std::underlying_type_t<T>>(t));
61 }
char * t