azure-data-tables
Loading...
Searching...
No Matches
Functions
enum_operators.hpp File Reference

Defines bitwise operators for enums. More...

#include <type_traits>

Go to the source code of this file.

Functions

template<class E , class = std::enable_if_t<std::is_enum<E>{}>>
constexpr E Azure::Data::Tables::operator| (E lhs, E rhs)
 Bitwise OR operator for enum class.
 
template<class E , class = std::enable_if_t<std::is_enum<E>{}>>
constexpr E & Azure::Data::Tables::operator|= (E &lhs, E rhs)
 Bitwise OR EQUALS operator for enum class.
 
template<class E , class = std::enable_if_t<std::is_enum<E>{}>>
constexpr E Azure::Data::Tables::operator& (E lhs, E rhs)
 Bitwise AND operator for enum class.
 
template<class E , class = std::enable_if_t<std::is_enum<E>{}>>
constexpr E & Azure::Data::Tables::operator&= (E &lhs, E rhs)
 Bitwise AND EQUALS operator for enum class.
 
template<class E , class = std::enable_if_t<std::is_enum<E>{}>>
constexpr E Azure::Data::Tables::operator^ (E lhs, E rhs)
 Bitwise XOR operator for enum class.
 
template<class E , class = std::enable_if_t<std::is_enum<E>{}>>
constexpr E & Azure::Data::Tables::operator^= (E &lhs, E rhs)
 Bitwise XOR EQUALS operator for enum class.
 
template<class E , class = std::enable_if_t<std::is_enum<E>{}>>
constexpr E Azure::Data::Tables::operator~ (E rhs)
 Bitwise COMPLEMENT operator for enum class.
 

Detailed Description

This file defines bitwise operators for enum classes. This allows the use of the operators |, |=, &, &=, ^, ^=, and ~ with enum classes. This is useful for flags enums. Example: enum class MyEnum { A = 1, B = 2, C = 4 }; MyEnum e = MyEnum::A | MyEnum::B; Example: enum class MyEnum { A = 1, B = 2, C = 4 }; MyEnum e = MyEnum::A; e &= MyEnum::B;