bn::iany class
#include <bn_any.h>

Base class of bn::any.

Can be used as a reference type for all bn::any containers.

Derived classes

template<int MaxSize, int MaxAlignment = alignof(int)>
class any
std::any like container with a fixed size buffer.

Constructors, destructors, conversion operators

~iany() noexcept
Destructor.
operator bool() const explicit
Indicates if it contains a value or not.

Public functions

auto operator=(const iany& other) -> iany&
Copy assignment operator.
auto operator=(iany&& other) -> iany& noexcept
Move assignment operator.
template<typename Type>
auto operator=(const Type& value) -> iany&
Constructor.
template<typename Type>
auto operator=(Type& value) -> iany&
Constructor.
template<typename Type>
auto operator=(Type&& value) -> iany& noexcept
Constructor.
auto has_value() const -> bool
Indicates if it contains a value or not.
auto type() const -> type_id_t
Returns the type_id_t of the contained value if any, otherwise type_id_t().
auto max_size() const -> int
Returns the maximum size in bytes of the managed objects.
auto max_alignment() const -> int
Returns the maximum alignment in bytes of the managed objects.
template<typename Type>
auto value() const -> const Type&
Returns a const reference to the contained value.
template<typename Type>
auto value() -> Type&
Returns a reference to the contained value.
template<typename Type>
auto value_or(const Type& default_value) const -> Type
Returns a copy of the contained value if this iany has one; otherwise it returns a copy of the given default value.
template<typename Type>
auto value_or(Type&& default_value) const -> Type
Returns a copy of the contained value if this iany has one; otherwise it returns a moved copy of the given default value.
template<typename Type, typename... Args>
auto emplace(Args && ... args) -> Type&
Constructs the contained value in-place.
void reset()
Disposes the contained value.
void swap(iany& other)
Exchanges the contents of this iany with those of the other one.

Friends

void swap(iany& a, iany& b)
Exchanges the contents of a iany with those of another one.

Function documentation

iany& bn::iany::operator=(const iany& other)

Copy assignment operator.

Parameters
other iany to copy.
Returns Reference to this.

iany& bn::iany::operator=(iany&& other) noexcept

Move assignment operator.

Parameters
other iany to move.
Returns Reference to this.

template<typename Type>
iany& bn::iany::operator=(const Type& value)

Constructor.

Parameters
value Constant value to copy.

template<typename Type>
iany& bn::iany::operator=(Type& value)

Constructor.

Parameters
value Non constant value to copy.

template<typename Type>
iany& bn::iany::operator=(Type&& value) noexcept

Constructor.

Parameters
value Value to move.

template<typename Type>
const Type& bn::iany::value() const

Returns a const reference to the contained value.

Template parameters
Type Type of the contained value.

template<typename Type>
Type& bn::iany::value()

Returns a reference to the contained value.

Template parameters
Type Type of the contained value.

template<typename Type>
Type bn::iany::value_or(const Type& default_value) const

Returns a copy of the contained value if this iany has one; otherwise it returns a copy of the given default value.

Template parameters
Type Type of the contained value.

template<typename Type>
Type bn::iany::value_or(Type&& default_value) const

Returns a copy of the contained value if this iany has one; otherwise it returns a moved copy of the given default value.

Template parameters
Type Type of the contained value.

template<typename Type, typename... Args>
Type& bn::iany::emplace(Args && ... args)

Constructs the contained value in-place.

Template parameters
Type Type of the value to construct.
Args Types of the parameters of the value to construct.
Parameters
args Parameters of the value to construct.
Returns Reference to the constructed value.

void bn::iany::swap(iany& other)

Exchanges the contents of this iany with those of the other one.

Parameters
other iany to exchange the contents with.

void swap(iany& a, iany& b)

Exchanges the contents of a iany with those of another one.

Parameters
a First iany to exchange the contents with.
b Second iany to exchange the contents with.