forked from boostorg/smart_ptr
Replace std::forward with detail::sp_forward.
[SVN r81399]
This commit is contained in:
@ -14,6 +14,7 @@
|
|||||||
#include <boost/smart_ptr/detail/array_deleter.hpp>
|
#include <boost/smart_ptr/detail/array_deleter.hpp>
|
||||||
#include <boost/smart_ptr/detail/array_traits.hpp>
|
#include <boost/smart_ptr/detail/array_traits.hpp>
|
||||||
#include <boost/smart_ptr/detail/sp_if_array.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)
|
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#endif
|
#endif
|
||||||
@ -51,7 +52,7 @@ namespace boost {
|
|||||||
detail::array_deleter<T2>* d2;
|
detail::array_deleter<T2>* d2;
|
||||||
p1 = reinterpret_cast<T1*>(p2);
|
p1 = reinterpret_cast<T1*>(p2);
|
||||||
d2 = get_deleter<detail::array_deleter<T2> >(s1);
|
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);
|
return shared_ptr<T>(s1, p1);
|
||||||
}
|
}
|
||||||
template<typename T, typename A, typename... Args>
|
template<typename T, typename A, typename... Args>
|
||||||
@ -68,7 +69,7 @@ namespace boost {
|
|||||||
detail::array_deleter<T2>* d2;
|
detail::array_deleter<T2>* d2;
|
||||||
p1 = reinterpret_cast<T1*>(p2);
|
p1 = reinterpret_cast<T1*>(p2);
|
||||||
d2 = get_deleter<detail::array_deleter<T2> >(s1);
|
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);
|
return shared_ptr<T>(s1, p1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
39
include/boost/smart_ptr/detail/sp_forward.hpp
Normal file
39
include/boost/smart_ptr/detail/sp_forward.hpp
Normal 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
|
@ -14,6 +14,7 @@
|
|||||||
#include <boost/smart_ptr/detail/array_traits.hpp>
|
#include <boost/smart_ptr/detail/array_traits.hpp>
|
||||||
#include <boost/smart_ptr/detail/make_array_helper.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_if_array.hpp>
|
||||||
|
#include <boost/smart_ptr/detail/sp_forward.hpp>
|
||||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#endif
|
#endif
|
||||||
@ -51,7 +52,7 @@ namespace boost {
|
|||||||
detail::array_deleter<T2>* d2;
|
detail::array_deleter<T2>* d2;
|
||||||
p1 = reinterpret_cast<T1*>(p2);
|
p1 = reinterpret_cast<T1*>(p2);
|
||||||
d2 = get_deleter<detail::array_deleter<T2> >(s1);
|
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);
|
return shared_ptr<T>(s1, p1);
|
||||||
}
|
}
|
||||||
template<typename T, typename... Args>
|
template<typename T, typename... Args>
|
||||||
@ -68,7 +69,7 @@ namespace boost {
|
|||||||
detail::array_deleter<T2>* d2;
|
detail::array_deleter<T2>* d2;
|
||||||
p1 = reinterpret_cast<T1*>(p2);
|
p1 = reinterpret_cast<T1*>(p2);
|
||||||
d2 = get_deleter<detail::array_deleter<T2> >(s1);
|
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);
|
return shared_ptr<T>(s1, p1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/smart_ptr/shared_ptr.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/type_with_alignment.hpp>
|
||||||
#include <boost/type_traits/alignment_of.hpp>
|
#include <boost/type_traits/alignment_of.hpp>
|
||||||
#include <cstddef>
|
#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
|
template< class T > struct sp_if_not_array
|
||||||
{
|
{
|
||||||
typedef boost::shared_ptr< T > type;
|
typedef boost::shared_ptr< T > type;
|
||||||
|
Reference in New Issue
Block a user