LiteFX 0.4.1.2025
Computer Graphics Engine
Loading...
Searching...
No Matches
LiteFX::PimplPtr< pImpl > Class Template Referencefinal

A smart pointer that manages an implementation instance for a public interface class. More...

#include <containers.hpp>

Public Member Functions

constexpr PimplPtr ()
 Initializes a new pointer to an implementation instance.
 
template<typename... TArgs>
constexpr PimplPtr (TArgs &&... args)
 Initializes a new pointer of an implementation.
 
constexpr PimplPtr (const PimplPtr &src)
 Initializes a new pointer to a copy of the implementation instance managed by src .
 
constexpr PimplPtr (PimplPtr &&src) noexcept=default
 Initializes a new pointer by taking over the implementation instance managed by src .
 
constexpr PimplPtroperator= (const PimplPtr &src)
 Initializes a new pointer to a copy of the implementation instance managed by src .
 
constexpr PimplPtroperator= (PimplPtr &&src) noexcept=default
 Initializes a new pointer by taking over the implementation instance managed by src .
 
constexpr ~PimplPtr () noexcept=default
 
constexpr pImpl & operator* () const noexcept
 Returns a reference to the managed implementation instance.
 
constexpr pImpl * operator-> () const noexcept
 Returns a pointer to the managed implementation instance.
 

Detailed Description

template<class pImpl>
class LiteFX::PimplPtr< pImpl >

A smart pointer that manages an implementation instance for a public interface class.

Template Parameters
pImplThe type of the implementation class.

Constructor & Destructor Documentation

◆ PimplPtr() [1/4]

template<class pImpl >
LiteFX::PimplPtr< pImpl >::PimplPtr ( )
inlineconstexpr

Initializes a new pointer to an implementation instance.

◆ PimplPtr() [2/4]

template<class pImpl >
template<typename... TArgs>
LiteFX::PimplPtr< pImpl >::PimplPtr ( TArgs &&... args)
inlineconstexpr

Initializes a new pointer of an implementation.

Template Parameters
...TArgsThe types of the arguments passed to the implementation constructor.
Parameters
...argsThe arguments passed to the implementation constructor.

◆ PimplPtr() [3/4]

template<class pImpl >
LiteFX::PimplPtr< pImpl >::PimplPtr ( const PimplPtr< pImpl > & src)
inlineconstexpr

Initializes a new pointer to a copy of the implementation instance managed by src .

Parameters
srcThe source pointer to copy the implementation instance from.

◆ PimplPtr() [4/4]

template<class pImpl >
LiteFX::PimplPtr< pImpl >::PimplPtr ( PimplPtr< pImpl > && src)
constexprdefaultnoexcept

Initializes a new pointer by taking over the implementation instance managed by src .

Parameters
srcThe source pointer to take over.

◆ ~PimplPtr()

template<class pImpl >
LiteFX::PimplPtr< pImpl >::~PimplPtr ( )
constexprdefaultnoexcept

Member Function Documentation

◆ operator*()

template<class pImpl >
pImpl & LiteFX::PimplPtr< pImpl >::operator* ( ) const
inlineconstexprnoexcept

Returns a reference to the managed implementation instance.

Returns
A reference to the managed implementation instance.

◆ operator->()

template<class pImpl >
pImpl * LiteFX::PimplPtr< pImpl >::operator-> ( ) const
inlineconstexprnoexcept

Returns a pointer to the managed implementation instance.

Returns
A pointer to the managed implementation instance.

◆ operator=() [1/2]

template<class pImpl >
PimplPtr & LiteFX::PimplPtr< pImpl >::operator= ( const PimplPtr< pImpl > & src)
inlineconstexpr

Initializes a new pointer to a copy of the implementation instance managed by src .

Note that this will share ownership between this instance and src . Only use this method, if you release either of both implementation pointers manually!

Parameters
srcThe source pointer to copy the implementation instance from.
Returns
A new pointer to the provided implementation instance.

◆ operator=() [2/2]

template<class pImpl >
PimplPtr & LiteFX::PimplPtr< pImpl >::operator= ( PimplPtr< pImpl > && src)
constexprdefaultnoexcept

Initializes a new pointer by taking over the implementation instance managed by src .

Parameters
srcThe source pointer to take over.
Returns
A new pointer to the provided implementation instance.