mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-31 05:07:21 +02:00
Remove uses of detail::sp_forward
This commit is contained in:
@ -1,52 +0,0 @@
|
|||||||
#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_NO_CXX11_RVALUE_REFERENCES )
|
|
||||||
|
|
||||||
#if defined( BOOST_GCC ) && __GNUC__ * 100 + __GNUC_MINOR__ <= 404
|
|
||||||
|
|
||||||
// GCC 4.4 supports an outdated version of rvalue references and creates a copy of the forwarded object.
|
|
||||||
// This results in warnings 'returning reference to temporary'. Therefore we use a special version similar to std::forward.
|
|
||||||
template< class T > T&& sp_forward( T && t ) BOOST_NOEXCEPT
|
|
||||||
{
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT
|
|
||||||
{
|
|
||||||
return static_cast< T&& >( t );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace detail
|
|
||||||
|
|
||||||
} // namespace boost
|
|
||||||
|
|
||||||
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED
|
|
@ -11,14 +11,14 @@
|
|||||||
//
|
//
|
||||||
// See http://www.boost.org/libs/smart_ptr/ for documentation.
|
// See http://www.boost.org/libs/smart_ptr/ for documentation.
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||||
|
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
|
||||||
#include <boost/move/core.hpp>
|
#include <boost/move/core.hpp>
|
||||||
#include <boost/move/utility_core.hpp>
|
#include <boost/move/utility_core.hpp>
|
||||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
|
||||||
#include <boost/smart_ptr/detail/sp_forward.hpp>
|
|
||||||
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
|
|
||||||
#include <boost/type_traits/type_with_alignment.hpp>
|
#include <boost/type_traits/type_with_alignment.hpp>
|
||||||
#include <boost/type_traits/alignment_of.hpp>
|
#include <boost/type_traits/alignment_of.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <utility>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ template< class T, class... Args > typename boost::detail::sp_if_not_array< T >:
|
|||||||
|
|
||||||
void * pv = pd->address();
|
void * pv = pd->address();
|
||||||
|
|
||||||
::new( pv ) T( boost::detail::sp_forward<Args>( args )... );
|
::new( pv ) T( std::forward<Args>( args )... );
|
||||||
pd->set_initialized();
|
pd->set_initialized();
|
||||||
|
|
||||||
T * pt2 = static_cast< T* >( pv );
|
T * pt2 = static_cast< T* >( pv );
|
||||||
@ -274,11 +274,11 @@ template< class T, class A, class... Args > typename boost::detail::sp_if_not_ar
|
|||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
||||||
|
|
||||||
std::allocator_traits<A2>::construct( a2, static_cast< T* >( pv ), boost::detail::sp_forward<Args>( args )... );
|
std::allocator_traits<A2>::construct( a2, static_cast< T* >( pv ), std::forward<Args>( args )... );
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
::new( pv ) T( boost::detail::sp_forward<Args>( args )... );
|
::new( pv ) T( std::forward<Args>( args )... );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user