liblcf
FlagSet< E, N > Class Template Reference

#include <flag_set.h>

+ Collaboration diagram for FlagSet< E, N >:

Public Types

using underlying = std::bitset< N >
 
using reference = typename underlying::reference
 

Public Member Functions

constexpr FlagSet ()=default
 
 FlagSet (std::initializer_list< E > ilist)
 
constexpr bool operator[] (E tag) const
 
reference operator[] (E tag)
 
size_t count () const
 
bool any () const noexcept
 
bool none () const noexcept
 
size_t size () const
 
FlagSet operator~ () const noexcept
 
FlagSetoperator&= (const FlagSet &o) noexcept
 
FlagSetoperator|= (const FlagSet &o) noexcept
 
FlagSetoperator^= (const FlagSet &o) noexcept
 

Private Attributes

std::bitset< N > _bits = {}
 

Friends

struct std::hash< FlagSet< E, N > >
 
template<typename EE , size_t NN>
bool operator== (const FlagSet< EE, NN > &l, const FlagSet< EE, NN > &r)
 

Detailed Description

template<typename E, size_t N = 32>
class FlagSet< E, N >

Definition at line 16 of file flag_set.h.

Member Typedef Documentation

◆ reference

template<typename E, size_t N = 32>
using FlagSet< E, N >::reference = typename underlying::reference

Definition at line 19 of file flag_set.h.

◆ underlying

template<typename E, size_t N = 32>
using FlagSet< E, N >::underlying = std::bitset<N>

Definition at line 18 of file flag_set.h.

Constructor & Destructor Documentation

◆ FlagSet() [1/2]

template<typename E, size_t N = 32>
constexpr FlagSet< E, N >::FlagSet ( )
default

◆ FlagSet() [2/2]

template<typename E , size_t N>
FlagSet< E, N >::FlagSet ( std::initializer_list< E >  ilist)
inline

Definition at line 78 of file flag_set.h.

Member Function Documentation

◆ any()

template<typename E, size_t N = 32>
bool FlagSet< E, N >::any ( ) const
inlinenoexcept

Definition at line 28 of file flag_set.h.

References FlagSet< E, N >::_bits.

◆ count()

template<typename E, size_t N = 32>
size_t FlagSet< E, N >::count ( ) const
inline

Definition at line 27 of file flag_set.h.

References FlagSet< E, N >::_bits.

◆ none()

template<typename E, size_t N = 32>
bool FlagSet< E, N >::none ( ) const
inlinenoexcept

Definition at line 29 of file flag_set.h.

References FlagSet< E, N >::_bits.

◆ operator&=()

template<typename E, size_t N = 32>
FlagSet& FlagSet< E, N >::operator&= ( const FlagSet< E, N > &  o)
inlinenoexcept

Definition at line 34 of file flag_set.h.

References FlagSet< E, N >::_bits.

◆ operator[]() [1/2]

template<typename E, size_t N = 32>
constexpr bool FlagSet< E, N >::operator[] ( tag) const
inline

Definition at line 24 of file flag_set.h.

References FlagSet< E, N >::_bits.

◆ operator[]() [2/2]

template<typename E, size_t N = 32>
reference FlagSet< E, N >::operator[] ( tag)
inline

Definition at line 25 of file flag_set.h.

References FlagSet< E, N >::_bits.

◆ operator^=()

template<typename E, size_t N = 32>
FlagSet& FlagSet< E, N >::operator^= ( const FlagSet< E, N > &  o)
inlinenoexcept

Definition at line 36 of file flag_set.h.

References FlagSet< E, N >::_bits.

◆ operator|=()

template<typename E, size_t N = 32>
FlagSet& FlagSet< E, N >::operator|= ( const FlagSet< E, N > &  o)
inlinenoexcept

Definition at line 35 of file flag_set.h.

References FlagSet< E, N >::_bits.

◆ operator~()

template<typename E, size_t N = 32>
FlagSet FlagSet< E, N >::operator~ ( ) const
inlinenoexcept

Definition at line 33 of file flag_set.h.

References FlagSet< E, N >::_bits.

◆ size()

template<typename E, size_t N = 32>
size_t FlagSet< E, N >::size ( ) const
inline

Definition at line 31 of file flag_set.h.

References FlagSet< E, N >::_bits.

Friends And Related Function Documentation

◆ operator==

template<typename E, size_t N = 32>
template<typename EE , size_t NN>
bool operator== ( const FlagSet< EE, NN > &  l,
const FlagSet< EE, NN > &  r 
)
friend

◆ std::hash< FlagSet< E, N > >

template<typename E, size_t N = 32>
friend struct std::hash< FlagSet< E, N > >
friend

Definition at line 41 of file flag_set.h.

Member Data Documentation

◆ _bits


The documentation for this class was generated from the following file: