Loading...
Searching...
No Matches
TfAnyUniquePtr Class Reference

A simple type-erased container that provides only destruction, moves and immutable, untyped access to the held value. More...

#include <anyUniquePtr.h>

Public Member Functions

 TfAnyUniquePtr (TfAnyUniquePtr &&other)
 
TfAnyUniquePtroperator= (TfAnyUniquePtr &&other)
 
 TfAnyUniquePtr (TfAnyUniquePtr const &)=delete
 
TfAnyUniquePtroperator= (TfAnyUniquePtr const &)=delete
 
void const * Get () const
 Return a pointer to the owned object.
 

Static Public Member Functions

template<typename T >
static TfAnyUniquePtr New ()
 
template<typename T >
static TfAnyUniquePtr New (T const &v)
 

Detailed Description

A simple type-erased container that provides only destruction, moves and immutable, untyped access to the held value.

There are a couple of facilities that provide fallback or default values in error cases. TfAnyUniquePtr exists to hold these oft-instantiated but rarely accessed values. As such, its design prioritizes compile-time overhead over runtime performance and avoids clever metaprogramming. Please resist the urge to add functionality to this class (e.g. small object optimization, boost::python interoperability.)

Definition at line 43 of file anyUniquePtr.h.

Constructor & Destructor Documentation

◆ TfAnyUniquePtr()

TfAnyUniquePtr ( TfAnyUniquePtr &&  other)
inline

Definition at line 58 of file anyUniquePtr.h.

◆ ~TfAnyUniquePtr()

~TfAnyUniquePtr ( )
inline

Definition at line 81 of file anyUniquePtr.h.

Member Function Documentation

◆ Get()

void const * Get ( ) const
inline

Return a pointer to the owned object.

Definition at line 86 of file anyUniquePtr.h.

◆ New() [1/2]

static TfAnyUniquePtr New ( )
inlinestatic

Definition at line 47 of file anyUniquePtr.h.

◆ New() [2/2]

static TfAnyUniquePtr New ( T const &  v)
inlinestatic

Definition at line 53 of file anyUniquePtr.h.

◆ operator=()

TfAnyUniquePtr & operator= ( TfAnyUniquePtr &&  other)
inline

Definition at line 68 of file anyUniquePtr.h.


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