StormByte-Multimedia 3.3.2
C++26 multimedia processing module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Multimedia::ContainerRef Class Reference

Trivial borrowed container handle; never owns or deletes the container. More...

#include <StormByte/multimedia/typedefs.hxx>

Public Member Functions

constexpr ContainerRef () noexcept=default
 Constructs an empty handle.
constexpr ContainerRef (const Container &container) noexcept
 Borrows a container.
constexpr ContainerRef (const ContainerRef &other) noexcept=default
 Copies the borrowed pointer.
constexpr ContainerRef (ContainerRef &&other) noexcept=default
 Copies the borrowed pointer without clearing the source.
 ~ContainerRef () noexcept=default
 Destroys the handle, not its container.
constexpr ContainerRef & operator= (const ContainerRef &other) noexcept=default
 Copies the borrowed pointer.
constexpr ContainerRef & operator= (ContainerRef &&other) noexcept=default
 Copies the borrowed pointer without clearing the source.
constexpr operator bool () const noexcept
 Tests whether a container is borrowed.
constexpr const Container & get () const noexcept
 Gets the borrowed container, preserving reference_wrapper syntax.
constexpr operator const Container & () const noexcept
 Converts to the borrowed container reference.

Detailed Description

Trivial borrowed container handle; never owns or deletes the container.

Note
The container must outlive every handle. Registry handles are valid until registry teardown, with the provider loaded and a compatible compiler, standard-library ABI and provider layout. Empty handles cannot be dereferenced.

Constructor & Destructor Documentation

◆ ContainerRef() [1/4]

StormByte::Multimedia::ContainerRef::ContainerRef ( )
constexprdefaultnoexcept

Constructs an empty handle.

◆ ContainerRef() [2/4]

StormByte::Multimedia::ContainerRef::ContainerRef ( const Container & container)
inlineconstexprnoexcept

Borrows a container.

Parameters
containerContainer that must outlive the handle.

◆ ContainerRef() [3/4]

StormByte::Multimedia::ContainerRef::ContainerRef ( const ContainerRef & other)
constexprdefaultnoexcept

Copies the borrowed pointer.

Parameters
otherSource handle.

◆ ContainerRef() [4/4]

StormByte::Multimedia::ContainerRef::ContainerRef ( ContainerRef && other)
constexprdefaultnoexcept

Copies the borrowed pointer without clearing the source.

Parameters
otherSource handle.

◆ ~ContainerRef()

StormByte::Multimedia::ContainerRef::~ContainerRef ( )
defaultnoexcept

Destroys the handle, not its container.

Member Function Documentation

◆ get()

const Container & StormByte::Multimedia::ContainerRef::get ( ) const
inlineconstexprnoexcept

Gets the borrowed container, preserving reference_wrapper syntax.

Precondition
The handle is nonempty and its container is alive.
Returns
Borrowed container.

◆ operator bool()

StormByte::Multimedia::ContainerRef::operator bool ( ) const
inlineexplicitconstexprnoexcept

Tests whether a container is borrowed.

Returns
True for a nonempty handle.

◆ operator const Container &()

StormByte::Multimedia::ContainerRef::operator const Container & ( ) const
inlineconstexprnoexcept

Converts to the borrowed container reference.

Precondition
The handle is nonempty and its container is alive.
Returns
Borrowed container.

◆ operator=() [1/2]

ContainerRef & StormByte::Multimedia::ContainerRef::operator= ( const ContainerRef & other)
constexprdefaultnoexcept

Copies the borrowed pointer.

Parameters
otherSource handle.
Returns
This handle.

◆ operator=() [2/2]

ContainerRef & StormByte::Multimedia::ContainerRef::operator= ( ContainerRef && other)
constexprdefaultnoexcept

Copies the borrowed pointer without clearing the source.

Parameters
otherSource handle.
Returns
This handle.

The documentation for this class was generated from the following file: