9#include "libcopp/utils/config/libcopp_build_features.h"
13#if defined(__GNUC__) && !defined(__clang__) && !defined(__apple_build_version__)
14# if (__GNUC__ * 100 + __GNUC_MINOR__ * 10) >= 460
15# pragma GCC diagnostic push
17#elif defined(__clang__) || defined(__apple_build_version__)
18# pragma clang diagnostic push
19# pragma clang diagnostic ignored "-Wself-assign-overloaded"
24struct checked_deleter {
25 void operator()(X *p) {
delete p; }
29struct checked_array_deleter {
30 void operator()(X *p) {
delete[] p; }
36namespace n_element_type {
41 typedef copp::memory::strong_rc_ptr<int>::element_type T;
36namespace n_element_type {
…}
48namespace n_constructors {
54 copp::memory::strong_rc_ptr<int> pi;
62 copp::memory::strong_rc_ptr<void> pv;
70 copp::memory::strong_rc_ptr<incomplete> px;
98struct Y :
public A,
public virtual X {
98struct Y :
public A,
public virtual X {
…};
115 copp::memory::strong_rc_ptr<T> pt(p);
126 pc0_test(
static_cast<int const *
>(0));
127 pc0_test(
static_cast<int volatile *
>(0));
128 pc0_test(
static_cast<int const volatile *
>(0));
131 copp::memory::strong_rc_ptr<int const> pi(
static_cast<int *
>(0));
140 copp::memory::strong_rc_ptr<int volatile> pi(
static_cast<int *
>(0));
149 copp::memory::strong_rc_ptr<void> pv(
static_cast<int *
>(0));
158 copp::memory::strong_rc_ptr<void const> pv(
static_cast<int *
>(0));
169 pc0_test(
static_cast<X const volatile *
>(0));
172 copp::memory::strong_rc_ptr<X const> px(
static_cast<X *
>(0));
181 copp::memory::strong_rc_ptr<X> px(
static_cast<Y *
>(0));
190 copp::memory::strong_rc_ptr<X const> px(
static_cast<Y *
>(0));
199 copp::memory::strong_rc_ptr<void> pv(
static_cast<X *
>(0));
208 copp::memory::strong_rc_ptr<void const> pv(
static_cast<X *
>(0));
218 copp::memory::strong_rc_ptr<int> pi(p);
229 copp::memory::strong_rc_ptr<int const> pi(p);
240 copp::memory::strong_rc_ptr<void> pv(p);
250 copp::memory::strong_rc_ptr<void const> pv(p);
262 copp::memory::strong_rc_ptr<X> px(p);
275 copp::memory::strong_rc_ptr<X const> px(p);
288 copp::memory::strong_rc_ptr<void> pv(p);
301 copp::memory::strong_rc_ptr<void const> pv(p);
315 copp::memory::strong_rc_ptr<X> px(p);
330 copp::memory::strong_rc_ptr<X const> px(p);
363 copp::memory::strong_rc_ptr<int> pi(
static_cast<int *
>(0),
deleter);
372 copp::memory::strong_rc_ptr<void> pv(
static_cast<int *
>(0), &
deleter);
381 copp::memory::strong_rc_ptr<void const> pv(
static_cast<int *
>(0),
deleter);
390 copp::memory::strong_rc_ptr<incomplete> px(
p0,
deleter3());
399 copp::memory::strong_rc_ptr<void> pv(
p0,
deleter3());
408 copp::memory::strong_rc_ptr<void const> pv(
p0,
deleter3());
419 copp::memory::strong_rc_ptr<int> pi(&
m,
deleter2);
430 copp::memory::strong_rc_ptr<int const> pi(&
m, &
deleter2);
441 copp::memory::strong_rc_ptr<void> pv(&
m,
deleter2);
452 copp::memory::strong_rc_ptr<void const> pv(&
m, &
deleter2);
465 copp::memory::strong_rc_ptr<int> pi;
467 copp::memory::strong_rc_ptr<int> pi2(pi);
474 copp::memory::strong_rc_ptr<void> pi3(pi);
481 copp::memory::strong_rc_ptr<void> pi4(pi3);
490 copp::memory::strong_rc_ptr<void> pv;
492 copp::memory::strong_rc_ptr<void> pv2(pv);
501 copp::memory::strong_rc_ptr<incomplete> px;
503 copp::memory::strong_rc_ptr<incomplete> px2(px);
510 copp::memory::strong_rc_ptr<void> px3(px);
519 copp::memory::strong_rc_ptr<int> pi(
static_cast<int *
>(0));
521 copp::memory::strong_rc_ptr<int> pi2(pi);
531 copp::memory::strong_rc_ptr<void> pi3(pi);
541 copp::memory::strong_rc_ptr<void> pi4(pi2);
556 copp::memory::strong_rc_ptr<X> px(
static_cast<X *
>(0));
558 copp::memory::strong_rc_ptr<X> px2(px);
568 copp::memory::strong_rc_ptr<void> px3(px);
578 copp::memory::strong_rc_ptr<void> px4(px2);
594 copp::memory::strong_rc_ptr<int> pi(p);
596 copp::memory::strong_rc_ptr<int> pi2(pi);
610 copp::memory::strong_rc_ptr<void> pv(p);
613 copp::memory::strong_rc_ptr<void> pv2(pv);
628 copp::memory::strong_rc_ptr<X> px(p);
631 copp::memory::strong_rc_ptr<X> px2(px);
644 copp::memory::strong_rc_ptr<void> px3(px);
654 copp::memory::strong_rc_ptr<void> px4(px2);
673 copp::memory::strong_rc_ptr<Y> py(p);
676 copp::memory::strong_rc_ptr<X> px(py);
689 copp::memory::strong_rc_ptr<void const> pv(px);
699 copp::memory::strong_rc_ptr<void const> pv2(py);
715#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
717 copp::memory::weak_rc_ptr<Y> wp;
721 copp::memory::strong_rc_ptr<Y> p2(wp);
723 }
catch (std::bad_weak_ptr
const &) {
727 copp::memory::strong_rc_ptr<X> p3(wp);
729 }
catch (std::bad_weak_ptr
const &) {
735 copp::memory::strong_rc_ptr<Y> p;
736 copp::memory::weak_rc_ptr<Y> wp(p);
739 if (wp.use_count() != 0) {
740 copp::memory::strong_rc_ptr<Y> p2(wp);
744 copp::memory::strong_rc_ptr<X> p3(wp);
751 copp::memory::strong_rc_ptr<Y> p(
new Y);
752 copp::memory::weak_rc_ptr<Y> wp(p);
755 copp::memory::strong_rc_ptr<Y> p2(wp);
766 copp::memory::strong_rc_ptr<X> p3(wp);
780#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
782 copp::memory::strong_rc_ptr<Y> p2(wp);
784 }
catch (std::bad_weak_ptr
const &) {
788 copp::memory::strong_rc_ptr<X> p3(wp);
790 }
catch (std::bad_weak_ptr
const &) {
48namespace n_constructors {
…}
806namespace n_assignment {
828struct Y :
public A,
public virtual X {
828struct Y :
public A,
public virtual X {
…};
844 copp::memory::strong_rc_ptr<incomplete> p1;
853 copp::memory::strong_rc_ptr<incomplete> p2;
862 copp::memory::strong_rc_ptr<incomplete> p3(p1);
873 copp::memory::strong_rc_ptr<void> p1;
882 copp::memory::strong_rc_ptr<void> p2;
891 copp::memory::strong_rc_ptr<void> p3(p1);
900 copp::memory::strong_rc_ptr<void> p4(
new int);
917 copp::memory::strong_rc_ptr<X> p1;
926 copp::memory::strong_rc_ptr<X> p2;
935 copp::memory::strong_rc_ptr<X> p3(p1);
946 copp::memory::strong_rc_ptr<X> p4(
new X);
973 copp::memory::strong_rc_ptr<void> p1;
975 copp::memory::strong_rc_ptr<incomplete> p2;
984 copp::memory::strong_rc_ptr<int> p4(
new int);
987 copp::memory::strong_rc_ptr<void> p5(p4);
1004 copp::memory::strong_rc_ptr<X> p1;
1006 copp::memory::strong_rc_ptr<Y> p2;
1018 copp::memory::strong_rc_ptr<Y> p4(
new Y);
1024 copp::memory::strong_rc_ptr<X> p5(p4);
806namespace n_assignment {
…}
1085 copp::memory::strong_rc_ptr<int> pi;
1094 copp::memory::strong_rc_ptr<int> pi(
static_cast<int *
>(0));
1103 copp::memory::strong_rc_ptr<int> pi(
new int);
1112 copp::memory::strong_rc_ptr<incomplete> px;
1121 copp::memory::strong_rc_ptr<incomplete> px(
p0,
deleter);
1130 copp::memory::strong_rc_ptr<X> px;
1140 copp::memory::strong_rc_ptr<X> px(
new X);
1151 copp::memory::strong_rc_ptr<void> pv;
1161 copp::memory::strong_rc_ptr<void> pv(
new X);
1176struct Y :
public A,
public virtual X {
1176struct Y :
public A,
public virtual X {
…};
1192 copp::memory::strong_rc_ptr<int> pi;
1195 pi.reset(
static_cast<int *
>(
nullptr));
1210 pi.reset(
static_cast<int *
>(0));
1219 copp::memory::strong_rc_ptr<X> px;
1221 px.reset(
static_cast<X *
>(0));
1238 px.reset(
static_cast<X *
>(0));
1257 px.reset(
static_cast<Y *
>(0));
1268 copp::memory::strong_rc_ptr<void> pv;
1270 pv.reset(
static_cast<X *
>(0));
1287 pv.reset(
static_cast<X *
>(0));
1306 pv.reset(
static_cast<Y *
>(0));
1323 copp::memory::strong_rc_ptr<int> pi;
1325 pi.reset(
static_cast<int *
>(0),
deleter2);
1343 pi.reset(
static_cast<int *
>(0),
deleter2);
1356 copp::memory::strong_rc_ptr<X> px;
1358 px.reset(
static_cast<X *
>(0),
deleter2);
1376 px.reset(
static_cast<X *
>(0),
deleter2);
1393 px.reset(
static_cast<Y *
>(0),
deleter2);
1406 copp::memory::strong_rc_ptr<void> pv;
1408 pv.reset(
static_cast<X *
>(0),
deleter2);
1426 pv.reset(
static_cast<X *
>(0),
deleter2);
1443 pv.reset(
static_cast<Y *
>(0),
deleter2);
1456 copp::memory::strong_rc_ptr<incomplete> px;
1061namespace n_reset {
…}
1485 copp::memory::strong_rc_ptr<X> px;
1492 copp::memory::strong_rc_ptr<X> px(
static_cast<X *
>(0));
1499 copp::memory::strong_rc_ptr<X> px(
static_cast<X *
>(0), checked_deleter<X>());
1507 copp::memory::strong_rc_ptr<X> px(p);
1517 copp::memory::strong_rc_ptr<X> px(p, checked_deleter<X>());
1479namespace n_access {
…}
1528namespace n_use_count {
1534 copp::memory::strong_rc_ptr<X> px(
static_cast<X *
>(0));
1538 copp::memory::strong_rc_ptr<X> px2(px);
1546 copp::memory::strong_rc_ptr<X> px(
new X);
1550 copp::memory::strong_rc_ptr<X> px2(px);
1558 copp::memory::strong_rc_ptr<X> px(
new X, checked_deleter<X>());
1562 copp::memory::strong_rc_ptr<X> px2(px);
1528namespace n_use_count {
…}
1578 copp::memory::strong_rc_ptr<X> px;
1579 copp::memory::strong_rc_ptr<X> px2;
1595 copp::memory::strong_rc_ptr<X> px;
1596 copp::memory::strong_rc_ptr<X> px2(p);
1597 copp::memory::strong_rc_ptr<X> px3(px2);
1620 copp::memory::strong_rc_ptr<X> px(p1);
1621 copp::memory::strong_rc_ptr<X> px2(p2);
1622 copp::memory::strong_rc_ptr<X> px3(px2);
1647namespace n_comparison {
1657struct Z :
public X,
public virtual Y {};
1661 copp::memory::strong_rc_ptr<X> px;
1666 copp::memory::strong_rc_ptr<X> px2;
1675 copp::memory::strong_rc_ptr<X> px;
1676 copp::memory::strong_rc_ptr<X> px2(px);
1689 copp::memory::strong_rc_ptr<X> px;
1690 copp::memory::strong_rc_ptr<X> px2(
new X);
1704 copp::memory::strong_rc_ptr<X> px(
new X);
1705 copp::memory::strong_rc_ptr<X> px2(
new X);
1715 copp::memory::strong_rc_ptr<X> px(
new X);
1716 copp::memory::strong_rc_ptr<X> px2(px);
1729 copp::memory::strong_rc_ptr<X> px(
new X);
1730 copp::memory::strong_rc_ptr<Y> py(
new Y);
1731 copp::memory::strong_rc_ptr<Z> pz(
new Z);
1749 copp::memory::strong_rc_ptr<void> pvx(px);
1755 copp::memory::strong_rc_ptr<void> pvy(py);
1756 copp::memory::strong_rc_ptr<void> pvz(pz);
1768 copp::memory::strong_rc_ptr<Z> pz(
new Z);
1769 copp::memory::strong_rc_ptr<X> px(pz);
1775 copp::memory::strong_rc_ptr<Y> py(pz);
1789 copp::memory::strong_rc_ptr<void> pvx(px);
1790 copp::memory::strong_rc_ptr<void> pvy(py);
1791 copp::memory::strong_rc_ptr<void> pvz(pz);
1647namespace n_comparison {
…}
1809namespace n_static_cast {
1817 copp::memory::strong_rc_ptr<void> pv;
1819 copp::memory::strong_rc_ptr<int> pi = copp::memory::static_pointer_cast<int>(pv);
1822 copp::memory::strong_rc_ptr<X> px = copp::memory::static_pointer_cast<X>(pv);
1827 copp::memory::strong_rc_ptr<int> pi(
new int);
1828 copp::memory::strong_rc_ptr<void> pv(pi);
1830 copp::memory::strong_rc_ptr<int> pi2 = copp::memory::static_pointer_cast<int>(pv);
1839 copp::memory::strong_rc_ptr<X> px(
new X);
1840 copp::memory::strong_rc_ptr<void> pv(px);
1842 copp::memory::strong_rc_ptr<X> px2 = copp::memory::static_pointer_cast<X>(pv);
1851 copp::memory::strong_rc_ptr<X> px(
new Y);
1853 copp::memory::strong_rc_ptr<Y> py = copp::memory::static_pointer_cast<Y>(px);
1858 copp::memory::strong_rc_ptr<X> px2(py);
1809namespace n_static_cast {
…}
1865namespace n_const_cast {
1871 copp::memory::strong_rc_ptr<void const volatile> px;
1873 copp::memory::strong_rc_ptr<void> px2 = copp::memory::const_pointer_cast<void>(px);
1878 copp::memory::strong_rc_ptr<int const volatile> px;
1880 copp::memory::strong_rc_ptr<int> px2 = copp::memory::const_pointer_cast<int>(px);
1885 copp::memory::strong_rc_ptr<X const volatile> px;
1887 copp::memory::strong_rc_ptr<X> px2 = copp::memory::const_pointer_cast<X>(px);
1892 copp::memory::strong_rc_ptr<void const volatile> px(
new int);
1894 copp::memory::strong_rc_ptr<void> px2 = copp::memory::const_pointer_cast<void>(px);
1902 copp::memory::strong_rc_ptr<int const volatile> px(
new int);
1904 copp::memory::strong_rc_ptr<int> px2 = copp::memory::const_pointer_cast<int>(px);
1865namespace n_const_cast {
…}
1914#if defined(LIBCOPP_MACRO_ENABLE_RTTI) && LIBCOPP_MACRO_ENABLE_RTTI
1916namespace n_dynamic_cast {
1922struct W :
public V {};
1926 copp::memory::strong_rc_ptr<V> pv;
1927 copp::memory::strong_rc_ptr<W> pw = copp::memory::dynamic_pointer_cast<W>(pv);
1932 copp::memory::strong_rc_ptr<V> pv(
static_cast<V *
>(0));
1934 copp::memory::strong_rc_ptr<W> pw = copp::memory::dynamic_pointer_cast<W>(pv);
1937 copp::memory::strong_rc_ptr<V> pv2(pw);
1942 copp::memory::strong_rc_ptr<V> pv(
static_cast<W *
>(0));
1944 copp::memory::strong_rc_ptr<W> pw = copp::memory::dynamic_pointer_cast<W>(pv);
1947 copp::memory::strong_rc_ptr<V> pv2(pw);
1952 copp::memory::strong_rc_ptr<V> pv(
new V);
1954 copp::memory::strong_rc_ptr<W> pw = copp::memory::dynamic_pointer_cast<W>(pv);
1957 copp::memory::strong_rc_ptr<V> pv2(pw);
1962 copp::memory::strong_rc_ptr<V> pv(
new W);
1964 copp::memory::strong_rc_ptr<W> pw = copp::memory::dynamic_pointer_cast<W>(pv);
1969 copp::memory::strong_rc_ptr<V> pv2(pw);
1983 std::vector<copp::memory::strong_rc_ptr<int>> vi;
1986 copp::memory::strong_rc_ptr<int> pi1(
new int);
1987 copp::memory::strong_rc_ptr<int> pi2(
new int);
1988 copp::memory::strong_rc_ptr<int> pi3(
new int);
2003 std::vector<copp::memory::strong_rc_ptr<X>> vx;
2006 copp::memory::strong_rc_ptr<X> px1(
new X);
2007 copp::memory::strong_rc_ptr<X> px2(
new X);
2008 copp::memory::strong_rc_ptr<X> px3(
new X);
2023 std::map<copp::memory::strong_rc_ptr<void>, int64_t> m;
2026 for (std::vector<copp::memory::strong_rc_ptr<int>>::iterator i = vi.begin(); i != vi.end(); ++i) {
2032 for (std::vector<copp::memory::strong_rc_ptr<X>>::iterator i = vx.begin(); i != vx.end(); ++i) {
2038 for (std::map<copp::memory::strong_rc_ptr<void>, int64_t>::iterator i = m.begin(); i != m.end(); ++i) {
2039 CASE_EXPECT_TRUE(i->first.use_count() ==
static_cast<std::size_t
>(i->second + 1));
2046namespace n_transitive {
2050 copp::memory::strong_rc_ptr<X>
next;
2054 copp::memory::strong_rc_ptr<X> p(
new X);
2055 p->next = copp::memory::strong_rc_ptr<X>(
new X);
2046namespace n_transitive {
…}
2063namespace n_report_1 {
2063namespace n_report_1 {
…}
2083namespace n_report_2 {
2087 void setWeak(copp::memory::strong_rc_ptr<foo> s) {
w = s; }
2090 copp::memory::weak_rc_ptr<foo>
w;
2110 copp::memory::strong_rc_ptr<foo> s(
new foo,
deleter());
2083namespace n_report_2 {
…}
2117namespace n_spt_incomplete {
2121copp::memory::strong_rc_ptr<file>
fopen(
char const *name,
char const *mode);
2122void fread(copp::memory::strong_rc_ptr<file> f,
void *data, int64_t size);
2130 copp::memory::strong_rc_ptr<file> pf =
fopen(
"name",
"mode");
2132 fread(pf, 0, 17041);
2117namespace n_spt_incomplete {
…}
2140namespace n_spt_pimpl {
2148 file(
char const *name,
char const *mode);
2152 void read(
void *data, int64_t size);
2163 file f(
"name",
"mode");
2174 file f3(
"name2",
"mode2");
2140namespace n_spt_pimpl {
…}
2186namespace n_spt_abstract {
2190 virtual void f(
int) = 0;
2191 virtual int g() = 0;
2197copp::memory::strong_rc_ptr<X>
createX();
2205 copp::memory::strong_rc_ptr<X> px =
createX();
2186namespace n_spt_abstract {
…}
2220namespace n_spt_preventing_delete {
2239 static copp::memory::strong_rc_ptr<X>
create() {
2240 copp::memory::strong_rc_ptr<X> px(
new X,
X::deleter());
2239 static copp::memory::strong_rc_ptr<X>
create() {
…}
2249 copp::memory::strong_rc_ptr<X> px =
X::create();
2220namespace n_spt_preventing_delete {
…}
2258namespace n_spt_array {
2273 copp::memory::strong_rc_ptr<X> px(p, checked_array_deleter<X>());
2258namespace n_spt_array {
…}
2282namespace n_spt_static {
2289 void operator delete(
void *) {
2289 void operator delete(
void *) {
…}
2282namespace n_spt_static {
…}
2305namespace n_spt_intrusive {
2320 if (--p->
count == 0)
delete p;
2346 copp::memory::strong_rc_ptr<X> px2(px);
2305namespace n_spt_intrusive {
…}
2356namespace n_spt_another_sp {
2368 T *
get()
const {
return base_type::get(); }
2356namespace n_spt_another_sp {
…}
2450namespace n_spt_shared_from_this {
2454 virtual void f() = 0;
2462 virtual copp::memory::strong_rc_ptr<X>
getX() = 0;
2478 static copp::memory::strong_rc_ptr<impl>
create() {
2479 copp::memory::strong_rc_ptr<impl> pi(
new impl);
2478 static copp::memory::strong_rc_ptr<impl>
create() {
…}
2484 void f()
override {}
2486 copp::memory::strong_rc_ptr<X>
getX()
override {
2487 copp::memory::strong_rc_ptr<X> px =
weak_this.lock();
2486 copp::memory::strong_rc_ptr<X>
getX()
override {
…}
2497 copp::memory::strong_rc_ptr<X> px = py->getX();
2501#if defined(LIBCOPP_MACRO_ENABLE_RTTI) && LIBCOPP_MACRO_ENABLE_RTTI
2502 copp::memory::strong_rc_ptr<Y> py2 = copp::memory::dynamic_pointer_cast<Y>(px);
2450namespace n_spt_shared_from_this {
…}
2511namespace n_spt_wrap {
2511namespace n_spt_wrap {
…}
2528#if defined(LIBCOPP_MACRO_ENABLE_RTTI) && LIBCOPP_MACRO_ENABLE_RTTI
2529 n_dynamic_cast::test();
2550namespace n_spt_incomplete {
2564copp::memory::strong_rc_ptr<file>
fopen(
char const *,
char const *) {
2565 copp::memory::strong_rc_ptr<file> pf(
new file);
2564copp::memory::strong_rc_ptr<file>
fopen(
char const *,
char const *) {
…}
2569void fread(copp::memory::strong_rc_ptr<file> pf,
void *, int64_t) { pf->fread_called =
true; }
2573namespace n_spt_pimpl {
2600namespace n_spt_abstract {
2614 void f(
int n)
override {
n_ += n; }
2616 int g()
override {
return n_; }
2620 copp::memory::strong_rc_ptr<X> px(
new X_impl);
2641 copp::memory::weak_rc_ptr<void()> wp(pf);
2673 copp::memory::strong_rc_ptr<X> p(
new X);
2676 copp::memory::strong_rc_ptr<X> p2(std::move(p));
2680 copp::memory::strong_rc_ptr<void> p3(std::move(p2));
2689 copp::memory::strong_rc_ptr<X> p(
new X);
2692 copp::memory::strong_rc_ptr<X> p2;
2697 copp::memory::strong_rc_ptr<void> p3;
2707 copp::memory::strong_rc_ptr<X> p(
new X);
2710 copp::memory::strong_rc_ptr<X> p2(
new X);
2716 copp::memory::strong_rc_ptr<void> p3(
new X);
2736 void *
operator new(std::size_t n) {
2739 return ::operator
new(n);
2736 void *
operator new(std::size_t n) {
…}
2742 void operator delete(
void *p) {
2745 ::operator
delete(p);
2742 void operator delete(
void *p) {
…}
2753 explicit X(
int a1 = 0,
int a2 = 0,
int a3 = 0,
int a4 = 0,
int a5 = 0,
int a6 = 0,
int a7 = 0,
int a8 = 0,
int a9 = 0)
2754 :
v(a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9) {
2753 explicit X(
int a1 = 0,
int a2 = 0,
int a3 = 0,
int a4 = 0,
int a5 = 0,
int a6 = 0,
int a7 = 0,
int a8 = 0,
int a9 = 0) {
…}
2765 copp::memory::strong_rc_ptr<int> pi = copp::memory::make_strong_rc<int>();
2774 copp::memory::strong_rc_ptr<int> pi = copp::memory::make_strong_rc<int>(5);
2785 copp::memory::strong_rc_ptr<X> pi = copp::memory::make_strong_rc<X>();
2786 copp::memory::weak_rc_ptr<X> wp(pi);
2799 copp::memory::strong_rc_ptr<X> pi = copp::memory::make_strong_rc<X>(1);
2800 copp::memory::weak_rc_ptr<X> wp(pi);
2813 copp::memory::strong_rc_ptr<X> pi = copp::memory::make_strong_rc<X>(1, 2);
2814 copp::memory::weak_rc_ptr<X> wp(pi);
2827 copp::memory::strong_rc_ptr<X> pi = copp::memory::make_strong_rc<X>(1, 2, 3);
2828 copp::memory::weak_rc_ptr<X> wp(pi);
2841 copp::memory::strong_rc_ptr<X> pi = copp::memory::make_strong_rc<X>(1, 2, 3, 4);
2842 copp::memory::weak_rc_ptr<X> wp(pi);
2855 copp::memory::strong_rc_ptr<X> pi = copp::memory::make_strong_rc<X>(1, 2, 3, 4, 5);
2856 copp::memory::weak_rc_ptr<X> wp(pi);
2869 copp::memory::strong_rc_ptr<X> pi = copp::memory::make_strong_rc<X>(1, 2, 3, 4, 5, 6);
2870 copp::memory::weak_rc_ptr<X> wp(pi);
2883 copp::memory::strong_rc_ptr<X> pi = copp::memory::make_strong_rc<X>(1, 2, 3, 4, 5, 6, 7);
2884 copp::memory::weak_rc_ptr<X> wp(pi);
2897 copp::memory::strong_rc_ptr<X> pi = copp::memory::make_strong_rc<X>(1, 2, 3, 4, 5, 6, 7, 8);
2898 copp::memory::weak_rc_ptr<X> wp(pi);
2911 copp::memory::strong_rc_ptr<X> pi = copp::memory::make_strong_rc<X>(1, 2, 3, 4, 5, 6, 7, 8, 9);
2912 copp::memory::weak_rc_ptr<X> wp(pi);
2928namespace n_element_type {
2933 typedef copp::memory::weak_rc_ptr<int>::element_type T;
2928namespace n_element_type {
…}
2952struct Z :
public X,
public virtual Y {};
2954namespace n_constructors {
2958 copp::memory::weak_rc_ptr<int> wp;
2963 copp::memory::weak_rc_ptr<void> wp;
2968 copp::memory::weak_rc_ptr<incomplete> wp;
2975 copp::memory::strong_rc_ptr<int> sp;
2977 copp::memory::weak_rc_ptr<int> wp(sp);
2980 copp::memory::weak_rc_ptr<void> wp2(sp);
2985 copp::memory::strong_rc_ptr<int> sp(
static_cast<int *
>(0));
2988 copp::memory::weak_rc_ptr<int> wp(sp);
2991 copp::memory::strong_rc_ptr<int> sp2(wp);
2997 copp::memory::weak_rc_ptr<void> wp(sp);
3000 copp::memory::strong_rc_ptr<void> sp2(wp);
3007 copp::memory::strong_rc_ptr<int> sp(
new int);
3010 copp::memory::weak_rc_ptr<int> wp(sp);
3013 copp::memory::strong_rc_ptr<int> sp2(wp);
3019 copp::memory::weak_rc_ptr<void> wp(sp);
3022 copp::memory::strong_rc_ptr<void> sp2(wp);
3029 copp::memory::strong_rc_ptr<void> sp;
3031 copp::memory::weak_rc_ptr<void> wp(sp);
3036 copp::memory::strong_rc_ptr<void> sp(
static_cast<int *
>(0));
3038 copp::memory::weak_rc_ptr<void> wp(sp);
3041 copp::memory::strong_rc_ptr<void> sp2(wp);
3047 copp::memory::strong_rc_ptr<void> sp(
new int);
3049 copp::memory::weak_rc_ptr<void> wp(sp);
3052 copp::memory::strong_rc_ptr<void> sp2(wp);
3058 copp::memory::strong_rc_ptr<incomplete> sp;
3060 copp::memory::weak_rc_ptr<incomplete> wp(sp);
3063 copp::memory::weak_rc_ptr<void> wp2(sp);
3071 copp::memory::weak_rc_ptr<incomplete> wp(sp);
3074 copp::memory::strong_rc_ptr<incomplete> sp2(wp);
3080 copp::memory::weak_rc_ptr<void> wp(sp);
3083 copp::memory::strong_rc_ptr<void> sp2(wp);
3092 copp::memory::weak_rc_ptr<void> wp(sp);
3095 copp::memory::strong_rc_ptr<void> sp2(wp);
3103 copp::memory::weak_rc_ptr<int> wp;
3104 copp::memory::weak_rc_ptr<int> wp2(wp);
3110 copp::memory::weak_rc_ptr<void> wp;
3111 copp::memory::weak_rc_ptr<void> wp2(wp);
3117 copp::memory::weak_rc_ptr<incomplete> wp;
3118 copp::memory::weak_rc_ptr<incomplete> wp2(wp);
3124 copp::memory::strong_rc_ptr<int> sp(
static_cast<int *
>(0));
3125 copp::memory::weak_rc_ptr<int> wp(sp);
3127 copp::memory::weak_rc_ptr<int> wp2(wp);
3135 copp::memory::weak_rc_ptr<int> wp3(wp);
3142 copp::memory::strong_rc_ptr<int> sp(
new int);
3143 copp::memory::weak_rc_ptr<int> wp(sp);
3145 copp::memory::weak_rc_ptr<int> wp2(wp);
3153 copp::memory::weak_rc_ptr<int> wp3(wp);
3160 copp::memory::strong_rc_ptr<void> sp(
static_cast<int *
>(0));
3161 copp::memory::weak_rc_ptr<void> wp(sp);
3163 copp::memory::weak_rc_ptr<void> wp2(wp);
3171 copp::memory::weak_rc_ptr<void> wp3(wp);
3178 copp::memory::strong_rc_ptr<void> sp(
new int);
3179 copp::memory::weak_rc_ptr<void> wp(sp);
3181 copp::memory::weak_rc_ptr<void> wp2(wp);
3189 copp::memory::weak_rc_ptr<void> wp3(wp);
3197 copp::memory::weak_rc_ptr<incomplete> wp(sp);
3199 copp::memory::weak_rc_ptr<incomplete> wp2(wp);
3207 copp::memory::weak_rc_ptr<incomplete> wp3(wp);
3216 copp::memory::weak_rc_ptr<int> wp;
3217 copp::memory::weak_rc_ptr<void> wp2(wp);
3223 copp::memory::weak_rc_ptr<incomplete> wp;
3224 copp::memory::weak_rc_ptr<void> wp2(wp);
3230 copp::memory::weak_rc_ptr<Z> wp;
3232 copp::memory::weak_rc_ptr<X> wp2(wp);
3236 copp::memory::weak_rc_ptr<Y> wp3(wp);
3242 copp::memory::strong_rc_ptr<int> sp(
static_cast<int *
>(0));
3243 copp::memory::weak_rc_ptr<int> wp(sp);
3245 copp::memory::weak_rc_ptr<void> wp2(wp);
3253 copp::memory::weak_rc_ptr<void> wp3(wp);
3260 copp::memory::strong_rc_ptr<int> sp(
new int);
3261 copp::memory::weak_rc_ptr<int> wp(sp);
3263 copp::memory::weak_rc_ptr<void> wp2(wp);
3271 copp::memory::weak_rc_ptr<void> wp3(wp);
3279 copp::memory::weak_rc_ptr<incomplete> wp(sp);
3281 copp::memory::weak_rc_ptr<void> wp2(wp);
3289 copp::memory::weak_rc_ptr<void> wp3(wp);
3296 copp::memory::strong_rc_ptr<Z> sp(
static_cast<Z *
>(0));
3297 copp::memory::weak_rc_ptr<Z> wp(sp);
3299 copp::memory::weak_rc_ptr<X> wp2(wp);
3307 copp::memory::weak_rc_ptr<X> wp3(wp);
3314 copp::memory::strong_rc_ptr<Z> sp(
static_cast<Z *
>(0));
3315 copp::memory::weak_rc_ptr<Z> wp(sp);
3317 copp::memory::weak_rc_ptr<Y> wp2(wp);
3325 copp::memory::weak_rc_ptr<Y> wp3(wp);
3332 copp::memory::strong_rc_ptr<Z> sp(
new Z);
3333 copp::memory::weak_rc_ptr<Z> wp(sp);
3335 copp::memory::weak_rc_ptr<X> wp2(wp);
3343 copp::memory::weak_rc_ptr<X> wp3(wp);
3350 copp::memory::strong_rc_ptr<Z> sp(
new Z);
3351 copp::memory::weak_rc_ptr<Z> wp(sp);
3353 copp::memory::weak_rc_ptr<Y> wp2(wp);
3361 copp::memory::weak_rc_ptr<Y> wp3(wp);
2954namespace n_constructors {
…}
3377namespace n_assignment {
3383 copp::memory::weak_rc_ptr<T> p1;
3388 copp::memory::weak_rc_ptr<T> p2;
3393 copp::memory::weak_rc_ptr<T> p3(p1);
3398 copp::memory::weak_rc_ptr<T> p4(sp);
3420 copp::memory::weak_rc_ptr<void> p1;
3422 copp::memory::weak_rc_ptr<incomplete> p2;
3428 copp::memory::weak_rc_ptr<incomplete> p3(sp);
3443 copp::memory::weak_rc_ptr<X> p1;
3445 copp::memory::weak_rc_ptr<Z> p2;
3450 copp::memory::strong_rc_ptr<Z> sp(
new Z);
3451 copp::memory::weak_rc_ptr<Z> p3(sp);
3466 copp::memory::weak_rc_ptr<Y> p1;
3468 copp::memory::weak_rc_ptr<Z> p2;
3473 copp::memory::strong_rc_ptr<Z> sp(
new Z);
3474 copp::memory::weak_rc_ptr<Z> p3(sp);
3489template <
class T,
class U>
3493 copp::memory::weak_rc_ptr<T> p1;
3494 copp::memory::weak_rc_ptr<T> p2(p1);
3495 copp::memory::weak_rc_ptr<T> p3(sp);
3496 copp::memory::weak_rc_ptr<T> p4(p3);
3522 copp::memory::strong_rc_ptr<int> p(
new int);
3527 copp::memory::strong_rc_ptr<X> p(
new X);
3532 copp::memory::strong_rc_ptr<void> p(
new int);
3544 copp::memory::strong_rc_ptr<int> p(
new int);
3545 shared_ptr_assignment<int>(p);
3549 copp::memory::strong_rc_ptr<int> p(
new int);
3550 shared_ptr_assignment<void>(p);
3554 copp::memory::strong_rc_ptr<X> p(
new X);
3555 shared_ptr_assignment<X>(p);
3559 copp::memory::strong_rc_ptr<X> p(
new X);
3560 shared_ptr_assignment<void>(p);
3564 copp::memory::strong_rc_ptr<void> p(
new int);
3565 shared_ptr_assignment<void>(p);
3570 shared_ptr_assignment<incomplete>(p);
3575 shared_ptr_assignment<void>(p);
3377namespace n_assignment {
…}
3583template <
class T,
class U>
3584void test2(copp::memory::strong_rc_ptr<U> &sp, T * = 0) {
3587 copp::memory::weak_rc_ptr<T> p1;
3588 copp::memory::weak_rc_ptr<T> p2(p1);
3589 copp::memory::weak_rc_ptr<T> p3(sp);
3590 copp::memory::weak_rc_ptr<T> p4(p3);
3591 copp::memory::weak_rc_ptr<T> p5(sp);
3592 copp::memory::weak_rc_ptr<T> p6(p5);
3584void test2(copp::memory::strong_rc_ptr<U> &sp, T * = 0) {
…}
3617 copp::memory::strong_rc_ptr<int> p(
new int);
3622 copp::memory::strong_rc_ptr<int> p(
new int);
3627 copp::memory::strong_rc_ptr<X> p(
new X);
3632 copp::memory::strong_rc_ptr<X> p(
new X);
3637 copp::memory::strong_rc_ptr<void> p(
new int);
3643 test2<incomplete>(p);
3581namespace n_reset {
…}
3654namespace n_use_count {
3658 copp::memory::weak_rc_ptr<X> wp;
3662 copp::memory::weak_rc_ptr<X> wp2;
3666 copp::memory::weak_rc_ptr<X> wp3(wp);
3674 copp::memory::strong_rc_ptr<X> sp(
static_cast<X *
>(0));
3676 copp::memory::weak_rc_ptr<X> wp(sp);
3680 copp::memory::weak_rc_ptr<X> wp2(sp);
3684 copp::memory::weak_rc_ptr<X> wp3(wp);
3690 copp::memory::strong_rc_ptr<X> sp2(sp);
3699 copp::memory::strong_rc_ptr<void> sp3(sp);
3654namespace n_use_count {
…}
3743 copp::memory::weak_rc_ptr<X> wp;
3744 copp::memory::weak_rc_ptr<X> wp2;
3759 copp::memory::strong_rc_ptr<X> sp(
new X);
3760 copp::memory::weak_rc_ptr<X> wp;
3761 copp::memory::weak_rc_ptr<X> wp2(sp);
3762 copp::memory::weak_rc_ptr<X> wp3(sp);
3793 copp::memory::strong_rc_ptr<X> sp(
new X);
3794 copp::memory::strong_rc_ptr<X> sp2(
new X);
3795 copp::memory::weak_rc_ptr<X> wp(sp);
3796 copp::memory::weak_rc_ptr<X> wp2(sp2);
3797 copp::memory::weak_rc_ptr<X> wp3(sp2);
3863 copp::memory::strong_rc_ptr<incomplete> px(
new incomplete);
3889 copp::memory::strong_rc_ptr<X> p_(
new X);
3890 copp::memory::weak_rc_ptr<X> p(p_);
3894 copp::memory::weak_rc_ptr<X> p2(std::move(p));
3899 copp::memory::weak_rc_ptr<void> p3(std::move(p2));
3910 copp::memory::strong_rc_ptr<X> p_(
new X);
3911 copp::memory::weak_rc_ptr<X> p(p_);
3915 copp::memory::weak_rc_ptr<X> p2;
3916 p2 =
static_cast<copp::memory::weak_rc_ptr<X> &&
>(p);
3921 copp::memory::weak_rc_ptr<void> p3;
3933 copp::memory::strong_rc_ptr<X> p_(
new X);
3934 copp::memory::weak_rc_ptr<X> p(p_);
3938 copp::memory::strong_rc_ptr<X> p_2(
new X);
3939 copp::memory::weak_rc_ptr<X> p2(p_2);
3947 copp::memory::strong_rc_ptr<void> p_3(
new X);
3948 copp::memory::weak_rc_ptr<void> p3(p_3);
3959template <
class L,
class R>
3961 return l.owner_before(r);
3966 copp::memory::strong_rc_ptr<int> x;
3967 copp::memory::strong_rc_ptr<int> y;
3968 copp::memory::weak_rc_ptr<int> w;
3972 copp::memory::strong_rc_ptr<int> z(
reinterpret_cast<int *
>(0));
3973 copp::memory::weak_rc_ptr<int> w;
3976 copp::memory::strong_rc_ptr<int> zz(z);
3977 w = copp::memory::weak_rc_ptr<int>(zz);
3984 copp::memory::strong_rc_ptr<int> x;
3985 copp::memory::strong_rc_ptr<int> z(
reinterpret_cast<int *
>(0));
3989 copp::memory::strong_rc_ptr<int> a(
reinterpret_cast<int *
>(0));
3990 copp::memory::strong_rc_ptr<int> b(
reinterpret_cast<int *
>(0));
3992 copp::memory::weak_rc_ptr<int> w(a);
3998 copp::memory::strong_rc_ptr<int> a(
reinterpret_cast<int *
>(0));
3999 copp::memory::weak_rc_ptr<int> wa(a);
4000 copp::memory::strong_rc_ptr<int> b(
reinterpret_cast<int *
>(0));
4001 copp::memory::weak_rc_ptr<int> wb(b);
4009template <
class L,
class R>
4011 return l.owner_equal(r);
4016 copp::memory::strong_rc_ptr<int> p1(
new int);
4017 copp::memory::strong_rc_ptr<int> p2(p1);
4022 copp::memory::strong_rc_ptr<int> p3(
new int);
4027 copp::memory::strong_rc_ptr<int> p4;
4028 copp::memory::strong_rc_ptr<int> p5;
4036 copp::memory::strong_rc_ptr<int> p6(
static_cast<int *
>(0));
4041 copp::memory::strong_rc_ptr<void> p7(p1);
4046 copp::memory::strong_rc_ptr<void> p8;
4054 copp::memory::weak_rc_ptr<int> q1(p1);
4059 copp::memory::weak_rc_ptr<int> q2(p1);
4064 copp::memory::weak_rc_ptr<int> q3(p3);
4072 copp::memory::weak_rc_ptr<int> q4;
4080 copp::memory::weak_rc_ptr<void> q5;
4085 copp::memory::weak_rc_ptr<void> q7(p7);
4119 return l.owner_hash();
4123 copp::memory::strong_rc_ptr<int> p1(
new int);
4124 copp::memory::strong_rc_ptr<int> p2(p1);
4128 copp::memory::strong_rc_ptr<int> p3(
new int);
4132 copp::memory::strong_rc_ptr<int> p4;
4133 copp::memory::strong_rc_ptr<int> p5;
4138 copp::memory::strong_rc_ptr<int> p6(
static_cast<int *
>(0));
4142 copp::memory::strong_rc_ptr<void> p7(p1);
4146 copp::memory::strong_rc_ptr<void> p8;
4151 copp::memory::weak_rc_ptr<int> q1(p1);
4155 copp::memory::weak_rc_ptr<int> q2(p1);
4159 copp::memory::weak_rc_ptr<int> q3(p3);
4164 copp::memory::weak_rc_ptr<int> q4;
4169 copp::memory::weak_rc_ptr<void> q5;
4173 copp::memory::weak_rc_ptr<void> q7(p7);
4198 virtual void f() = 0;
4206 virtual copp::memory::strong_rc_ptr<X>
getX() = 0;
4212copp::memory::strong_rc_ptr<Y>
createY();
4215 copp::memory::strong_rc_ptr<Y> py =
createY();
4219#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
4221 copp::memory::strong_rc_ptr<X> px = py->getX();
4227# if defined(LIBCOPP_MACRO_ENABLE_RTTI) && LIBCOPP_MACRO_ENABLE_RTTI
4228 copp::memory::strong_rc_ptr<Y> py2 = copp::memory::dynamic_pointer_cast<Y>(px);
4233 }
catch (std::bad_weak_ptr
const &) {
4251class impl :
public X,
public virtual Y,
public virtual copp::memory::enable_shared_rc_from_this<impl> {
4253 void f()
override {}
4255 copp::memory::strong_rc_ptr<X>
getX()
override {
4255 copp::memory::strong_rc_ptr<X>
getX()
override {
…}
4251class impl :
public X,
public virtual Y,
public virtual copp::memory::enable_shared_rc_from_this<impl> {
…};
4267 copp::memory::strong_rc_ptr<Y> pi(
new impl2);
4271void test2() { copp::memory::strong_rc_ptr<Y> pi(
static_cast<impl2 *
>(0)); }
4275struct V :
public copp::memory::enable_shared_rc_from_this<V> {};
4278 copp::memory::strong_rc_ptr<V> p(
new V);
4280#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
4282 copp::memory::strong_rc_ptr<V> q = p->shared_from_this();
4285 }
catch (std::bad_weak_ptr
const &) {
4292 copp::memory::strong_rc_ptr<V> r = v2.shared_from_this();
4294 }
catch (std::bad_weak_ptr
const &) {
4299 copp::memory::strong_rc_ptr<V> r = p->shared_from_this();
4301 }
catch (std::bad_weak_ptr
const &) {
4309struct X :
public ::copp::memory::enable_shared_rc_from_this<X> {
4309struct X :
public ::copp::memory::enable_shared_rc_from_this<X> {
…};
4353template <
class U,
class T,
class D>
4357 ::copp::memory::strong_rc_ptr<U> sp(std::move(p1));
4362 sp.reset(
new T,
typename std::remove_reference<D>::type());
4381 std::unique_ptr<X> p(
new X);
4384 ::copp::memory::strong_rc_ptr<X> p2(std::move(p));
4388 ::copp::memory::strong_rc_ptr<X> p3 = p2->shared_from_this();
4396 p2 = std::unique_ptr<X>(
new X);
4399 p2 = std::unique_ptr<X>(
new X);
4409 std::unique_ptr<X> p(
new X);
4412 ::copp::memory::strong_rc_ptr<X const> p2(std::move(p));
4416 ::copp::memory::strong_rc_ptr<X const> p3 = p2->shared_from_this();
4424 p2 = std::unique_ptr<X>(
new X);
4427 p2 = std::unique_ptr<X>(
new X);
4437 std::unique_ptr<X> p(
new X);
4440 ::copp::memory::strong_rc_ptr<void> p2(std::move(p));
4447 p2 = std::unique_ptr<X>(
new X);
4450 p2 = std::unique_ptr<X>(
new X);
4460 std::unique_ptr<Y, YD> p(
new Y,
YD());
4463 ::copp::memory::strong_rc_ptr<Y> p2(std::move(p));
4470 p2 = std::unique_ptr<Y, YD>(
new Y,
YD());
4473 p2 = std::unique_ptr<Y, YD>(
new Y,
YD());
4485 std::unique_ptr<Y, YD &> p(
new Y, yd);
4488 ::copp::memory::strong_rc_ptr<Y> p2(std::move(p));
4495 p2 = std::unique_ptr<Y, YD &>(
new Y, yd);
4498 p2 = std::unique_ptr<Y, YD &>(
new Y, yd);
4510 std::unique_ptr<Y, YD const &> p(
new Y, yd);
4513 ::copp::memory::strong_rc_ptr<Y> p2(std::move(p));
4520 p2 = std::unique_ptr<Y, YD const &>(
new Y, yd);
4523 p2 = std::unique_ptr<Y, YD const &>(
new Y, yd);
4531 test_null_unique_ptr<X>(std::unique_ptr<X>(), std::unique_ptr<X>());
4532 test_null_unique_ptr<X const>(std::unique_ptr<X>(), std::unique_ptr<X>());
4533 test_null_unique_ptr<void>(std::unique_ptr<X>(), std::unique_ptr<X>());
4534 test_null_unique_ptr<void const>(std::unique_ptr<X>(), std::unique_ptr<X>());
4538 test_null_unique_ptr<Y>(std::unique_ptr<Y, YD>(0,
YD()), std::unique_ptr<Y, YD>(0,
YD()));
4539 test_null_unique_ptr<Y const>(std::unique_ptr<Y, YD>(0,
YD()), std::unique_ptr<Y, YD>(0,
YD()));
4540 test_null_unique_ptr<void>(std::unique_ptr<Y, YD>(0,
YD()), std::unique_ptr<Y, YD>(0,
YD()));
4541 test_null_unique_ptr<void const>(std::unique_ptr<Y, YD>(0,
YD()), std::unique_ptr<Y, YD>(0,
YD()));
4547 test_null_unique_ptr<Y>(std::unique_ptr<Y, YD &>(0, yd), std::unique_ptr<Y, YD &>(0, yd));
4548 test_null_unique_ptr<Y const>(std::unique_ptr<Y, YD &>(0, yd), std::unique_ptr<Y, YD &>(0, yd));
4549 test_null_unique_ptr<void>(std::unique_ptr<Y, YD &>(0, yd), std::unique_ptr<Y, YD &>(0, yd));
4550 test_null_unique_ptr<void const>(std::unique_ptr<Y, YD &>(0, yd), std::unique_ptr<Y, YD &>(0, yd));
4557 std::is_same<copp::memory::compat_strong_ptr_type_trait<std::string,
4558 copp::memory::compat_strong_ptr_mode::kStl>::shared_ptr,
4559 std::shared_ptr<std::string>>::value,
4560 "check shared_ptr failed");
4561 static_assert(std::is_same<copp::memory::compat_strong_ptr_type_trait<
4562 std::string, copp::memory::compat_strong_ptr_mode::kStrongRc>::shared_ptr,
4563 copp::memory::strong_rc_ptr<std::string>>::value,
4564 "check strong_rc_ptr failed");
4568 copp::memory::compat_strong_ptr_type_trait<std::string, copp::memory::compat_strong_ptr_mode::kStl>::weak_ptr,
4569 std::weak_ptr<std::string>>::value,
4570 "check weak_ptr failed");
4571 static_assert(std::is_same<copp::memory::compat_strong_ptr_type_trait<
4572 std::string, copp::memory::compat_strong_ptr_mode::kStrongRc>::weak_ptr,
4573 copp::memory::weak_rc_ptr<std::string>>::value,
4574 "check strong_rc_ptr failed");
4576 static_assert(std::is_same<copp::memory::compat_strong_ptr_function_trait<
4577 copp::memory::compat_strong_ptr_mode::kStl>::enable_shared_from_this<std::string>,
4578 std::enable_shared_from_this<std::string>>::value,
4579 "check enable_shared_from_this failed");
4580 static_assert(std::is_same<copp::memory::compat_strong_ptr_function_trait<
4581 copp::memory::compat_strong_ptr_mode::kStrongRc>::enable_shared_from_this<std::string>,
4582 copp::memory::enable_shared_rc_from_this<std::string>>::value,
4583 "check enable_shared_from_this failed");
4585 static_assert(std::is_same<
decltype(copp::memory::compat_strong_ptr_function_trait<
4586 copp::memory::compat_strong_ptr_mode::kStl>::make_shared<std::string>()),
4587 std::shared_ptr<std::string>>::value,
4588 "check make_shared failed");
4589 static_assert(std::is_same<
decltype(copp::memory::compat_strong_ptr_function_trait<
4590 copp::memory::compat_strong_ptr_mode::kStrongRc>::make_shared<std::string>()),
4591 copp::memory::strong_rc_ptr<std::string>>::value,
4592 "check make_shared failed");
4601 void *
operator new(std::size_t n) {
4604 return ::operator
new(n);
4601 void *
operator new(std::size_t n) {
…}
4607 void operator delete(
void *p) {
4610 ::operator
delete(p);
4607 void operator delete(
void *p) {
…}
4618 explicit X(
int a1 = 0,
int a2 = 0,
int a3 = 0,
int a4 = 0,
int a5 = 0,
int a6 = 0,
int a7 = 0,
int a8 = 0,
int a9 = 0)
4619 :
v(a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9) {
4618 explicit X(
int a1 = 0,
int a2 = 0,
int a3 = 0,
int a4 = 0,
int a5 = 0,
int a6 = 0,
int a7 = 0,
int a8 = 0,
int a9 = 0) {
…}
4630 copp::memory::strong_rc_ptr<int> pi = copp::memory::allocate_strong_rc<int>(std::allocator<int>());
4637 copp::memory::strong_rc_ptr<int> pi = copp::memory::allocate_strong_rc<int>(std::allocator<int>(), 5);
4646 copp::memory::strong_rc_ptr<X> pi = copp::memory::allocate_strong_rc<X>(std::allocator<void>());
4647 copp::memory::weak_rc_ptr<X> wp(pi);
4659 copp::memory::strong_rc_ptr<X> pi = copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1);
4660 copp::memory::weak_rc_ptr<X> wp(pi);
4672 copp::memory::strong_rc_ptr<X> pi = copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2);
4673 copp::memory::weak_rc_ptr<X> wp(pi);
4685 copp::memory::strong_rc_ptr<X> pi = copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3);
4686 copp::memory::weak_rc_ptr<X> wp(pi);
4698 copp::memory::strong_rc_ptr<X> pi = copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3, 4);
4699 copp::memory::weak_rc_ptr<X> wp(pi);
4711 copp::memory::strong_rc_ptr<X> pi = copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3, 4, 5);
4712 copp::memory::weak_rc_ptr<X> wp(pi);
4724 copp::memory::strong_rc_ptr<X> pi = copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3, 4, 5, 6);
4725 copp::memory::weak_rc_ptr<X> wp(pi);
4737 copp::memory::strong_rc_ptr<X> pi =
4738 copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3, 4, 5, 6, 7);
4739 copp::memory::weak_rc_ptr<X> wp(pi);
4751 copp::memory::strong_rc_ptr<X> pi =
4752 copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3, 4, 5, 6, 7, 8);
4753 copp::memory::weak_rc_ptr<X> wp(pi);
4765 copp::memory::strong_rc_ptr<X> pi =
4766 copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3, 4, 5, 6, 7, 8, 9);
4767 copp::memory::weak_rc_ptr<X> wp(pi);
4781class X :
public copp::memory::enable_shared_rc_from_this<X> {
4789 explicit X(
int = 0,
int = 0,
int = 0,
int = 0,
int = 0,
int = 0,
int = 0,
int = 0,
int = 0) { ++
instances; }
4781class X :
public copp::memory::enable_shared_rc_from_this<X> {
…};
4800 copp::memory::strong_rc_ptr<X> px = copp::memory::allocate_strong_rc<X>(std::allocator<void>());
4802#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
4804 copp::memory::strong_rc_ptr<X> qx = px->shared_from_this();
4811 }
catch (std::bad_weak_ptr
const &) {
4822 copp::memory::strong_rc_ptr<X> px = copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1);
4824#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
4826 copp::memory::strong_rc_ptr<X> qx = px->shared_from_this();
4833 }
catch (std::bad_weak_ptr
const &) {
4842 copp::memory::strong_rc_ptr<X> px = copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2);
4844#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
4846 copp::memory::strong_rc_ptr<X> qx = px->shared_from_this();
4853 }
catch (std::bad_weak_ptr
const &) {
4862 copp::memory::strong_rc_ptr<X> px = copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3);
4864#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
4866 copp::memory::strong_rc_ptr<X> qx = px->shared_from_this();
4873 }
catch (std::bad_weak_ptr
const &) {
4882 copp::memory::strong_rc_ptr<X> px = copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3, 4);
4884#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
4886 copp::memory::strong_rc_ptr<X> qx = px->shared_from_this();
4893 }
catch (std::bad_weak_ptr
const &) {
4902 copp::memory::strong_rc_ptr<X> px = copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3, 4, 5);
4904#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
4906 copp::memory::strong_rc_ptr<X> qx = px->shared_from_this();
4913 }
catch (std::bad_weak_ptr
const &) {
4922 copp::memory::strong_rc_ptr<X> px = copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3, 4, 5, 6);
4924#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
4926 copp::memory::strong_rc_ptr<X> qx = px->shared_from_this();
4933 }
catch (std::bad_weak_ptr
const &) {
4942 copp::memory::strong_rc_ptr<X> px =
4943 copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3, 4, 5, 6, 7);
4945#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
4947 copp::memory::strong_rc_ptr<X> qx = px->shared_from_this();
4954 }
catch (std::bad_weak_ptr
const &) {
4963 copp::memory::strong_rc_ptr<X> px =
4964 copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3, 4, 5, 6, 7, 8);
4966#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
4968 copp::memory::strong_rc_ptr<X> qx = px->shared_from_this();
4975 }
catch (std::bad_weak_ptr
const &) {
4984 copp::memory::strong_rc_ptr<X> px =
4985 copp::memory::allocate_strong_rc<X>(std::allocator<void>(), 1, 2, 3, 4, 5, 6, 7, 8, 9);
4987#if defined(LIBCOPP_MACRO_ENABLE_EXCEPTION) && LIBCOPP_MACRO_ENABLE_EXCEPTION
4989 copp::memory::strong_rc_ptr<X> qx = px->shared_from_this();
4996 }
catch (std::bad_weak_ptr
const &) {
5006#if defined(__GNUC__) && !defined(__clang__) && !defined(__apple_build_version__)
5007# if (__GNUC__ * 100 + __GNUC_MINOR__ * 10) >= 460
5008# pragma GCC diagnostic pop
5010#elif defined(__clang__) || defined(__apple_build_version__)
5011# pragma clang diagnostic pop
X(int=0, int=0, int=0, int=0, int=0, int=0, int=0, int=0, int=0)
X(int a1=0, int a2=0, int a3=0, int a4=0, int a5=0, int a6=0, int a7=0, int a8=0, int a9=0)
X(int a1=0, int a2=0, int a3=0, int a4=0, int a5=0, int a6=0, int a7=0, int a8=0, int a9=0)
virtual copp::memory::strong_rc_ptr< X > getX()=0
copp::memory::strong_rc_ptr< X > getX() override
copp::memory::strong_rc_ptr< foo > m_self
void setWeak(copp::memory::strong_rc_ptr< foo > s)
copp::memory::weak_rc_ptr< foo > w
X_impl & operator=(X_impl const &)
copp::memory::strong_rc_ptr< T > base_type
void handle(int event) override
virtual void handle(int event)=0
smart_pointer_deleter(P const &p)
void operator()(void const *)
impl(char const *, char const *)
impl & operator=(impl const &)
void read(void *, int64_t size)
int64_t total_size() const
file(char const *name, char const *mode)
int64_t total_size() const
void read(void *data, int64_t size)
copp::memory::strong_rc_ptr< impl > pimpl_
static copp::memory::strong_rc_ptr< X > create()
virtual copp::memory::strong_rc_ptr< X > getX()=0
impl & operator=(impl const &)
static copp::memory::strong_rc_ptr< impl > create()
copp::memory::strong_rc_ptr< X > getX() override
copp::memory::weak_rc_ptr< impl > weak_this
copp::memory::strong_rc_ptr< Y > createY()
static void test_null_unique_ptr(std::unique_ptr< T, D > p1, std::unique_ptr< T, D > p2)
LIBCOPP_COPP_API_HEAD_ONLY void swap(LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr< T > &a, LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr< T > &b) noexcept
Support std::swap for strong_rc_ptr.
void conversion_assignment()
void default_constructor()
void weak_ptr_constructor()
void pointer_constructor()
void deleter_constructor()
void deleter(incomplete *)
copp::memory::strong_rc_ptr< X > createX()
void remove_event_handler()
another_ptr< event_handler > get_event_handler()
void install_event_handler(copp::memory::strong_rc_ptr< event_handler > p)
copp::memory::strong_rc_ptr< event_handler > current_handler
void handle_event(int event)
copp::memory::strong_rc_ptr< file > fopen(char const *name, char const *mode)
void fread(copp::memory::strong_rc_ptr< file > f, void *data, int64_t size)
void intrusive_ptr_release(X *p)
copp::memory::strong_rc_ptr< X > make_shared_from_intrusive(X *p)
void intrusive_ptr_add_ref(X *p)
void conversion_assignment()
void shared_ptr_assignment(copp::memory::strong_rc_ptr< U > &sp, T *=0)
void copy_assignment(copp::memory::strong_rc_ptr< T > &sp)
void default_constructor()
void conversion_constructor()
void shared_ptr_constructor()
void test2(copp::memory::strong_rc_ptr< U > &sp, T *=0)
copp::memory::strong_rc_ptr< incomplete > create_incomplete()
static bool owner_equal_comp(const L &l, const R &r) noexcept
static std::size_t get_owner_hash(const P &l) noexcept
static bool owner_before_comp(const L &l, const R &r) noexcept
void operator()(Y *p) const
void operator()(incomplete *p)
void operator()(void const *) const
copp::memory::strong_rc_ptr< X > next
#define CASE_EXPECT_EQ(l, r)
#define CASE_EXPECT_NE(l, r)
#define CASE_TEST(test_name, case_name)
#define CASE_EXPECT_TRUE(c)
#define CASE_EXPECT_ERROR(msg)