Lumiera  0.pre.03
»edit your freedom«
P< TAR, BASE > Class Template Reference

#include "lib/p.hpp"

Description

template<class TAR, class BASE = shared_ptr<TAR>>
class lib::P< TAR, BASE >

Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relationships and ordering operators to the pointee objects.

Parameters
TARthe visible pointee type
BASEthe shared-ptr type used as implementation
Note
if the BASE smart-ptr type used as implementation implies another pointer type than the one used on the interface (=type TAR), then every access to the pointee causes an dynamic cast. Thus the pointee types need to support RTTI.

Definition at line 80 of file trait.hpp.

Public Member Functions

template<class Y >
 P (Y *p)
 
template<class Y , class D >
 P (Y *p, D d)
 
 P (P const &r)
 
 P (P const &&rr)
 
template<class Y >
 P (shared_ptr< Y > const &r)
 
template<class Y >
 P (weak_ptr< Y > const &wr)
 
template<class Y >
 P (std::unique_ptr< Y > &&u)
 
TAR * get () const
 
 operator std::string () const noexcept
 use custom string conversion on pointee, if applicable, otherwise fall back to a human readable type string.S
 
TAR & operator* () const
 
TAR * operator-> () const
 
Poperator= (P const &r)
 
Poperator= (P const &&rr)
 
template<class Y >
Poperator= (shared_ptr< Y > const &sr)
 
void swap (P &b)
 

Friends

template<typename _O_ , typename B >
bool operator!= (P const &p, P< _O_, B > const &q)
 
template<typename _O_ , typename B >
bool operator< (P const &p, P< _O_, B > const &q)
 
template<typename _O_ , typename B >
bool operator<= (P const &p, P< _O_, B > const &q)
 
template<typename _O_ , typename B >
bool operator== (P const &p, P< _O_, B > const &q)
 
template<typename _O_ , typename B >
bool operator> (P const &p, P< _O_, B > const &q)
 
template<typename _O_ , typename B >
bool operator>= (P const &p, P< _O_, B > const &q)
 

Friends And Related Function Documentation

◆ operator<

bool operator< ( P< TAR, BASE > const &  p,
P< _O_, B > const &  q 
)
friend
Note
deliberately not allowing comparison on NIL ////TICKET #307 : problem with equality test in associative containers, where equal(a,b) := !(a < b) && !(b < a)

Definition at line 117 of file p.hpp.

+ Inheritance diagram for P< TAR, BASE >:
+ Collaboration diagram for P< TAR, BASE >:

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