FE 0.9.0
Header-only C++ frontend library
Loading...
Searching...
No Matches
enum.h File Reference
#include <type_traits>
Include dependency graph for enum.h:

Go to the source code of this file.

Classes

struct  fe::is_bit_enum< T >

Namespaces

namespace  fe

Concepts

concept  fe::BitEnum

Functions

template<fe::BitEnum E>
constexpr E operator| (E a, E b) noexcept
template<fe::BitEnum E>
constexpr E operator& (E a, E b) noexcept
template<fe::BitEnum E>
constexpr E operator^ (E a, E b) noexcept
template<fe::BitEnum E>
constexpr E operator~ (E a) noexcept
template<fe::BitEnum E>
constexpr E & operator|= (E &a, E b) noexcept
template<fe::BitEnum E>
constexpr E & operator&= (E &a, E b) noexcept
template<fe::BitEnum E>
constexpr E & operator^= (E &a, E b) noexcept
template<fe::BitEnum E>
constexpr bool fe::has_flag (E value, E flag) noexcept
Bit operations for enum classs

Provides all kind of bit and comparison operators for an enum class E.

Use like this:

enum class MyEnum : unsigned {
A = 1 << 0,
B = 1 << 1,
C = 1 << 2,
};
template<> struct fe::is_bit_enum<MyEnum> : std::true_type {};
template<fe::BitEnum E>
constexpr auto fe::to_underlying (E e) noexcept

Function Documentation

◆ operator&()

template<fe::BitEnum E>
E operator& ( E a,
E b )
constexprnoexcept

Definition at line 31 of file enum.h.

References fe::to_underlying().

◆ operator&=()

template<fe::BitEnum E>
E & operator&= ( E & a,
E b )
constexprnoexcept

Definition at line 35 of file enum.h.

◆ operator^()

template<fe::BitEnum E>
E operator^ ( E a,
E b )
constexprnoexcept

Definition at line 32 of file enum.h.

References fe::to_underlying().

◆ operator^=()

template<fe::BitEnum E>
E & operator^= ( E & a,
E b )
constexprnoexcept

Definition at line 36 of file enum.h.

◆ operator|()

template<fe::BitEnum E>
E operator| ( E a,
E b )
constexprnoexcept

Definition at line 30 of file enum.h.

References fe::to_underlying().

◆ operator|=()

template<fe::BitEnum E>
E & operator|= ( E & a,
E b )
constexprnoexcept

Definition at line 34 of file enum.h.

◆ operator~()

template<fe::BitEnum E>
E operator~ ( E a)
constexprnoexcept

Definition at line 33 of file enum.h.