4.4.1
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions
fcppt::container::bitfield::object< ElementType, InternalType > Class Template Reference

Detailed Description

template<typename ElementType, typename InternalType>
class fcppt::container::bitfield::object< ElementType, InternalType >

A statically sized bitfield.

Template Parameters
ElementTypeAn enumeration type.
InternalTypeThe internal storage type. Must be unsigned. This is fcppt::container::bitfield::default_internal_type by default.

See fcppt.container.bitfield for more information.

Public Types

using element_type = ElementType
 Typedef to ElementType.
 
using internal_type = InternalType
 Typedef to the internal storage type (template parameter InternalType
 
using static_size = fcppt::enum_::size< element_type >
 The number of elements.
 
using array_type = fcppt::container::bitfield::array< static_size, internal_type >
 The internal array type.
 
using array_size = fcppt::array::size< array_type >
 The size of the underlying array.
 
using size_type = typename static_size::value_type
 The size type which is taken from static_size.
 
using value_type = fcppt::container::bitfield::value_type
 The value type, which is bool.
 
using reference = fcppt::container::bitfield::proxy< array_type >
 A type denoting a reference to a mask value (a reference to a boolean, basically).
 
using const_reference = fcppt::container::bitfield::proxy< array_type const >
 A type denoting a const reference to a mask value (a reference to a boolean, basically).
 
using initializer_list_type = std::initializer_list< ElementType >
 Initializer list type used to initialize a bitfield.
 

Public Member Functions

 object (fcppt::no_init const &)
 Constructs an uninitialized bitfield.
 
 object (initializer_list_type const &)
 Constructs a bitfield using an initializer list, setting every bit from the list to true.
 
 object (array_type const &)
 Constructs a bitfield from its internal array type.
 
const_reference operator[] (ElementType) const
 Returns a const reference to the specified bit.
 
reference operator[] (ElementType)
 Returns a reference to the specified bit.
 
void set (ElementType where, value_type value)
 Sets the specified bit to true/false.
 
value_type get (ElementType) const
 Returns if the specified bit is set.
 
array_typearray ()
 Accessor to the internal array.
 
array_type constarray () const
 Const accessor to the internal array.
 

Static Public Member Functions

static object null ()
 Returns the bitfield with all bits set to zero.
 

Member Typedef Documentation

◆ array_size

The size of the underlying array.

◆ array_type

The internal array type.

◆ const_reference

A type denoting a const reference to a mask value (a reference to a boolean, basically).

Note that this is not a bool nor an internal_type, but a proxy class.

◆ element_type

Typedef to ElementType.

◆ initializer_list_type

using fcppt::container::bitfield::object< ElementType, InternalType >::initializer_list_type = std::initializer_list<ElementType>

Initializer list type used to initialize a bitfield.

◆ internal_type

Typedef to the internal storage type (template parameter InternalType

◆ reference

A type denoting a reference to a mask value (a reference to a boolean, basically).

Note that this is not a bool nor an internal_type, but a proxy class.

◆ size_type

The size type which is taken from static_size.

◆ static_size

The number of elements.

◆ value_type

The value type, which is bool.

Constructor & Destructor Documentation

◆ object() [1/3]

Constructs an uninitialized bitfield.

◆ object() [2/3]

Constructs a bitfield using an initializer list, setting every bit from the list to true.

◆ object() [3/3]

Constructs a bitfield from its internal array type.

Member Function Documentation

◆ array() [1/2]

Accessor to the internal array.

◆ array() [2/2]

Const accessor to the internal array.

◆ get()

Returns if the specified bit is set.

◆ null()

Returns the bitfield with all bits set to zero.

◆ operator[]() [1/2]

Returns a reference to the specified bit.

◆ operator[]() [2/2]

Returns a const reference to the specified bit.

◆ set()

Sets the specified bit to true/false.

Parameters
whereWhich bit to set.
valueThe value to set the bit to.