Circus 0.0.1-alpha
C++ Serialization Framework
Loading...
Searching...
No Matches
enum_flag.hpp File Reference

Provides a type-safe wrapper for enum flags with bitwise operations. More...

#include <cstdint>
#include <iostream>
#include "../circus_traits.hpp"

Go to the source code of this file.

Classes

class  circus::utils::enum_flag< T >
 A utility class for strongly typed enum flags with bitwise operations. More...

Functions

template<typename E>
requires circus::traits::Flaggable<E>
constexpr E operator| (E lhs, E rhs)
 Bitwise OR operator for enum types flagged by circus::traits::Flaggable.
template<typename E>
requires circus::traits::Flaggable<E>
constexpr E operator& (E lhs, E rhs)
 Bitwise AND operator for enum types flagged by circus::traits::Flaggable.
template<typename E>
requires circus::traits::Flaggable<E>
constexpr E operator~ (E val)
 Bitwise NOT operator for enum types flagged by circus::traits::Flaggable.

Detailed Description

Provides a type-safe wrapper for enum flags with bitwise operations.

Function Documentation

◆ operator&()

template<typename E>
requires circus::traits::Flaggable<E>
E operator& ( E lhs,
E rhs )
constexpr

Bitwise AND operator for enum types flagged by circus::traits::Flaggable.

Template Parameters
EEnum type.
Parameters
lhsLeft operand.
rhsRight operand.
Returns
Bitwise AND of lhs and rhs.

◆ operator|()

template<typename E>
requires circus::traits::Flaggable<E>
E operator| ( E lhs,
E rhs )
constexpr

Bitwise OR operator for enum types flagged by circus::traits::Flaggable.

Template Parameters
EEnum type.
Parameters
lhsLeft operand.
rhsRight operand.
Returns
Bitwise OR of lhs and rhs.

◆ operator~()

template<typename E>
requires circus::traits::Flaggable<E>
E operator~ ( E val)
constexpr

Bitwise NOT operator for enum types flagged by circus::traits::Flaggable.

Template Parameters
EEnum type.
Parameters
valOperand.
Returns
Bitwise NOT of val.