Compare commits
No commits in common. "main" and "v1.0.0" have entirely different histories.
@ -23,7 +23,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cstddef>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
@ -60,16 +59,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rcp & operator=(nullptr_t) noexcept
|
|
||||||
{
|
|
||||||
if (ptr)
|
|
||||||
{
|
|
||||||
ptr->rcp_dec();
|
|
||||||
ptr = nullptr;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
rcp & operator=(const rcp & other)
|
rcp & operator=(const rcp & other)
|
||||||
{
|
{
|
||||||
if (ptr != other.ptr)
|
if (ptr != other.ptr)
|
||||||
|
|||||||
20
tests.cpp
20
tests.cpp
@ -448,25 +448,6 @@ void test_external_class()
|
|||||||
assert(external_destruct == before + 2);
|
assert(external_destruct == before + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_assign_nullptr()
|
|
||||||
{
|
|
||||||
int constructed_before = mybase_construct;
|
|
||||||
int destructed_before = mybase_destruct;
|
|
||||||
{
|
|
||||||
rcp<MyBase> base = MyBase::create(6, 6);
|
|
||||||
assert(mybase_construct == constructed_before + 1);
|
|
||||||
assert(mybase_destruct == destructed_before);
|
|
||||||
base = nullptr;
|
|
||||||
assert(mybase_construct == constructed_before + 1);
|
|
||||||
assert(mybase_destruct == destructed_before + 1);
|
|
||||||
base = nullptr;
|
|
||||||
assert(mybase_construct == constructed_before + 1);
|
|
||||||
assert(mybase_destruct == destructed_before + 1);
|
|
||||||
}
|
|
||||||
assert(mybase_construct == constructed_before + 1);
|
|
||||||
assert(mybase_destruct == destructed_before + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char * argv[])
|
int main(int argc, char * argv[])
|
||||||
{
|
{
|
||||||
test_class_hierarchy();
|
test_class_hierarchy();
|
||||||
@ -496,6 +477,5 @@ int main(int argc, char * argv[])
|
|||||||
test_hash();
|
test_hash();
|
||||||
test_class_template();
|
test_class_template();
|
||||||
test_external_class();
|
test_external_class();
|
||||||
test_assign_nullptr();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user