diff --git a/include/rcp.h b/include/rcp.h index d49a156..9d33a6a 100644 --- a/include/rcp.h +++ b/include/rcp.h @@ -246,6 +246,12 @@ namespace std return hash()(static_cast(p.get_raw())); } }; + + template + void swap(rcp & a, rcp & b) noexcept + { + a.swap(b); + } } template diff --git a/tests.cpp b/tests.cpp index 6bd55a3..1ca8d0c 100644 --- a/tests.cpp +++ b/tests.cpp @@ -376,6 +376,9 @@ void test_swap() a.swap(b); assert(a->x == 3); assert(b->x == 1); + std::swap(a, b); + assert(a->x == 1); + assert(b->x == 3); } void test_hash()