ROSE 0.11.145.192
Public Member Functions | List of all members
sg::NotNull< T > Struct Template Reference

Description

template<class T>
struct sg::NotNull< T >

experimental class for returning non-null pointers

Definition at line 119 of file sageGeneric.h.

#include <sageInterface/sageGeneric.h>

Public Member Functions

 NotNull (T *p)
 standard constructor testing that p is not nullptr
 
 NotNull (const NotNull &)=default
 
NotNulloperator= (const NotNull &)=default
 
template<class U , bool = EnableConversion<U*,T*>::value>
 NotNull (NotNull< U > nn)
 converting ctor for derived types and non-const versions of T
 
T & operator* () const
 dereference operator returns reference to object
 
T * operator-> () const
 arrow operator returns pointer to object
 
 operator T* () const
 implicit conversion operator
 
T * pointer () const
 explicit conversion operator
 

Constructor & Destructor Documentation

◆ NotNull() [1/2]

template<class T >
sg::NotNull< T >::NotNull ( T *  p)
inline

standard constructor testing that p is not nullptr

Parameters
pa not-null pointer
Precondition
p != nullptr

Definition at line 125 of file sageGeneric.h.

◆ NotNull() [2/2]

template<class T >
template<class U , bool = EnableConversion<U*,T*>::value>
sg::NotNull< T >::NotNull ( NotNull< U >  nn)
inline

converting ctor for derived types and non-const versions of T

Note
WithConversion<U*,T*>::value may fail SFINAE when U is not convertible to T.

Definition at line 140 of file sageGeneric.h.

Member Function Documentation

◆ operator*()

template<class T >
T & sg::NotNull< T >::operator* ( ) const
inline

dereference operator returns reference to object

Definition at line 145 of file sageGeneric.h.

◆ operator->()

template<class T >
T * sg::NotNull< T >::operator-> ( ) const
inline

arrow operator returns pointer to object

Definition at line 148 of file sageGeneric.h.

◆ operator T*()

template<class T >
sg::NotNull< T >::operator T* ( ) const
inline

implicit conversion operator

Definition at line 151 of file sageGeneric.h.

◆ pointer()

template<class T >
T * sg::NotNull< T >::pointer ( ) const
inline

explicit conversion operator

Definition at line 154 of file sageGeneric.h.


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