59 using std::shared_ptr;
74 template<
class TAR,
class BASE =shared_ptr<TAR>>
80 template<
class Y>
explicit P (Y* p) : BASE(p) {}
81 template<
class Y,
class D>
P (Y* p, D d) : BASE(p,d){}
83 P (
P const& r) : BASE(r) {}
84 P (
P const&& rr) : BASE(rr) {}
85 template<
class Y>
P (shared_ptr<Y>
const& r) : BASE(r) {}
86 template<
class Y>
explicit P (weak_ptr<Y>
const& wr) : BASE(wr) {}
87 template<
class Y>
explicit P (std::unique_ptr<Y>&& u) : BASE(u.release()) {}
90 P&
operator= (
P const& r) { BASE::operator= (r);
return *
this; }
91 P&
operator= (
P const&& rr) { BASE::operator= (rr);
return *
this; }
92 template<
class Y>
P&
operator=(shared_ptr<Y>
const& sr) { BASE::operator= (sr);
return *
this; }
94 TAR*
get()
const {
return dynamic_cast<TAR*
> (BASE::get()); }
98 void swap(
P& b) { BASE::swap (b);}
100 operator std::string() const noexcept;
105 template<typename _O_,typename B>
107 operator== (
P const& p,
P<_O_, B> const& q) {
return (p and q)? (*p == *q) : (!p and !q); }
109 template<
typename _O_,
typename B>
113 template<
typename _O_,
typename B>
117 template<
typename _O_,
typename B>
121 template<
typename _O_,
typename B>
125 template<
typename _O_,
typename B>
140 template<
typename X,
typename...ARGS>
144 return P<X>{
new X {std::forward<ARGS>(ctorArgs)...}};
153 template<
class TAR,
class BASE>
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
friend bool operator>=(P const &p, P< _O_, B > const &q)
friend bool operator!=(P const &p, P< _O_, B > const &q)
P & operator=(shared_ptr< Y > const &sr)
P(weak_ptr< Y > const &wr)
P & operator=(P const &r)
P(shared_ptr< Y > const &r)
friend bool operator<(P const &p, P< _O_, B > const &q)
friend bool operator>(P const &p, P< _O_, B > const &q)
friend bool operator<=(P const &p, P< _O_, B > const &q)
P(std::unique_ptr< Y > &&u)
Lumiera error handling (C++ interface).
Implementation namespace for support and library code.
P< X > makeP(ARGS &&... ctorArgs)
Helper to create and manage by lib::P.
static std::string invoke(X const &x) noexcept