Panda3D
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
ConstPointerTo< T > Class Template Reference

A ConstPointerTo is similar to a PointerTo, except it keeps a const pointer to the thing. More...

#include "pointerTo.h"

Inheritance diagram for ConstPointerTo< T >:
PointerToBase< T > PointerToVoid MemoryBase

Public Types

typedef PointerToBase< T >::To To
 
- Public Types inherited from PointerToBase< T >
typedef T To
 

Public Member Functions

 ConstPointerTo (const ConstPointerTo< T > &copy)
 
template<class Y >
 ConstPointerTo (const ConstPointerTo< Y > &r) noexcept
 
 ConstPointerTo (const PointerTo< T > &copy)
 
template<class Y >
 ConstPointerTo (const PointerTo< Y > &r) noexcept
 
 ConstPointerTo (const To *ptr) noexcept
 
template<class T >
 ConstPointerTo (const typename ConstPointerTo< T >::To *ptr) noexcept
 
template<class Y >
 ConstPointerTo (const Y *ptr) noexcept
 
 ConstPointerTo (ConstPointerTo< T > &&from) noexcept
 
template<class Y >
 ConstPointerTo (ConstPointerTo< Y > &&r) noexcept
 
 ConstPointerTo (PointerTo< T > &&from) noexcept
 
template<class Y >
 ConstPointerTo (PointerTo< Y > &&r) noexcept
 
constexpr ConstPointerTo (std::nullptr_t) noexcept
 
const T *& cheat ()
 Returns a reference to the underlying pointer.
 
constexpr operator const T * () const noexcept
 We also have the typecast operator to automatically convert ConstPointerTo's to the required kind of actual pointer.
 
constexpr const To & operator* () const noexcept
 
constexpr const To * operator-> () const noexcept
 
ConstPointerTo< T > & operator= (const ConstPointerTo< T > &copy)
 
template<class Y >
ConstPointerTo< T > & operator= (const ConstPointerTo< Y > &r) noexcept
 
ConstPointerTo< T > & operator= (const PointerTo< T > &copy)
 
template<class Y >
ConstPointerTo< T > & operator= (const PointerTo< Y > &r) noexcept
 
ConstPointerTo< T > & operator= (const To *ptr)
 
ConstPointerTo< T > & operator= (ConstPointerTo< T > &&from) noexcept
 
template<class Y >
ConstPointerTo< T > & operator= (ConstPointerTo< Y > &&r) noexcept
 
ConstPointerTo< T > & operator= (PointerTo< T > &&from) noexcept
 
template<class Y >
ConstPointerTo< T > & operator= (PointerTo< Y > &&r) noexcept
 
constexpr const To * p () const noexcept
 Returns an ordinary pointer instead of a ConstPointerTo.
 
- Public Member Functions inherited from PointerToBase< T >
void clear ()
 A convenient way to set the PointerTo object to NULL.
 
void output (std::ostream &out) const
 A handy function to output PointerTo's as a hex pointer followed by a reference count.
 
- Public Member Functions inherited from PointerToVoid
size_t get_hash () const
 
constexpr bool is_null () const
 Returns true if the PointerTo is a NULL pointer, false otherwise.
 
bool operator!= (const PointerToVoid &other) const
 
bool operator< (const PointerToVoid &other) const
 
bool operator< (const void *other) const
 
bool operator== (const PointerToVoid &other) const
 
void swap (PointerToVoid &other) noexcept
 Swaps the contents of this PointerTo with the other, without touching the reference counts.
 
- Public Member Functions inherited from MemoryBase
void operator delete (void *, void *)
 
void operator delete (void *ptr)
 
void operator delete[] (void *, void *)
 
void operator delete[] (void *ptr)
 
void * operator new (size_t size)
 
void * operator new (size_t size, void *ptr)
 
void * operator new[] (size_t size)
 
void * operator new[] (size_t size, void *ptr)
 

Detailed Description

template<class T>
class ConstPointerTo< T >

A ConstPointerTo is similar to a PointerTo, except it keeps a const pointer to the thing.

(Actually, it keeps a non-const pointer, because it must be allowed to adjust the reference counts, and it must be able to delete it when the reference count goes to zero. But it presents only a const pointer to the outside world.)

Notice that a PointerTo may be assigned to a ConstPointerTo, but a ConstPointerTo may not be assigned to a PointerTo.

Definition at line 144 of file pointerTo.h.

Member Typedef Documentation

◆ To

template<class T >
typedef PointerToBase<T>::To ConstPointerTo< T >::To

Definition at line 146 of file pointerTo.h.

Constructor & Destructor Documentation

◆ ConstPointerTo() [1/11]

template<class T >
constexpr ConstPointerTo< T >::ConstPointerTo ( std::nullptr_t )
inlineexplicitconstexprnoexcept

Definition at line 149 of file pointerTo.h.

◆ ConstPointerTo() [2/11]

template<class T >
ConstPointerTo< T >::ConstPointerTo ( const PointerTo< T > & copy)
inline

Definition at line 198 of file pointerTo.I.

◆ ConstPointerTo() [3/11]

template<class T >
ConstPointerTo< T >::ConstPointerTo ( const ConstPointerTo< T > & copy)
inline

Definition at line 208 of file pointerTo.I.

◆ ConstPointerTo() [4/11]

template<class T >
ConstPointerTo< T >::ConstPointerTo ( PointerTo< T > && from)
inlinenoexcept

Definition at line 218 of file pointerTo.I.

◆ ConstPointerTo() [5/11]

template<class T >
ConstPointerTo< T >::ConstPointerTo ( ConstPointerTo< T > && from)
inlinenoexcept

Definition at line 228 of file pointerTo.I.

◆ ConstPointerTo() [6/11]

template<class T >
template<class Y >
ConstPointerTo< T >::ConstPointerTo ( const Y * ptr)
inlineexplicitnoexcept

Definition at line 240 of file pointerTo.I.

◆ ConstPointerTo() [7/11]

template<class T >
template<class Y >
ConstPointerTo< T >::ConstPointerTo ( const PointerTo< Y > & r)
inlinenoexcept

Definition at line 251 of file pointerTo.I.

◆ ConstPointerTo() [8/11]

template<class T >
template<class Y >
ConstPointerTo< T >::ConstPointerTo ( const ConstPointerTo< Y > & r)
inlinenoexcept

Definition at line 262 of file pointerTo.I.

◆ ConstPointerTo() [9/11]

template<class T >
template<class Y >
ConstPointerTo< T >::ConstPointerTo ( PointerTo< Y > && r)
inlinenoexcept

Definition at line 273 of file pointerTo.I.

◆ ConstPointerTo() [10/11]

template<class T >
template<class Y >
ConstPointerTo< T >::ConstPointerTo ( ConstPointerTo< Y > && r)
inlinenoexcept

Definition at line 284 of file pointerTo.I.

◆ ConstPointerTo() [11/11]

template<class T >
template<class T >
ConstPointerTo< T >::ConstPointerTo ( const typename ConstPointerTo< T >::To * ptr)
inlinenoexcept

Definition at line 188 of file pointerTo.I.

Member Function Documentation

◆ cheat()

template<class T >
const T *& ConstPointerTo< T >::cheat ( )
inline

Returns a reference to the underlying pointer.

This is a very unsafe method. It's only used by some interrogate code. If you think this method might be useful to you, you're probably wrong.

Promise me you won't use this, okay?

Definition at line 395 of file pointerTo.I.

◆ operator const T *()

template<class T >
constexpr ConstPointerTo< T >::operator const T * ( ) const
constexprnoexcept

We also have the typecast operator to automatically convert ConstPointerTo's to the required kind of actual pointer.

This introduces ambiguities which the compiler will resolve one way or the other, but we don't care which way it goes because either will be correct.

Definition at line 382 of file pointerTo.I.

◆ operator*()

template<class T >
constexpr const ConstPointerTo< T >::To & ConstPointerTo< T >::operator* ( ) const
constexprnoexcept

Definition at line 361 of file pointerTo.I.

◆ operator->()

template<class T >
constexpr const ConstPointerTo< T >::To * ConstPointerTo< T >::operator-> ( ) const
constexprnoexcept

Definition at line 370 of file pointerTo.I.

◆ operator=() [1/9]

template<class T >
ConstPointerTo< T > & ConstPointerTo< T >::operator= ( const ConstPointerTo< T > & copy)
inline

Definition at line 434 of file pointerTo.I.

◆ operator=() [2/9]

template<class T >
template<class Y >
ConstPointerTo< T > & ConstPointerTo< T >::operator= ( const ConstPointerTo< Y > & r)
inlinenoexcept

Definition at line 328 of file pointerTo.I.

◆ operator=() [3/9]

template<class T >
ConstPointerTo< T > & ConstPointerTo< T >::operator= ( const PointerTo< T > & copy)
inline

Definition at line 424 of file pointerTo.I.

◆ operator=() [4/9]

template<class T >
template<class Y >
ConstPointerTo< T > & ConstPointerTo< T >::operator= ( const PointerTo< Y > & r)
inlinenoexcept

Definition at line 317 of file pointerTo.I.

◆ operator=() [5/9]

template<class T >
ConstPointerTo< T > & ConstPointerTo< T >::operator= ( const To * ptr)
inline

Definition at line 414 of file pointerTo.I.

◆ operator=() [6/9]

template<class T >
ConstPointerTo< T > & ConstPointerTo< T >::operator= ( ConstPointerTo< T > && from)
inlinenoexcept

Definition at line 305 of file pointerTo.I.

◆ operator=() [7/9]

template<class T >
template<class Y >
ConstPointerTo< T > & ConstPointerTo< T >::operator= ( ConstPointerTo< Y > && r)
inlinenoexcept

Definition at line 350 of file pointerTo.I.

◆ operator=() [8/9]

template<class T >
ConstPointerTo< T > & ConstPointerTo< T >::operator= ( PointerTo< T > && from)
inlinenoexcept

Definition at line 295 of file pointerTo.I.

◆ operator=() [9/9]

template<class T >
template<class Y >
ConstPointerTo< T > & ConstPointerTo< T >::operator= ( PointerTo< Y > && r)
inlinenoexcept

Definition at line 339 of file pointerTo.I.

◆ p()

template<class T >
constexpr const ConstPointerTo< T >::To * ConstPointerTo< T >::p ( ) const
constexprnoexcept

Returns an ordinary pointer instead of a ConstPointerTo.

Useful to work around compiler problems, particularly for implicit upcasts.

Definition at line 405 of file pointerTo.I.


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