Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55231 - sandbox/fmhess/boost/generic_ptr
From: fmhess_at_[hidden]
Date: 2009-07-30 14:44:04


Author: fmhess
Date: 2009-07-28 10:09:30 EDT (Tue, 28 Jul 2009)
New Revision: 55231
URL: http://svn.boost.org/trac/boost/changeset/55231

Log:
Fixed get_pointer() return type and ADL casts for generic_ptr::intrusive
(untested).

Text files modified:
   sandbox/fmhess/boost/generic_ptr/intrusive.hpp | 26 +++++++++++++++++++-------
   1 files changed, 19 insertions(+), 7 deletions(-)

Modified: sandbox/fmhess/boost/generic_ptr/intrusive.hpp
==============================================================================
--- sandbox/fmhess/boost/generic_ptr/intrusive.hpp (original)
+++ sandbox/fmhess/boost/generic_ptr/intrusive.hpp 2009-07-28 10:09:30 EDT (Tue, 28 Jul 2009)
@@ -237,24 +237,36 @@
 
 // mem_fn support
 
-template<class T> T * get_pointer(intrusive<T> const & p)
+template<class T> T get_pointer(intrusive<T> const & p)
 {
     return p.get();
 }
 
-template<class T, class U> intrusive<T> static_pointer_cast(intrusive<U> const & p)
+template<class ToValueType, class U> intrusive<T> static_pointer_cast
+(
+ intrusive<U> const & p,
+ mpl::identity<ToValueType> to_type_iden = mpl::identity<ToValueType>()
+)
 {
- return static_cast<T *>(p.get());
+ return static_pointer_cast(p.get(), to_type_iden);
 }
 
-template<class T, class U> intrusive<T> const_pointer_cast(intrusive<U> const & p)
+template<class ToValueType, class U> intrusive<T> const_pointer_cast
+(
+ intrusive<U> const & p,
+ mpl::identity<ToValueType> to_type_iden = mpl::identity<ToValueType>()
+)
 {
- return const_cast<T *>(p.get());
+ return const_pointer_cast(p.get(), to_type_iden);
 }
 
-template<class T, class U> intrusive<T> dynamic_pointer_cast(intrusive<U> const & p)
+template<class ToValueType, class U> intrusive<T> dynamic_pointer_cast
+(
+ intrusive<U> const & p,
+ mpl::identity<ToValueType> to_type_iden = mpl::identity<ToValueType>()
+)
 {
- return dynamic_cast<T *>(p.get());
+ return dynamic_pointer_cast(p.get(), to_type_iden);
 }
 
 // operator<<


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