Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:54

0001 //////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga 2012-2012.
0004 // Distributed under the Boost Software License, Version 1.0.
0005 // (See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // See http://www.boost.org/libs/move for documentation.
0009 //
0010 //////////////////////////////////////////////////////////////////////////////
0011 
0012 //! \file
0013 //! This header includes core utilities from <tt><boost/move/utility_core.hpp></tt> and defines
0014 //! some more advanced utilities such as:
0015 
0016 #ifndef BOOST_MOVE_MOVE_UTILITY_HPP
0017 #define BOOST_MOVE_MOVE_UTILITY_HPP
0018 
0019 #ifndef BOOST_CONFIG_HPP
0020 #  include <boost/config.hpp>
0021 #endif
0022 #
0023 #if defined(BOOST_HAS_PRAGMA_ONCE)
0024 #  pragma once
0025 #endif
0026 
0027 #include <boost/move/detail/config_begin.hpp>
0028 #include <boost/move/detail/workaround.hpp>  //forceinline
0029 #include <boost/move/utility_core.hpp>
0030 #include <boost/move/traits.hpp>
0031 
0032 #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
0033 
0034    namespace boost {
0035 
0036    //////////////////////////////////////////////////////////////////////////////
0037    //
0038    //                            move_if_noexcept()
0039    //
0040    //////////////////////////////////////////////////////////////////////////////
0041 
0042    template <class T>
0043    BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
0044       < enable_move_utility_emulation<T>::value && !has_move_emulation_enabled<T>::value
0045       , typename ::boost::move_detail::add_const<T>::type &
0046       >::type
0047          move_if_noexcept(T& x) BOOST_NOEXCEPT
0048    {
0049       return x;
0050    }
0051 
0052    template <class T>
0053    BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
0054       < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value
0055             && ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value, rv<T>&>::type
0056          move_if_noexcept(T& x) BOOST_NOEXCEPT
0057    {
0058       return *static_cast<rv<T>* >(::boost::move_detail::addressof(x));
0059    }
0060 
0061    template <class T>
0062    BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
0063       < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value
0064             && ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value
0065       , rv<T>&
0066       >::type
0067          move_if_noexcept(rv<T>& x) BOOST_NOEXCEPT
0068    {
0069       return x;
0070    }
0071 
0072    template <class T>
0073    BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
0074       < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value
0075             && !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value
0076       , typename ::boost::move_detail::add_const<T>::type &
0077       >::type
0078          move_if_noexcept(T& x) BOOST_NOEXCEPT
0079    {
0080       return x;
0081    }
0082 
0083    template <class T>
0084    BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
0085       < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value
0086             && !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value
0087       , typename ::boost::move_detail::add_const<T>::type &
0088       >::type
0089          move_if_noexcept(rv<T>& x) BOOST_NOEXCEPT
0090    {
0091       return x;
0092    }
0093 
0094    }  //namespace boost
0095 
0096 #else    //#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
0097 
0098    #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
0099       #include <utility>
0100 
0101       namespace boost{
0102 
0103       using ::std::move_if_noexcept;
0104 
0105       }  //namespace boost
0106 
0107    #else //!BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE
0108 
0109       namespace boost {
0110 
0111       //////////////////////////////////////////////////////////////////////////////
0112       //
0113       //                            move_if_noexcept()
0114       //
0115       //////////////////////////////////////////////////////////////////////////////
0116       #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
0117          //! This function provides a way to convert a reference into a rvalue reference
0118          //! in compilers with rvalue references. For other compilers converts T & into
0119          //! <i>::boost::rv<T> &</i> so that move emulation is activated. Reference
0120          //! would be converted to rvalue reference only if input type is nothrow move
0121          //! constructible or if it has no copy constructor. In all other cases const
0122          //! reference would be returned
0123          template <class T>
0124          rvalue_reference_or_const_lvalue_reference move_if_noexcept(input_reference) noexcept;
0125 
0126       #else //BOOST_MOVE_DOXYGEN_INVOKED
0127 
0128          template <class T>
0129          BOOST_MOVE_INTRINSIC_CAST typename ::boost::move_detail::enable_if_c
0130             < ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value, T&&>::type
0131                move_if_noexcept(T& x) BOOST_NOEXCEPT
0132          {  return ::boost::move(x);   }
0133 
0134          template <class T>
0135          BOOST_MOVE_INTRINSIC_CAST typename ::boost::move_detail::enable_if_c
0136             < !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value, const T&>::type
0137                move_if_noexcept(T& x) BOOST_NOEXCEPT
0138          {  return x;  }
0139 
0140       #endif //BOOST_MOVE_DOXYGEN_INVOKED
0141 
0142       }  //namespace boost {
0143 
0144    #endif   //#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
0145 
0146 #endif   //BOOST_NO_CXX11_RVALUE_REFERENCES
0147 
0148 #include <boost/move/detail/config_end.hpp>
0149 
0150 #endif //#ifndef BOOST_MOVE_MOVE_UTILITY_HPP