Added a default constructor to shared_count and shared_ptr for incomplete types (void).

[SVN r12815]
This commit is contained in:
Peter Dimov
2002-02-15 13:31:58 +00:00
parent 5e2f514140
commit 5a6cd1cf3e
3 changed files with 57 additions and 14 deletions
+12 -3
View File
@@ -81,7 +81,11 @@ public:
typedef T element_type;
explicit shared_ptr(T * p = 0): px(p), pn(p, deleter())
shared_ptr(): px(0), pn()
{
}
explicit shared_ptr(T * p): px(p), pn(p, deleter()) // requires complete type
{
}
@@ -157,9 +161,14 @@ public:
#endif
void reset(T * p = 0)
void reset()
{
BOOST_ASSERT(p == 0 || p != px);
this_type().swap(*this);
}
void reset(T * p) // requires complete type
{
BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors
this_type(p).swap(*this);
}