get_deleter_test added; associated fixes.

[SVN r16373]
This commit is contained in:
Peter Dimov
2002-11-22 16:29:51 +00:00
parent ea285b4231
commit fadc0716ce
2 changed files with 95 additions and 0 deletions
+14
View File
@@ -373,11 +373,25 @@ template<class T> inline T * get_pointer(shared_ptr<T> const & p)
// get_deleter (experimental)
#if defined(__GNUC__) && (__GNUC__ < 3)
// g++ 2.9x doesn't allow static_cast<X const *>(void *)
template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
{
void const * q = p._internal_get_deleter(typeid(D));
return const_cast<D *>(static_cast<D const *>(q));
}
#else
template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
{
return static_cast<D *>(p._internal_get_deleter(typeid(D)));
}
#endif
} // namespace boost
#ifdef BOOST_MSVC