Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81399 - in trunk/boost/smart_ptr: . detail
From: pdimov_at_[hidden]
Date: 2012-11-17 11:21:41


Author: pdimov
Date: 2012-11-17 11:21:41 EST (Sat, 17 Nov 2012)
New Revision: 81399
URL: http://svn.boost.org/trac/boost/changeset/81399

Log:
Replace std::forward with detail::sp_forward.
Added:
   trunk/boost/smart_ptr/detail/sp_forward.hpp (contents, props changed)
Text files modified:
   trunk/boost/smart_ptr/allocate_shared_array.hpp | 5 +++--
   trunk/boost/smart_ptr/make_shared_array.hpp | 5 +++--
   trunk/boost/smart_ptr/make_shared_object.hpp | 10 +---------
   3 files changed, 7 insertions(+), 13 deletions(-)

Modified: trunk/boost/smart_ptr/allocate_shared_array.hpp
==============================================================================
--- trunk/boost/smart_ptr/allocate_shared_array.hpp (original)
+++ trunk/boost/smart_ptr/allocate_shared_array.hpp 2012-11-17 11:21:41 EST (Sat, 17 Nov 2012)
@@ -14,6 +14,7 @@
 #include <boost/smart_ptr/detail/array_deleter.hpp>
 #include <boost/smart_ptr/detail/array_traits.hpp>
 #include <boost/smart_ptr/detail/sp_if_array.hpp>
+#include <boost/smart_ptr/detail/sp_forward.hpp>
 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
 #include <initializer_list>
 #endif
@@ -51,7 +52,7 @@
         detail::array_deleter<T2>* d2;
         p1 = reinterpret_cast<T1*>(p2);
         d2 = get_deleter<detail::array_deleter<T2> >(s1);
- d2->construct(p2, n1, std::forward<Args>(args)...);
+ d2->construct(p2, n1, boost::detail::sp_forward<Args>(args)...);
         return shared_ptr<T>(s1, p1);
     }
     template<typename T, typename A, typename... Args>
@@ -68,7 +69,7 @@
         detail::array_deleter<T2>* d2;
         p1 = reinterpret_cast<T1*>(p2);
         d2 = get_deleter<detail::array_deleter<T2> >(s1);
- d2->construct(p2, n1, std::forward<Args>(args)...);
+ d2->construct(p2, n1, boost::detail::sp_forward<Args>(args)...);
         return shared_ptr<T>(s1, p1);
     }
 #endif

Added: trunk/boost/smart_ptr/detail/sp_forward.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/smart_ptr/detail/sp_forward.hpp 2012-11-17 11:21:41 EST (Sat, 17 Nov 2012)
@@ -0,0 +1,39 @@
+#ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED
+#define BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+// detail/sp_forward.hpp
+//
+// Copyright 2008,2012 Peter Dimov
+//
+// 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
+
+#include <boost/config.hpp>
+
+namespace boost
+{
+
+namespace detail
+{
+
+#if defined( BOOST_HAS_RVALUE_REFS )
+
+template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT
+{
+ return static_cast< T&& >( t );
+}
+
+#endif
+
+} // namespace detail
+
+} // namespace boost
+
+#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED

Modified: trunk/boost/smart_ptr/make_shared_array.hpp
==============================================================================
--- trunk/boost/smart_ptr/make_shared_array.hpp (original)
+++ trunk/boost/smart_ptr/make_shared_array.hpp 2012-11-17 11:21:41 EST (Sat, 17 Nov 2012)
@@ -14,6 +14,7 @@
 #include <boost/smart_ptr/detail/array_traits.hpp>
 #include <boost/smart_ptr/detail/make_array_helper.hpp>
 #include <boost/smart_ptr/detail/sp_if_array.hpp>
+#include <boost/smart_ptr/detail/sp_forward.hpp>
 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
 #include <initializer_list>
 #endif
@@ -51,7 +52,7 @@
         detail::array_deleter<T2>* d2;
         p1 = reinterpret_cast<T1*>(p2);
         d2 = get_deleter<detail::array_deleter<T2> >(s1);
- d2->construct(p2, n1, std::forward<Args>(args)...);
+ d2->construct(p2, n1, boost::detail::sp_forward<Args>(args)...);
         return shared_ptr<T>(s1, p1);
     }
     template<typename T, typename... Args>
@@ -68,7 +69,7 @@
         detail::array_deleter<T2>* d2;
         p1 = reinterpret_cast<T1*>(p2);
         d2 = get_deleter<detail::array_deleter<T2> >(s1);
- d2->construct(p2, n1, std::forward<Args>(args)...);
+ d2->construct(p2, n1, boost::detail::sp_forward<Args>(args)...);
         return shared_ptr<T>(s1, p1);
     }
 #endif

Modified: trunk/boost/smart_ptr/make_shared_object.hpp
==============================================================================
--- trunk/boost/smart_ptr/make_shared_object.hpp (original)
+++ trunk/boost/smart_ptr/make_shared_object.hpp 2012-11-17 11:21:41 EST (Sat, 17 Nov 2012)
@@ -14,6 +14,7 @@
 
 #include <boost/config.hpp>
 #include <boost/smart_ptr/shared_ptr.hpp>
+#include <boost/smart_ptr/detail/sp_forward.hpp>
 #include <boost/type_traits/type_with_alignment.hpp>
 #include <boost/type_traits/alignment_of.hpp>
 #include <cstddef>
@@ -97,15 +98,6 @@
     }
 };
 
-#if defined( BOOST_HAS_RVALUE_REFS )
-
-template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT
-{
- return static_cast< T&& >( t );
-}
-
-#endif
-
 template< class T > struct sp_if_not_array
 {
     typedef boost::shared_ptr< T > type;


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