Replace std::forward with detail::sp_forward.

[SVN r81399]
This commit is contained in:
Peter Dimov
2012-11-17 16:21:41 +00:00
parent cf769b94a7
commit 94b6487ca1
4 changed files with 46 additions and 13 deletions

View File

@ -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 @@ namespace boost {
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 @@ namespace boost {
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

View File

@ -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

View File

@ -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 @@ namespace boost {
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 @@ namespace boost {
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

View File

@ -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 @@ 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;