67 template<
class TAR,
class BASE =shared_ptr<TAR>>
73 template<
class Y>
explicit P (Y* p) : BASE(p) {}
74 template<
class Y,
class D> P (Y* p, D d) : BASE(p,d){}
76 P (P
const& r) : BASE(r) {}
77 P (P
const&& rr) : BASE(rr) {}
78 template<
class Y> P (shared_ptr<Y>
const& r) : BASE(r) {}
79 template<
class Y>
explicit P (weak_ptr<Y>
const& wr) : BASE(wr) {}
80 template<
class Y>
explicit P (std::unique_ptr<Y>&& u) : BASE(u.release()) {}
83 P& operator= (P
const& r) { BASE::operator= (r);
return *
this; }
84 P& operator= (P
const&& rr) { BASE::operator= (rr);
return *
this; }
85 template<
class Y> P& operator=(shared_ptr<Y>
const& sr) { BASE::operator= (sr);
return *
this; }
87 TAR*
get()
const {
return dynamic_cast<TAR*
> (BASE::get()); }
88 TAR& operator*()
const {
return *
get(); }
89 TAR* operator->()
const {
return get(); }
91 void swap(P& b) { BASE::swap (b);}
93 operator std::string() const noexcept;
98 template<typename _O_,typename B>
100 operator== (P const& p, P<_O_, B> const& q) {
return (p && q)? (*p == *q) : (!p && !q); }
102 template<
typename _O_,
typename B>
104 operator!= (P
const& p, P<_O_, B>
const& q) {
return (p && q)? (*p != *q) : !(!p && !q); }
106 template<
typename _O_,
typename B>
108 operator< (P const& p, P<_O_, B>
const& q) { REQUIRE (p && q);
return *p < *q; }
110 template<
typename _O_,
typename B>
112 operator> (
P const& p,
P<_O_, B> const& q) { REQUIRE (p && q);
return *q < *p; }
114 template<
typename _O_,
typename B>
116 operator<= (P const& p, P<_O_, B>
const& q) { REQUIRE (p && q);
return *p <= *q;}
118 template<
typename _O_,
typename B>
120 operator>= (
P const& p,
P<_O_, B> const& q) { REQUIRE (p && q);
return *p >= *q;}
133 template<
typename X,
typename...ARGS>
137 return P<X>{
new X {std::forward<ARGS>(ctorArgs)...}};
146 template<
class TAR,
class BASE>
153 return "⟂ P<"+meta::typeStr<TAR>()+
">";
156 {
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.