Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:26:43

0001 /// \file
0002 // Range v3 library
0003 //
0004 //  Copyright Eric Niebler 2013-present
0005 //
0006 //  Use, modification and distribution is subject to the
0007 //  Boost Software License, Version 1.0. (See accompanying
0008 //  file LICENSE_1_0.txt or copy at
0009 //  http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // Project home: https://github.com/ericniebler/range-v3
0012 //
0013 
0014 #ifndef RANGES_V3_UTILITY_MOVE_HPP
0015 #define RANGES_V3_UTILITY_MOVE_HPP
0016 
0017 #include <type_traits>
0018 
0019 #include <meta/meta.hpp>
0020 
0021 #include <range/v3/range_fwd.hpp>
0022 
0023 #include <range/v3/utility/static_const.hpp>
0024 
0025 #include <range/v3/detail/prologue.hpp>
0026 
0027 namespace ranges
0028 {
0029     namespace aux
0030     {
0031         /// \ingroup group-utility
0032         struct move_fn : move_tag
0033         {
0034             template<typename T>
0035             constexpr meta::_t<std::remove_reference<T>> && operator()(T && t) const //
0036                 noexcept
0037             {
0038                 return static_cast<meta::_t<std::remove_reference<T>> &&>(t);
0039             }
0040 
0041             /// \ingroup group-utility
0042             /// \sa `move_fn`
0043             template<typename T>
0044             friend constexpr decltype(auto) operator|(T && t, move_fn move) noexcept
0045             {
0046                 return move(t);
0047             }
0048         };
0049 
0050         /// \ingroup group-utility
0051         /// \sa `move_fn`
0052         RANGES_INLINE_VARIABLE(move_fn, move)
0053 
0054         /// \ingroup group-utility
0055         /// \sa `move_fn`
0056         template<typename R>
0057         using move_t =
0058             meta::if_c<std::is_reference<R>::value, meta::_t<std::remove_reference<R>> &&,
0059                        detail::decay_t<R>>;
0060     } // namespace aux
0061 } // namespace ranges
0062 
0063 #include <range/v3/detail/epilogue.hpp>
0064 
0065 #endif