#include <bn_any.h>
template<int MaxSize, int MaxAlignment>
bn::any class

std::any like container with a fixed size buffer.

Template parameters
MaxSize Maximum size in bytes of the managed objects.
MaxAlignment Maximum alignment in bytes of the managed objects.

It doesn't throw exceptions. Instead, asserts are used to ensure valid usage.

Base classes

class iany
Base class of bn::any.

Constructors, destructors, conversion operators

any()
Default constructor.
any(const any& other)
Copy constructor.
any(any&& other) noexcept
Move constructor.
any(const iany& other)
Copy constructor.
any(iany&& other) noexcept
Move constructor.
template<typename Type>
any(const Type& value) explicit
Constructor.
template<typename Type>
any(Type& value) explicit
Constructor.
template<typename Type>
any(Type&& value) explicit
Constructor.

Public functions

auto operator=(const any& other) -> any&
Copy assignment operator.
auto operator=(any&& other) -> any& noexcept
Move assignment operator.
auto operator=(const iany& other) -> any&
Copy assignment operator.
auto operator=(iany&& other) -> any& noexcept
Move assignment operator.
template<typename Type>
auto operator=(const Type& value) -> any&
Assignment operator.
template<typename Type>
auto operator=(Type& value) -> any&
Assignment operator.
template<typename Type>
auto operator=(Type&& value) -> any&
Assignment operator.
template<typename Type, typename... Args>
auto emplace(Args && ... args) -> Type&
Constructs the contained value in-place.

Function documentation

template<int MaxSize, int MaxAlignment>
bn::any<MaxSize, MaxAlignment>::any(const any& other)

Copy constructor.

Parameters
other any to copy.

template<int MaxSize, int MaxAlignment>
bn::any<MaxSize, MaxAlignment>::any(any&& other) noexcept

Move constructor.

Parameters
other any to move.

template<int MaxSize, int MaxAlignment>
bn::any<MaxSize, MaxAlignment>::any(const iany& other)

Copy constructor.

Parameters
other iany to copy.

template<int MaxSize, int MaxAlignment>
bn::any<MaxSize, MaxAlignment>::any(iany&& other) noexcept

Move constructor.

Parameters
other iany to move.

template<int MaxSize, int MaxAlignment> template<typename Type>
bn::any<MaxSize, MaxAlignment>::any(const Type& value) explicit

Constructor.

Parameters
value Constant value to copy.

template<int MaxSize, int MaxAlignment> template<typename Type>
bn::any<MaxSize, MaxAlignment>::any(Type& value) explicit

Constructor.

Parameters
value Non constant value to copy.

template<int MaxSize, int MaxAlignment> template<typename Type>
bn::any<MaxSize, MaxAlignment>::any(Type&& value) explicit

Constructor.

Parameters
value Value to move.

template<int MaxSize, int MaxAlignment>
any& bn::any<MaxSize, MaxAlignment>::operator=(const any& other)

Copy assignment operator.

Parameters
other any to copy.
Returns Reference to this.

template<int MaxSize, int MaxAlignment>
any& bn::any<MaxSize, MaxAlignment>::operator=(any&& other) noexcept

Move assignment operator.

Parameters
other any to move.
Returns Reference to this.

template<int MaxSize, int MaxAlignment>
any& bn::any<MaxSize, MaxAlignment>::operator=(const iany& other)

Copy assignment operator.

Parameters
other iany to copy.
Returns Reference to this.

template<int MaxSize, int MaxAlignment>
any& bn::any<MaxSize, MaxAlignment>::operator=(iany&& other) noexcept

Move assignment operator.

Parameters
other iany to move.
Returns Reference to this.

template<int MaxSize, int MaxAlignment> template<typename Type>
any& bn::any<MaxSize, MaxAlignment>::operator=(const Type& value)

Assignment operator.

Parameters
value Constant value to copy.
Returns Reference to this.

template<int MaxSize, int MaxAlignment> template<typename Type>
any& bn::any<MaxSize, MaxAlignment>::operator=(Type& value)

Assignment operator.

Parameters
value Non constant value to copy.
Returns Reference to this.

template<int MaxSize, int MaxAlignment> template<typename Type>
any& bn::any<MaxSize, MaxAlignment>::operator=(Type&& value)

Assignment operator.

Parameters
value Value to move.
Returns Reference to this.

template<int MaxSize, int MaxAlignment> template<typename Type, typename... Args>
Type& bn::any<MaxSize, MaxAlignment>::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.