FE 0.13.1
Header-only C++ frontend library
Loading...
Searching...
No Matches
enum.h File Reference
#include <cassert>
#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 36 of file enum.h.

References operator&(), and fe::to_underlying().

Referenced by operator&().

◆ operator&=()

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

Definition at line 40 of file enum.h.

References operator&=().

Referenced by operator&=().

◆ operator^()

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

Definition at line 37 of file enum.h.

References operator^(), and fe::to_underlying().

Referenced by operator^().

◆ operator^=()

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

Definition at line 41 of file enum.h.

References operator^=().

Referenced by operator^=().

◆ operator|()

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

Definition at line 35 of file enum.h.

References operator|(), and fe::to_underlying().

Referenced by operator|().

◆ operator|=()

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

Definition at line 39 of file enum.h.

References operator|=().

Referenced by operator|=().

◆ operator~()

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

Definition at line 38 of file enum.h.

References operator~().

Referenced by operator~().