xentara-utils v2.0.3
The Xentara Utility Library
Loading...
Searching...
No Matches
xentara::utils::memory::Embedded< Object > Class Template Referencefinal

A container that contains exactly one object. More...

#include <xentara/utils/memory/Embedded.hpp>

Public Member Functions

Construction
 Embedded () noexcept(std::is_nothrow_constructible_v< Object >)
 Default Constructor. Constructs a default-constructed object.
 
 Embedded (const Embedded &rhs) noexcept(std::is_nothrow_constructible_v< Object, const Object & >)
 Copy Constructor.
 
 Embedded (Embedded &&rhs) noexcept(std::is_nothrow_constructible_v< Object, Object && >)
 Move Constructor.
 
template<typename RelatedObject >
requires std::is_constructible_v<Object, const RelatedObject &> && (!std::is_same_v<RelatedObject, Object>)
 Embedded (const Embedded< RelatedObject > &relatedObject) noexcept(std::is_nothrow_constructible_v< Object, const RelatedObject & >)
 Copy constructor for a related embedded object.
 
template<typename RelatedObject >
requires std::is_constructible_v<Object, RelatedObject &&> && (!std::is_same_v<RelatedObject, Object>)
 Embedded (Embedded< RelatedObject > &&relatedObject) noexcept(std::is_nothrow_constructible_v< Object, RelatedObject && >)
 Move constructor for a related embedded object.
 
 Embedded (const Object &object) noexcept(std::is_nothrow_constructible_v< Object >)
 Constructor that copies an existing object.
 
 Embedded (Object &&object) noexcept(std::is_nothrow_constructible_v< Object, Object && >)
 Constructor that moves an existing object.
 
template<typename Initializer >
requires std::is_constructible_v<Object, Initializer &&> && (!std::is_same_v<std::remove_cvref_t<Initializer>, std::in_place_t>) && (!std::is_same_v<std::remove_cvref_t<Initializer>, Embedded<Object>>)
 Embedded (Initializer &&initializer) noexcept(std::is_nothrow_constructible_v< Object, Initializer && >)
 Constructor that constructs an object from an initializer.
 
template<typename Argument1 , typename Argument2 , typename... MoreArguments>
requires std::is_constructible_v<Object, Argument1 &&, Argument2 &&, MoreArguments &&...> && (!std::is_same_v<std::remove_cvref_t<Argument1>, std::in_place_t>)
 Embedded (Argument1 &&argument1, Argument2 &&argument2, MoreArguments &&... moreArguments) noexcept(std::is_nothrow_constructible_v< Object, Argument1 &&, Argument2 &&, MoreArguments &&... >)
 Constructor that constructs an object from two or more arguments.
 
template<typename... Arguments>
requires std::is_constructible_v<Object, Arguments...>
 Embedded (std::in_place_t, Arguments &&... arguments) noexcept(std::is_nothrow_constructible_v< Object, Arguments &&... >)
 In-place constructor.
 
Assignment
auto operator= (const Embedded &rhs) noexcept(std::is_nothrow_assignable_v< Object, const Object & >) -> Embedded &
 Assignment operator.
 
auto operator= (Embedded &&rhs) noexcept(std::is_nothrow_assignable_v< Object, const Object & >) -> Embedded &
 Move assignment operator.
 
template<typename RelatedObject >
requires std::is_assignable_v<Object, const RelatedObject &> && (!std::is_same_v<RelatedObject, Object>)
auto operator= (const Embedded< RelatedObject > &relatedObject) noexcept(std::is_nothrow_constructible_v< Object, const RelatedObject & >) -> Embedded &
 Assignment operator for a related embedded object.
 
template<typename RelatedObject >
requires std::is_assignable_v<Object, RelatedObject &&> && (!std::is_same_v<RelatedObject, Object>)
auto operator= (Embedded< RelatedObject > &&relatedObject) noexcept(std::is_nothrow_assignable_v< Object, RelatedObject && > &&std::is_nothrow_constructible_v< Object, RelatedObject && >) -> Embedded &
 Move assignment operator for a related embedded object.
 
auto operator= (const Object &rhs) noexcept(std::is_nothrow_assignable_v< Object, const Object & >) -> Embedded &
 Assignment operator that copies an existing object.
 
auto operator= (Object &&rhs) noexcept(std::is_nothrow_assignable_v< Object, const Object & >) -> Embedded &
 Assignment operator that moves an existing object.
 
template<typename Value >
requires std::is_assignable_v<Object, Value &&> && (!std::is_same_v<std::remove_cvref_t<Value>, Embedded<Object>>)
auto operator= (Value &&value) noexcept(std::is_nothrow_assignable_v< Object, Value && >) -> Embedded &
 Assignment operator for an arbitrary value.
 
Access to the Object
constexpr auto get () const noexcept -> const Object &
 Gets the object.
 
constexpr auto get () noexcept -> Object &
 Gets the object.
 
constexpr auto operator* () const noexcept -> const Object &
 Indirection operator.
 
constexpr auto operator* () noexcept -> Object &
 Indirection operator.
 
constexpr auto operator-> () const noexcept -> const Object *
 Member access operator.
 
constexpr auto operator-> () noexcept -> Object *
 Member access operator.
 
template<typename RelatedObject >
requires std::is_swappable_with_v<Object, RelatedObject>
auto swap (Embedded< RelatedObject > &other) noexcept(std::is_nothrow_swappable_with_v< Object, RelatedObject >) -> void
 Swaps two empedded objects.
 

Related Symbols

(Note that these are not member symbols.)

template<typename LeftObject , typename RightObject >
auto swap (Embedded< LeftObject > &left, Embedded< RightObject > &right) noexcept(std::is_nothrow_swappable_with_v< LeftObject, RightObject >) -> void
 Swaps two empedded objects

 

Detailed Description

template<typename Object>
class xentara::utils::memory::Embedded< Object >

A container that contains exactly one object.

Constructor & Destructor Documentation

◆ Embedded() [1/10]

template<typename Object >
xentara::utils::memory::Embedded< Object >::Embedded ( )
noexcept

Default Constructor. Constructs a default-constructed object.

◆ Embedded() [2/10]

template<typename Object >
xentara::utils::memory::Embedded< Object >::Embedded ( const Embedded< Object > &  rhs)
noexcept

Copy Constructor.

◆ Embedded() [3/10]

template<typename Object >
xentara::utils::memory::Embedded< Object >::Embedded ( Embedded< Object > &&  rhs)
noexcept

Move Constructor.

◆ Embedded() [4/10]

template<typename Object >
template<typename RelatedObject >
requires std::is_constructible_v<Object, const RelatedObject &> && (!std::is_same_v<RelatedObject, Object>)
xentara::utils::memory::Embedded< Object >::Embedded ( const Embedded< RelatedObject > &  relatedObject)
noexcept

Copy constructor for a related embedded object.

◆ Embedded() [5/10]

template<typename Object >
template<typename RelatedObject >
requires std::is_constructible_v<Object, RelatedObject &&> && (!std::is_same_v<RelatedObject, Object>)
xentara::utils::memory::Embedded< Object >::Embedded ( Embedded< RelatedObject > &&  relatedObject)
noexcept

Move constructor for a related embedded object.

◆ Embedded() [6/10]

template<typename Object >
xentara::utils::memory::Embedded< Object >::Embedded ( const Object &  object)
noexcept

Constructor that copies an existing object.

◆ Embedded() [7/10]

template<typename Object >
xentara::utils::memory::Embedded< Object >::Embedded ( Object &&  object)
noexcept

Constructor that moves an existing object.

◆ Embedded() [8/10]

template<typename Object >
template<typename Initializer >
requires std::is_constructible_v<Object, Initializer &&> && (!std::is_same_v<std::remove_cvref_t<Initializer>, std::in_place_t>) && (!std::is_same_v<std::remove_cvref_t<Initializer>, Embedded<Object>>)
xentara::utils::memory::Embedded< Object >::Embedded ( Initializer &&  initializer)
noexcept

Constructor that constructs an object from an initializer.

Note
You cannot use this constructor to initialize the object with an object of type std::in_place_t. Use the in place constructor instead.
Parameters
initializerThe object to initialize the object with.

◆ Embedded() [9/10]

template<typename Object >
template<typename Argument1 , typename Argument2 , typename... MoreArguments>
requires std::is_constructible_v<Object, Argument1 &&, Argument2 &&, MoreArguments &&...> && (!std::is_same_v<std::remove_cvref_t<Argument1>, std::in_place_t>)
xentara::utils::memory::Embedded< Object >::Embedded ( Argument1 &&  argument1,
Argument2 &&  argument2,
MoreArguments &&...  moreArguments 
)
noexcept

Constructor that constructs an object from two or more arguments.

Note
If the first argument is of type std::in_place_t, the in place constructor will be called instead. If you need to initialize an object with an argument list that start with std::in_place, you must specify std::in_place twice.
Parameters
argument1The first argument to pass to the object's constructor.
argument2The first argument to pass to the object's constructor.
moreArgumentsThe remaining arguments to pass to the object's constructor, if any.

◆ Embedded() [10/10]

template<typename Object >
template<typename... Arguments>
requires std::is_constructible_v<Object, Arguments...>
xentara::utils::memory::Embedded< Object >::Embedded ( std::in_place_t  ,
Arguments &&...  arguments 
)
noexcept

In-place constructor.

This constructor constructs an object from a list of arguments.

Parameters
argumentsThe arguments to pass to the object's constructor.

Member Function Documentation

◆ get() [1/2]

template<typename Object >
constexpr auto xentara::utils::memory::Embedded< Object >::get ( ) const -> const Object &
constexprnoexcept

Gets the object.

◆ get() [2/2]

template<typename Object >
constexpr auto xentara::utils::memory::Embedded< Object >::get ( ) -> Object &
constexprnoexcept

Gets the object.

◆ operator*() [1/2]

template<typename Object >
constexpr auto xentara::utils::memory::Embedded< Object >::operator* ( ) const -> const Object &
constexprnoexcept

Indirection operator.

◆ operator*() [2/2]

template<typename Object >
constexpr auto xentara::utils::memory::Embedded< Object >::operator* ( ) -> Object &
constexprnoexcept

Indirection operator.

◆ operator->() [1/2]

template<typename Object >
constexpr auto xentara::utils::memory::Embedded< Object >::operator-> ( ) const -> const Object *
constexprnoexcept

Member access operator.

◆ operator->() [2/2]

template<typename Object >
constexpr auto xentara::utils::memory::Embedded< Object >::operator-> ( ) -> Object *
constexprnoexcept

Member access operator.

◆ operator=() [1/7]

template<typename Object >
auto xentara::utils::memory::Embedded< Object >::operator= ( const Embedded< Object > &  rhs) -> Embedded&
noexcept

Assignment operator.

◆ operator=() [2/7]

template<typename Object >
template<typename RelatedObject >
requires std::is_assignable_v<Object, const RelatedObject &> && (!std::is_same_v<RelatedObject, Object>)
auto xentara::utils::memory::Embedded< Object >::operator= ( const Embedded< RelatedObject > &  relatedObject) -> Embedded &
noexcept

Assignment operator for a related embedded object.

◆ operator=() [3/7]

template<typename Object >
auto xentara::utils::memory::Embedded< Object >::operator= ( const Object &  rhs) -> Embedded&
noexcept

Assignment operator that copies an existing object.

◆ operator=() [4/7]

template<typename Object >
auto xentara::utils::memory::Embedded< Object >::operator= ( Embedded< Object > &&  rhs) -> Embedded&
noexcept

Move assignment operator.

◆ operator=() [5/7]

template<typename Object >
template<typename RelatedObject >
requires std::is_assignable_v<Object, RelatedObject &&> && (!std::is_same_v<RelatedObject, Object>)
auto xentara::utils::memory::Embedded< Object >::operator= ( Embedded< RelatedObject > &&  relatedObject) -> Embedded &
noexcept

Move assignment operator for a related embedded object.

◆ operator=() [6/7]

template<typename Object >
auto xentara::utils::memory::Embedded< Object >::operator= ( Object &&  rhs) -> Embedded&
noexcept

Assignment operator that moves an existing object.

◆ operator=() [7/7]

template<typename Object >
template<typename Value >
requires std::is_assignable_v<Object, Value &&> && (!std::is_same_v<std::remove_cvref_t<Value>, Embedded<Object>>)
auto xentara::utils::memory::Embedded< Object >::operator= ( Value &&  value) -> Embedded &
noexcept

Assignment operator for an arbitrary value.

◆ swap()

template<typename Object >
template<typename RelatedObject >
requires std::is_swappable_with_v<Object, RelatedObject>
auto xentara::utils::memory::Embedded< Object >::swap ( Embedded< RelatedObject > &  other) -> void
noexcept

Swaps two empedded objects.

Friends And Related Symbol Documentation

◆ swap()

template<typename LeftObject , typename RightObject >
auto swap ( Embedded< LeftObject > &  left,
Embedded< RightObject > &  right 
) -> void
related

Swaps two empedded objects