1 #ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED 2 #define BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED 3 4 // MS compatible compilers support #pragma once 5 6 #if defined(_MSC_VER) && (_MSC_VER >= 1020) 7 # pragma once 8 #endif 9 10 // detail/sp_forward.hpp 11 // 12 // Copyright 2008,2012 Peter Dimov 13 // 14 // Distributed under the Boost Software License, Version 1.0. 15 // See accompanying file LICENSE_1_0.txt or copy at 16 // http://www.boost.org/LICENSE_1_0.txt 17 18 #include <boost/config.hpp> 19 20 namespace boost 21 { 22 23 namespace detail 24 { 25 26 #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) 27 28 #if defined( BOOST_GCC ) && __GNUC__ * 100 + __GNUC_MINOR__ <= 404 29 30 // GCC 4.4 supports an outdated version of rvalue references and creates a copy of the forwarded object. 31 // This results in warnings 'returning reference to temporary'. Therefore we use a special version similar to std::forward. sp_forward(T && t)32template< class T > T&& sp_forward( T && t ) BOOST_NOEXCEPT 33 { 34 return t; 35 } 36 37 #else 38 39 template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT 40 { 41 return static_cast< T&& >( t ); 42 } 43 44 #endif 45 46 #endif 47 48 } // namespace detail 49 50 } // namespace boost 51 52 #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED 53