4.4.1
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
fcppt::container::bitfield Namespace Reference

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

Classes

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 = fcppt::array::object< InternalType, fcppt::math::ceil_div_static< std::size_t, fcppt::cast::size< std::size_t >(NumElements::value), fcppt::container::bitfield::detail::element_bits< std::size_t, InternalType >::value >::value >
 Meta function to retrieve the internal storage type used by fcppt::container::bitfield::object.
 
using default_internal_type = unsigned
 The default (unsigned) type to hold the bitfield's bits.
 
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, InternalTypeoperator~ (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, InternalTypeoperator| (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, InternalTypeoperator| (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, InternalTypeoperator& (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, InternalTypeoperator^ (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 , typename = std::enable_if_t< 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

◆ default_internal_type

The default (unsigned) type to hold the bitfield's bits.

See also
fcppt::container::bitfield::array

◆ value_type

The type denoting a single bit.

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

Function Documentation

◆ is_subset_eq()

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

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