Panda3D
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. More...
 
constexpr operator const T * () const noexcept
 We also have the typecast operator to automatically convert ConstPointerTo's to the required kind of actual pointer. More...
 
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. More...
 
- Public Member Functions inherited from PointerToBase< T >
void clear ()
 A convenient way to set the PointerTo object to NULL. More...
 
void output (std::ostream &out) const
 A handy function to output PointerTo's as a hex pointer followed by a reference count. More...
 
- 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. More...
 
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. More...
 
- 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 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 *
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.

◆ p()

template<class T >
constexpr const ConstPointerTo< T >::To * ConstPointerTo< T >::p
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: