open62541pp 0.15.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
opcua::IsBitmaskEnum< T > Struct Template Reference

#include <bitmask.hpp>

Inheritance diagram for opcua::IsBitmaskEnum< T >:
[legend]

Detailed Description

template<typename T>
struct opcua::IsBitmaskEnum< T >

Trait to define an enum (class) as a bitmask and allow bitwise operations.

// define enum (class)
enum class Access {
Read = 1 << 0,
Write = 1 << 1,
};
// allow bitwise operations
// 1. with template specialization of IsBitmaskEnum trait
template <>
struct IsBitmaskEnum<Access> : std::true_type {};
// 2. with overload of function isBitmaskEnum
constexpr std::true_type isBitmaskEnum(Access);
// use bitwise operations
Access mask = Access::Read | Access::Write;
constexpr std::false_type isBitmaskEnum(T)
Function template to define an enum (class) as a bitmask and allow bitwise operations.
Trait to define an enum (class) as a bitmask and allow bitwise operations.
Definition bitmask.hpp:44

Definition at line 44 of file bitmask.hpp.

Related Symbols

(Note that these are not member symbols.)

template<typename T >
constexpr std::enable_if_t< IsBitmaskEnum< T >::value, T > operator& (T lhs, T rhs) noexcept
 
template<typename T >
constexpr std::enable_if_t< IsBitmaskEnum< T >::value, T > operator| (T lhs, T rhs) noexcept
 
template<typename T >
constexpr std::enable_if_t< IsBitmaskEnum< T >::value, T > operator^ (T lhs, T rhs) noexcept
 
template<typename T >
constexpr std::enable_if_t< IsBitmaskEnum< T >::value, T > operator~ (T rhs) noexcept
 
template<typename T >
constexpr std::enable_if_t< IsBitmaskEnum< T >::value, T > operator|= (T &lhs, T rhs) noexcept
 
template<typename T >
constexpr std::enable_if_t< IsBitmaskEnum< T >::value, T > operator&= (T &lhs, T rhs) noexcept
 
template<typename T >
constexpr std::enable_if_t< IsBitmaskEnum< T >::value, T > operator^= (T &lhs, T rhs) noexcept