|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55079 - sandbox/fmhess/boost/smart_ptr
From: fmhess_at_[hidden]
Date: 2009-07-22 09:52:34
Author: fmhess
Date: 2009-07-22 09:52:33 EDT (Wed, 22 Jul 2009)
New Revision: 55079
URL: http://svn.boost.org/trac/boost/changeset/55079
Log:
Got rid of is_null_pointer, as it is not needed now that we have
get_plain_old_pointer.
Text files modified:
sandbox/fmhess/boost/smart_ptr/enable_generic_shared_from_this.hpp | 4 ++--
sandbox/fmhess/boost/smart_ptr/generic_shared.hpp | 34 ++++++++--------------------------
2 files changed, 10 insertions(+), 28 deletions(-)
Modified: sandbox/fmhess/boost/smart_ptr/enable_generic_shared_from_this.hpp
==============================================================================
--- sandbox/fmhess/boost/smart_ptr/enable_generic_shared_from_this.hpp (original)
+++ sandbox/fmhess/boost/smart_ptr/enable_generic_shared_from_this.hpp 2009-07-22 09:52:33 EDT (Wed, 22 Jul 2009)
@@ -48,14 +48,14 @@
generic_shared<T> shared_from_this()
{
generic_shared<T> p( weak_this_ );
- BOOST_ASSERT( p.get() == this );
+ BOOST_ASSERT( get_plain_old_pointer(p) == this );
return p;
}
//FIXME: yikes! we need to make it easier to add/remove const from a generic pointer's value_type
typename generic_shared<T>::template rebind<typename generic_shared<T>::value_type const>::other shared_from_this() const
{
typename generic_shared<T>::template rebind<typename generic_shared<T>::value_type const>::other p( weak_this_ );
- BOOST_ASSERT( p.get() == this );
+ BOOST_ASSERT( get_plain_old_pointer(p) == this );
return p;
}
Modified: sandbox/fmhess/boost/smart_ptr/generic_shared.hpp
==============================================================================
--- sandbox/fmhess/boost/smart_ptr/generic_shared.hpp (original)
+++ sandbox/fmhess/boost/smart_ptr/generic_shared.hpp 2009-07-22 09:52:33 EDT (Wed, 22 Jul 2009)
@@ -19,7 +19,6 @@
// Must be either ordinary pointer, or provide:
// operator->() and operator*()
// value_type/reference/pointer member typedefs (or specialization of boost::generic_pointer_traits)
-// is_null_pointer() free function findable by ADL
// (in)equality comparison
// 2 argument static/const/dynamic_pointer_cast findable by ADL if you want support for casting
// get_pointer support
@@ -146,15 +145,6 @@
return get_plain_old_pointer(get_pointer(gp));
}
-template<typename T> bool is_null_pointer(const generic_shared<T> &p)
-{
- return !p;
-}
-template<typename T> bool is_null_pointer(T * p)
-{
- return p == 0;
-}
-
// two-argument cast overloads for raw pointers (really belongs in boost/pointer_cast.hpp)
template<typename T, typename U>
T* static_pointer_cast(U *r, boost::mpl::identity<T>)
@@ -360,8 +350,7 @@
px(dynamic_pointer_cast(r.px, boost::mpl::identity<value_type>())),
pn(r.pn)
{
- using boost::is_null_pointer;
- if(is_null_pointer(px)) // need to allocate new counter -- the cast failed
+ if(get_plain_old_pointer(px) == 0) // need to allocate new counter -- the cast failed
{
pn = boost::detail::shared_count();
}
@@ -502,15 +491,13 @@
reference operator* () const // never throws
{
- using boost::is_null_pointer;
- BOOST_ASSERT(!is_null_pointer(px));
+ BOOST_ASSERT(get_plain_old_pointer(px));
return *px;
}
pointer operator-> () const // never throws
{
- using boost::is_null_pointer;
- BOOST_ASSERT(!is_null_pointer(px));
+ BOOST_ASSERT(get_plain_old_pointer(px));
return px;
}
@@ -535,8 +522,7 @@
operator bool () const
{
- using boost::is_null_pointer;
- return !is_null_pointer(px);
+ return get_plain_old_pointer(px) != 0;
}
#elif defined( _MANAGED )
@@ -549,8 +535,7 @@
operator unspecified_bool_type() const // never throws
{
- using boost::is_null_pointer;
- return is_null_pointer(px) ? 0: unspecified_bool;
+ return get_plain_old_pointer(px) == 0 ? 0: unspecified_bool;
}
#elif \
@@ -562,8 +547,7 @@
operator unspecified_bool_type() const // never throws
{
- using boost::is_null_pointer;
- return is_null_pointer(px) ? 0: &this_type::get;
+ return get_plain_old_pointer(px) == 0 ? 0: &this_type::get;
}
#else
@@ -572,8 +556,7 @@
operator unspecified_bool_type() const // never throws
{
- using boost::is_null_pointer;
- return is_null_pointer(px) ? 0: &this_type::px;
+ return get_plain_old_pointer(px) == 0 ? 0: &this_type::px;
}
#endif
@@ -581,8 +564,7 @@
// operator! is redundant, but some compilers need it
bool operator! () const // never throws
{
- using boost::is_null_pointer;
- return is_null_pointer(px);
+ return get_plain_old_pointer(px) == 0;
}
#endif // end implicit conversion to "bool" support
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk