4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::container::bitfield Namespace Reference

Contains fcppt::container::bitfield::object and helper types/functions for it. More...

Classes

struct  default_internal_type
 Tells a bitfield to choose an internal type. More...
 
struct  hash
 A hash function for bitfields. More...
 
class  object
 A statically sized bitfield. More...
 
class  proxy
 The proxy class referencing a single bit in a bitfield. More...
 

Typedefs

template<typename NumElements , typename InternalType >
using array
 Meta function to retrieve the internal storage type used by fcppt::container::bitfield::object.
 
using value_type = bool
 The type denoting a single bit.
 

Functions

template<typename ElementType , typename InternalType >
bool operator== (fcppt::container::bitfield::object< ElementType, InternalType > const &_left, fcppt::container::bitfield::object< ElementType, InternalType > const &_right)
 Compares two bitfields for equality.
 
template<typename ElementType , typename InternalType >
bool operator!= (fcppt::container::bitfield::object< ElementType, InternalType > const &_left, fcppt::container::bitfield::object< ElementType, InternalType > const &_right)
 Compares two bitfields for inequality.
 
template<typename Result , typename Function >
Result init (Function const &_function)
 Initialize a bitfield using a function.
 
template<typename ElementType , typename InternalType >
bool is_subset_eq (fcppt::container::bitfield::object< ElementType, InternalType > const &_left, fcppt::container::bitfield::object< ElementType, InternalType > const &_right)
 Checks if one bitfield has all the bits of another bitfield set.
 
template<typename ElementType , typename InternalType >
fcppt::container::bitfield::object< ElementType, InternalType > & operator|= (fcppt::container::bitfield::object< ElementType, InternalType > &_left, ElementType const _index)
 Set a bit to true.
 
template<typename ElementType , typename InternalType >
fcppt::container::bitfield::object< ElementType, InternalType > & operator|= (fcppt::container::bitfield::object< ElementType, InternalType > &_left, fcppt::container::bitfield::object< ElementType, InternalType > const &_right)
 Do a bit-wise "or" for all bits.
 
template<typename ElementType , typename InternalType >
fcppt::container::bitfield::object< ElementType, InternalType > & operator&= (fcppt::container::bitfield::object< ElementType, InternalType > &_left, fcppt::container::bitfield::object< ElementType, InternalType > const &_right)
 Do a bit-wise "and" for all bits.
 
template<typename ElementType , typename InternalType >
fcppt::container::bitfield::object< ElementType, InternalType > & operator^= (fcppt::container::bitfield::object< ElementType, InternalType > &_left, fcppt::container::bitfield::object< ElementType, InternalType > const &_right)
 Do a bit-wise "xor" for all bits.
 
template<typename ElementType , typename InternalType >
fcppt::container::bitfield::object< ElementType, InternalType > operator~ (fcppt::container::bitfield::object< ElementType, InternalType > _field)
 Do a bit-wise "not" for all bits (inverts all bits).
 
template<typename ElementType , typename InternalType >
fcppt::container::bitfield::value_type operator& (fcppt::container::bitfield::object< ElementType, InternalType > const &_field, ElementType const _index)
 Checks if the specified bit is set.
 
template<typename ElementType , typename InternalType >
fcppt::container::bitfield::object< ElementType, InternalType > operator| (fcppt::container::bitfield::object< ElementType, InternalType > _field, ElementType const _index)
 Set the specified bit to true.
 
template<typename ElementType , typename InternalType >
fcppt::container::bitfield::object< ElementType, InternalType > operator| (fcppt::container::bitfield::object< ElementType, InternalType > _left, fcppt::container::bitfield::object< ElementType, InternalType > const &_right)
 Do a bit-wise "or" for all bits.
 
template<typename ElementType , typename InternalType >
fcppt::container::bitfield::object< ElementType, InternalType > operator& (fcppt::container::bitfield::object< ElementType, InternalType > _left, fcppt::container::bitfield::object< ElementType, InternalType > const &_right)
 Do a bit-wise "and" for all bits.
 
template<typename ElementType , typename InternalType >
fcppt::container::bitfield::object< ElementType, InternalType > operator^ (fcppt::container::bitfield::object< ElementType, InternalType > _left, fcppt::container::bitfield::object< ElementType, InternalType > const &_right)
 Do a bit-wise "xor" for all bits.
 
template<typename Ch , typename Traits , typename ElementType , typename InternalType >
std::basic_ostream< Ch, Traits > & operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::container::bitfield::object< ElementType, InternalType > const &_bitfield)
 Outputs a bitfield.
 
template<typename ElementType , typename InternalType >
requires (fcppt::container::bitfield::object<ElementType, InternalType>::array_size::value == 1U)
fcppt::container::bitfield::object< ElementType, InternalType >::internal_type underlying_value (fcppt::container::bitfield::object< ElementType, InternalType > const &_bitfield)
 Returns the underlying value of a bitfield.
 

Detailed Description

Contains fcppt::container::bitfield::object and helper types/functions for it.

Typedef Documentation

◆ value_type

The type denoting a single bit.

This is currently a boolean, but might be subject to change.

Function Documentation

◆ is_subset_eq()

template<typename ElementType , typename InternalType >
bool fcppt::container::bitfield::is_subset_eq ( fcppt::container::bitfield::object< ElementType, InternalType > const & _left,
fcppt::container::bitfield::object< ElementType, InternalType > const & _right )

Checks if one bitfield has all the bits of another bitfield set.

Checks if all bits set in _left are also set in _right.