Rename template parameter to reduce chance of conflict
This commit is contained in:
parent
3a624ee65b
commit
771473b62a
@ -292,7 +292,7 @@ rcp<T> rcp_dynamic_cast(rcp<U> && other)
|
||||
{ \
|
||||
return rcp_ref_count.load(std::memory_order_relaxed); \
|
||||
} \
|
||||
template <typename T> friend class rcp; \
|
||||
template <typename RCP_T_> friend class rcp; \
|
||||
rcp_managed(classname)
|
||||
|
||||
#define rcp_managed(classname) \
|
||||
|
||||
22
tests.cpp
22
tests.cpp
@ -413,6 +413,27 @@ void test_hash()
|
||||
assert(map.find(c) == map.end());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct Box
|
||||
{
|
||||
rcp_managed_root(Box);
|
||||
protected:
|
||||
Box(T v) : v(v) {}
|
||||
public:
|
||||
T v;
|
||||
};
|
||||
|
||||
void test_class_template()
|
||||
{
|
||||
auto a = Box<int>::create(42);
|
||||
auto b = Box<int>::create(99);
|
||||
assert(a->v == 42);
|
||||
assert(b->v == 99);
|
||||
auto c = a;
|
||||
assert(c->v == 42);
|
||||
assert(c.use_count() == 2);
|
||||
}
|
||||
|
||||
void test_external_class()
|
||||
{
|
||||
int before = external_destruct;
|
||||
@ -454,6 +475,7 @@ int main(int argc, char * argv[])
|
||||
test_use_count();
|
||||
test_swap();
|
||||
test_hash();
|
||||
test_class_template();
|
||||
test_external_class();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user