From 94b6487ca16ffcd8eeda7c066b510db0e80fae84 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 17 Nov 2012 16:21:41 +0000 Subject: [PATCH] Replace std::forward with detail::sp_forward. [SVN r81399] --- .../boost/smart_ptr/allocate_shared_array.hpp | 5 ++- include/boost/smart_ptr/detail/sp_forward.hpp | 39 +++++++++++++++++++ include/boost/smart_ptr/make_shared_array.hpp | 5 ++- .../boost/smart_ptr/make_shared_object.hpp | 10 +---- 4 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 include/boost/smart_ptr/detail/sp_forward.hpp diff --git a/include/boost/smart_ptr/allocate_shared_array.hpp b/include/boost/smart_ptr/allocate_shared_array.hpp index 904902c..3c45b1c 100644 --- a/include/boost/smart_ptr/allocate_shared_array.hpp +++ b/include/boost/smart_ptr/allocate_shared_array.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include #endif @@ -51,7 +52,7 @@ namespace boost { detail::array_deleter* d2; p1 = reinterpret_cast(p2); d2 = get_deleter >(s1); - d2->construct(p2, n1, std::forward(args)...); + d2->construct(p2, n1, boost::detail::sp_forward(args)...); return shared_ptr(s1, p1); } template @@ -68,7 +69,7 @@ namespace boost { detail::array_deleter* d2; p1 = reinterpret_cast(p2); d2 = get_deleter >(s1); - d2->construct(p2, n1, std::forward(args)...); + d2->construct(p2, n1, boost::detail::sp_forward(args)...); return shared_ptr(s1, p1); } #endif diff --git a/include/boost/smart_ptr/detail/sp_forward.hpp b/include/boost/smart_ptr/detail/sp_forward.hpp new file mode 100644 index 0000000..25c4d48 --- /dev/null +++ b/include/boost/smart_ptr/detail/sp_forward.hpp @@ -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 + +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 diff --git a/include/boost/smart_ptr/make_shared_array.hpp b/include/boost/smart_ptr/make_shared_array.hpp index 70083b1..110ee34 100644 --- a/include/boost/smart_ptr/make_shared_array.hpp +++ b/include/boost/smart_ptr/make_shared_array.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include #endif @@ -51,7 +52,7 @@ namespace boost { detail::array_deleter* d2; p1 = reinterpret_cast(p2); d2 = get_deleter >(s1); - d2->construct(p2, n1, std::forward(args)...); + d2->construct(p2, n1, boost::detail::sp_forward(args)...); return shared_ptr(s1, p1); } template @@ -68,7 +69,7 @@ namespace boost { detail::array_deleter* d2; p1 = reinterpret_cast(p2); d2 = get_deleter >(s1); - d2->construct(p2, n1, std::forward(args)...); + d2->construct(p2, n1, boost::detail::sp_forward(args)...); return shared_ptr(s1, p1); } #endif diff --git a/include/boost/smart_ptr/make_shared_object.hpp b/include/boost/smart_ptr/make_shared_object.hpp index 3f4cac7..1a9d769 100644 --- a/include/boost/smart_ptr/make_shared_object.hpp +++ b/include/boost/smart_ptr/make_shared_object.hpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -97,15 +98,6 @@ public: } }; -#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;