|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55293 - sandbox/fmhess/boost/generic_ptr
From: fmhess_at_[hidden]
Date: 2009-07-30 14:45:34
Author: fmhess
Date: 2009-07-30 14:26:45 EDT (Thu, 30 Jul 2009)
New Revision: 55293
URL: http://svn.boost.org/trac/boost/changeset/55293
Log:
Split pointer_cast.hpp out of pointer_traits.hpp, and added
default implementations of generic_ptr::static/const/dynamic_pointer_cast
which perform ADL internally.
Added:
sandbox/fmhess/boost/generic_ptr/pointer_cast.hpp (contents, props changed)
Text files modified:
sandbox/fmhess/boost/generic_ptr/pointer_traits.hpp | 17 -----------------
1 files changed, 0 insertions(+), 17 deletions(-)
Added: sandbox/fmhess/boost/generic_ptr/pointer_cast.hpp
==============================================================================
--- (empty file)
+++ sandbox/fmhess/boost/generic_ptr/pointer_cast.hpp 2009-07-30 14:26:45 EDT (Thu, 30 Jul 2009)
@@ -0,0 +1,57 @@
+//
+// generic_ptr/pointer_cast.hpp
+//
+// Copyright (c) 2009 Frank Mori Hess
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/generic_ptr for documentation.
+//
+
+#ifndef BOOST_GENERIC_PTR_POINTER_CAST_HPP_INCLUDED
+#define BOOST_GENERIC_PTR_POINTER_CAST_HPP_INCLUDED
+
+#include <boost/generic_ptr/pointer_traits.hpp>
+
+namespace boost
+{
+ namespace generic_ptr
+ {
+ // two-argument cast overloads for raw pointers
+ template<typename T, typename U>
+ T* static_pointer_cast(U *r, boost::mpl::identity<T>)
+ {
+ return static_cast<T*>(r);
+ }
+ template<typename T, typename U>
+ T* const_pointer_cast(U *r, boost::mpl::identity<T>)
+ {
+ return const_cast<T*>(r);
+ }
+ template<typename T, typename U>
+ T* dynamic_pointer_cast(U *r, boost::mpl::identity<T>)
+ {
+ return dynamic_cast<T*>(r);
+ }
+
+ template<typename ToValueType, typename U>
+ typename rebind<U, ToValueType>::other static_pointer_cast(const U &r)
+ {
+ return static_pointer_cast(r, mpl::identity<ToValueType>());
+ }
+ template<typename ToValueType, typename U>
+ typename rebind<U, ToValueType>::other const_pointer_cast(const U &r)
+ {
+ return const_pointer_cast(r, mpl::identity<ToValueType>());
+ }
+ template<typename ToValueType, typename U>
+ typename rebind<U, ToValueType>::other dynamic_pointer_cast(const U &r)
+ {
+ return dynamic_pointer_cast(r, mpl::identity<ToValueType>());
+ }
+ } // namespace generic_ptr
+} // namespace boost
+
+#endif // #ifndef BOOST_GENERIC_PTR_POINTER_CAST_HPP_INCLUDED
Modified: sandbox/fmhess/boost/generic_ptr/pointer_traits.hpp
==============================================================================
--- sandbox/fmhess/boost/generic_ptr/pointer_traits.hpp (original)
+++ sandbox/fmhess/boost/generic_ptr/pointer_traits.hpp 2009-07-30 14:26:45 EDT (Thu, 30 Jul 2009)
@@ -105,23 +105,6 @@
return get_plain_old_pointer(get_pointer(gp));
}
- // 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>)
- {
- return static_cast<T*>(r);
- }
- template<typename T, typename U>
- T* const_pointer_cast(U *r, boost::mpl::identity<T>)
- {
- return const_cast<T*>(r);
- }
- template<typename T, typename U>
- T* dynamic_pointer_cast(U *r, boost::mpl::identity<T>)
- {
- return dynamic_cast<T*>(r);
- }
-
template<typename GenericPtr, typename ValueType>
struct rebind
{
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