76 template<
class TAR,
class BASE =shared_ptr<TAR>>
82 template<
class Y>
explicit P (Y* p) : BASE(p) {}
83 template<
class Y,
class D> P (Y* p, D d) : BASE(p,d){}
85 P (P
const& r) : BASE(r) {}
86 P (P
const&& rr) : BASE(rr) {}
87 template<
class Y> P (shared_ptr<Y>
const& r) : BASE(r) {}
88 template<
class Y>
explicit P (weak_ptr<Y>
const& wr) : BASE(wr) {}
89 template<
class Y>
explicit P (std::unique_ptr<Y>&& u) : BASE(u.release()) {}
92 P& operator= (P
const& r) { BASE::operator= (r);
return *
this; }
93 P& operator= (P
const&& rr) { BASE::operator= (rr);
return *
this; }
94 template<
class Y> P& operator=(shared_ptr<Y>
const& sr) { BASE::operator= (sr);
return *
this; }
96 TAR*
get()
const {
return dynamic_cast<TAR*
> (BASE::get()); }
97 TAR& operator*()
const {
return *
get(); }
98 TAR* operator->()
const {
return get(); }
100 void swap(P& b) { BASE::swap (b);}
102 operator std::string() const noexcept;
107 template<typename _O_,typename B>
109 operator== (P const& p, P<_O_, B> const& q) {
return (p && q)? (*p == *q) : (!p && !q); }
111 template<
typename _O_,
typename B>
113 operator!= (P
const& p, P<_O_, B>
const& q) {
return (p && q)? (*p != *q) : !(!p && !q); }
115 template<
typename _O_,
typename B>
117 operator< (P const& p, P<_O_, B>
const& q) { REQUIRE (p && q);
return *p < *q; }
119 template<
typename _O_,
typename B>
121 operator> (
P const& p,
P<_O_, B> const& q) { REQUIRE (p && q);
return *q < *p; }
123 template<
typename _O_,
typename B>
125 operator<= (P const& p, P<_O_, B>
const& q) { REQUIRE (p && q);
return *p <= *q;}
127 template<
typename _O_,
typename B>
129 operator>= (
P const& p,
P<_O_, B> const& q) { REQUIRE (p && q);
return *p >= *q;}
142 template<
typename X,
typename...ARGS>
146 return P<X>{
new X {std::forward<ARGS>(ctorArgs)...}};
155 template<
class TAR,
class BASE>
162 return "⟂ P<"+meta::typeStr<TAR>()+
">";
165 {
return meta::FAILURE_INDICATOR; }
Implementation namespace for support and library code.
Lumiera error handling (C++ interface).
P< X > makeP(ARGS &&... ctorArgs)
Helper to create and manage by lib::P.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
failsafe invocation of custom string conversion.