Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:27:54

0001 /// \file
0002 // Range v3 library
0003 //
0004 //  Copyright Eric Niebler 2014-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 #ifndef RANGES_V3_ALGORITHM_MOVE_HPP
0014 #define RANGES_V3_ALGORITHM_MOVE_HPP
0015 
0016 #include <utility>
0017 
0018 #include <range/v3/range_fwd.hpp>
0019 
0020 #include <range/v3/algorithm/result_types.hpp>
0021 #include <range/v3/iterator/concepts.hpp>
0022 #include <range/v3/iterator/traits.hpp>
0023 #include <range/v3/range/access.hpp>
0024 #include <range/v3/range/concepts.hpp>
0025 #include <range/v3/range/dangling.hpp>
0026 #include <range/v3/range/traits.hpp>
0027 #include <range/v3/utility/move.hpp>
0028 #include <range/v3/utility/static_const.hpp>
0029 
0030 #include <range/v3/detail/prologue.hpp>
0031 
0032 namespace ranges
0033 {
0034     /// \addtogroup group-algorithms
0035     /// @{
0036     template<typename I, typename O>
0037     using move_result = detail::in_out_result<I, O>;
0038 
0039     RANGES_HIDDEN_DETAIL(namespace _move CPP_PP_LBRACE())
0040     RANGES_FUNC_BEGIN(move)
0041 
0042         /// \brief function template \c move
0043         template(typename I, typename S, typename O)(
0044             requires input_iterator<I> AND sentinel_for<S, I> AND
0045             weakly_incrementable<O> AND indirectly_movable<I, O>)
0046         constexpr move_result<I, O> RANGES_FUNC(move)(I first, S last, O out) //
0047         {
0048             for(; first != last; ++first, ++out)
0049                 *out = iter_move(first);
0050             return {first, out};
0051         }
0052 
0053         /// \overload
0054         template(typename Rng, typename O)(
0055             requires input_range<Rng> AND weakly_incrementable<O> AND
0056             indirectly_movable<iterator_t<Rng>, O>)
0057         constexpr move_result<borrowed_iterator_t<Rng>, O> //
0058         RANGES_FUNC(move)(Rng && rng, O out)            //
0059         {
0060             return (*this)(begin(rng), end(rng), std::move(out));
0061         }
0062 
0063     RANGES_FUNC_END(move)
0064     RANGES_HIDDEN_DETAIL(CPP_PP_RBRACE())
0065 
0066 #ifndef RANGES_DOXYGEN_INVOKED
0067     struct RANGES_EMPTY_BASES move_fn
0068       : aux::move_fn
0069       , _move::move_fn
0070     {
0071         using aux::move_fn::operator();
0072         using _move::move_fn::operator();
0073     };
0074 
0075     RANGES_INLINE_VARIABLE(move_fn, move)
0076 #endif
0077 
0078     namespace cpp20
0079     {
0080         using ranges::move_result;
0081         using ranges::RANGES_HIDDEN_DETAIL(_move::) move;
0082     } // namespace cpp20
0083     /// @}
0084 } // namespace ranges
0085 
0086 #include <range/v3/detail/epilogue.hpp>
0087 
0088 #endif