get_deleter<> added.

[SVN r16365]
This commit is contained in:
Peter Dimov
2002-11-21 14:46:45 +00:00
parent c697e2ef21
commit 66a8e8b3c1
2 changed files with 25 additions and 0 deletions
+12
View File
@@ -275,6 +275,11 @@ public:
return pn < rhs.pn;
}
void * _internal_get_deleter(std::type_info const & ti) const
{
return pn.get_deleter(ti);
}
// Tasteless as this may seem, making all members public allows member templates
// to work in the absence of member template friends. (Matthew Langston)
@@ -364,6 +369,13 @@ template<class T> inline T * get_pointer(shared_ptr<T> const & p)
return p.get();
}
// get_deleter (experimental)
template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
{
return static_cast<D *>(p._internal_get_deleter(typeid(D)));
}
} // namespace boost
#ifdef BOOST_MSVC