JS8Call-Improved master
Loading...
Searching...
No Matches
pimpl< T > Class Template Reference

Opaque implementation manager utilizing perfect forwarding of constructors. More...

#include <pimpl_h.h>

Public Member Functions

 pimpl ()
 Constructs an instance of the opaque implementation object.
template<typename... Args>
 pimpl (Args &&... args)
 Forwarding constructor that handles dynamic parameter passing.
 ~pimpl ()
 Destroys the managed implementation block.
T * operator-> ()
 Overloaded structure dereference arrow operator for mutable operations.
T const * operator-> () const
 Overloaded structure dereference arrow operator for constant operations.
T & operator* ()
 Overloaded indirection dereference operator for mutable access.
T const & operator* () const
 Overloaded indirection dereference operator for constant access.

Detailed Description

template<typename T>
class pimpl< T >

Opaque implementation manager utilizing perfect forwarding of constructors.

Encapsulates the boilerplate required to separate an interface from its hidden, underlying implementation properties. Avoids cascading compilation unit rebuilds when modifying hidden data structures.

Template Parameters
TThe encapsulated, incomplete internal implementation type (e.g., widget::impl).

Constructor & Destructor Documentation

◆ pimpl() [1/2]

template<typename T>
pimpl< T >::pimpl ( )

Constructs an instance of the opaque implementation object.

Default constructor allocating a default-initialized implementation object.

Default constructor dynamically initializes target internal block context out-of-line.

Template Parameters
TThe encapsulated, now-complete internal implementation type.

◆ pimpl() [2/2]

template<typename T>
template<typename... Args>
pimpl< T >::pimpl ( Args &&... args)

Forwarding constructor that handles dynamic parameter passing.

Variadic forwarding constructor passing all parameters to the implementation object.

Utilizes variadic template arguments to safely perfect-forward initialization properties into the hidden destination instance structure.

Template Parameters
ArgsVariadic parameter packs inferred at compilation runtime.
Parameters
[in,out]argsDeduced universal reference parameters passed to the underlying constructor.

Demonstrates double-template declaration syntax: one for the class template parameters and one for the member function template parameters.

Template Parameters
TThe encapsulated internal implementation type.
ArgsVariadic parameter types inferred at call site.
Parameters
[in,out]argsUniversal reference parameters to forward to T's constructor.

◆ ~pimpl()

template<typename T>
pimpl< T >::~pimpl ( )

Destroys the managed implementation block.

Destructor.

Must be defined out-of-line in an implementation context where type T is complete, otherwise compilation will fail with standard library template restrictions.

Safely deletes the internal opaque instance pointer. Because this definition runs in the implementation context, the full definition of T is available, which avoids compilation errors caused by deleting an incomplete type.

Template Parameters
TThe encapsulated internal implementation type.

Member Function Documentation

◆ operator*() [1/2]

template<typename T>
T & pimpl< T >::operator* ( )

Overloaded indirection dereference operator for mutable access.

Mutable indirection dereference operator.

Returns
A mutable reference to the underlying implementation object.
Template Parameters
TThe encapsulated internal implementation type.
Returns
A mutable reference to the underlying implementation object.

◆ operator*() [2/2]

template<typename T>
T const & pimpl< T >::operator* ( ) const

Overloaded indirection dereference operator for constant access.

Constant indirection dereference operator.

Returns
A constant reference to the underlying implementation object.
Template Parameters
TThe encapsulated internal implementation type.
Returns
A constant reference to the underlying implementation object.

◆ operator->() [1/2]

template<typename T>
T * pimpl< T >::operator-> ( )

Overloaded structure dereference arrow operator for mutable operations.

Mutable structure dereference arrow operator.

Returns
A mutable raw pointer to the underlying implementation class object T.
Template Parameters
TThe encapsulated internal implementation type.
Returns
A mutable raw pointer to the underlying implementation class object.

◆ operator->() [2/2]

template<typename T>
T const * pimpl< T >::operator-> ( ) const

Overloaded structure dereference arrow operator for constant operations.

Constant structure dereference arrow operator.

Returns
A constant raw pointer to the underlying implementation class object T.
Template Parameters
TThe encapsulated internal implementation type.
Returns
A constant raw pointer to the underlying implementation class object.

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