Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-08 08:10:48

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 ">#
0024 #if defined(BOOST_HAS_PRAGMA_ONCE)
0025 #  pragma once
0026 #endif
0027 
0028 #include <boost/move/detail/config_begin.hpp>
0029 #include <boost/move/detail/workaround.hpp>  //forceinline
0030 #include <boost/move/utility_core.hpp>
0031 #include <boost/move/traits.hpp>
0032 
0033 #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
0034 
0035    namespace boost {
0036 
0037    //////////////////////////////////////////////////////////////////////////////
0038    //
0039    //                            move_if_noexcept()
0040    //
0041    //////////////////////////////////////////////////////////////////////////////
0042 
0043    template <class T>
0044    BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
0045       < enable_move_utility_emulation<T>::value && !has_move_emulation_enabled<T>::value
0046       , typename ::boost::move_detail::add_const<T>::type &
0047       >::type
0048          move_if_noexcept(T& x) BOOST_NOEXCEPT
0049    {
0050       return x;
0051    }
0052 
0053    template <class T>
0054    BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
0055       < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value
0056             && ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value, rv<T>&>::type
0057          move_if_noexcept(T& x) BOOST_NOEXCEPT
0058    {
0059       return *static_cast<rv<T>* >(::boost::move_detail::addressof(x));
0060    }
0061 
0062    template <class T>
0063    BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
0064       < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value
0065             && ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value
0066       , rv<T>&
0067       >::type
0068          move_if_noexcept(rv<T>& x) BOOST_NOEXCEPT
0069    {
0070       return x;
0071    }
0072 
0073    template <class T>
0074    BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
0075       < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value
0076             && !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value
0077       , typename ::boost::move_detail::add_const<T>::type &
0078       >::type
0079          move_if_noexcept(T& x) BOOST_NOEXCEPT
0080    {
0081       return x;
0082    }
0083 
0084    template <class T>
0085    BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
0086       < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value
0087             && !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value
0088       , typename ::boost::move_detail::add_const<T>::type &
0089       >::type
0090          move_if_noexcept(rv<T>& x) BOOST_NOEXCEPT
0091    {
0092       return x;
0093    }
0094 
0095    }  //namespace boost
0096 
0097 #else    //#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
0098 
0099    #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
0100       #include <utility>
0101 
0102       namespace boost{
0103 
0104       using ::std::move_if_noexcept;
0105 
0106       }  //namespace boost
0107 
0108    #else //!BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE
0109 
0110       namespace boost {
0111 
0112       //////////////////////////////////////////////////////////////////////////////
0113       //
0114       //                            move_if_noexcept()
0115       //
0116       //////////////////////////////////////////////////////////////////////////////
0117       #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
0118          //! This function provides a way to convert a reference into a rvalue reference
0119          //! in compilers with rvalue references. For other compilers converts T & into
0120          //! <i>::boost::rv<T> &</i> so that move emulation is activated. Reference
0121          //! would be converted to rvalue reference only if input type is nothrow move
0122          //! constructible or if it has no copy constructor. In all other cases const
0123          //! reference would be returned
0124          template <class T>
0125          rvalue_reference_or_const_lvalue_reference move_if_noexcept(input_reference) noexcept;
0126 
0127       #else //BOOST_MOVE_DOXYGEN_INVOKED
0128 
0129          template <class T>
0130          BOOST_MOVE_INTRINSIC_CAST typename ::boost::move_detail::enable_if_c
0131             < ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value, T&&>::type
0132                move_if_noexcept(T& x) BOOST_NOEXCEPT
0133          {  return ::boost::move(x);   }
0134 
0135          template <class T>
0136          BOOST_MOVE_INTRINSIC_CAST typename ::boost::move_detail::enable_if_c
0137             < !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value, const T&>::type
0138                move_if_noexcept(T& x) BOOST_NOEXCEPT
0139          {  return x;  }
0140 
0141       #endif //BOOST_MOVE_DOXYGEN_INVOKED
0142 
0143       }  //namespace boost {
0144 
0145    #endif   //#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
0146 
0147 #endif   //BOOST_NO_CXX11_RVALUE_REFERENCES
0148 
0149 #include <boost/move/detail/config_end.hpp>
0150 
0151 #endif //#ifndef BOOST_MOVE_MOVE_UTILITY_HPP