Spicy
Public Member Functions | List of all members
hilti::rt::StrongReferenceGeneric Class Reference

#include <reference.h>

Public Member Functions

 StrongReferenceGeneric ()=default
 
template<typename T >
 StrongReferenceGeneric (StrongReference< T > x)
 
template<typename T >
T * as () const
 
void reset ()
 

Detailed Description

Type for a generic, non-templated strong reference binding to a StrongReference. This generic version can keep a StrongReference alive, but provides access to the instance itself only if the type is known.

Constructor & Destructor Documentation

◆ StrongReferenceGeneric() [1/2]

hilti::rt::StrongReferenceGeneric::StrongReferenceGeneric ( )
default

Leaves the reference unbound.

◆ StrongReferenceGeneric() [2/2]

template<typename T >
hilti::rt::StrongReferenceGeneric::StrongReferenceGeneric ( StrongReference< T >  x)
inline

Binds to the same instance as an existing strong reference.

Member Function Documentation

◆ as()

template<typename T >
T* hilti::rt::StrongReferenceGeneric::as ( ) const
inline

Obtains a pointer to the stored value.

Returns
a pointer to the bound instance, or null if unbound.
Exceptions
IllegalReferenceif the target type does not match the stored reference type.

◆ reset()

void hilti::rt::StrongReferenceGeneric::reset ( )
inline

Releases the bound reference.


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