/// \file // Range v3 library // // Copyright Eric Niebler 2014-present // // Use, modification and distribution is subject to the // Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // Project home: https://github.com/ericniebler/range-v3 // #ifndef RANGES_V3_ALGORITHM_MOVE_BACKWARD_HPP #define RANGES_V3_ALGORITHM_MOVE_BACKWARD_HPP #include #include #include #include #include #include #include #include #include #include #include namespace ranges { /// \addtogroup group-algorithms /// @{ template using move_backward_result = detail::in_out_result; RANGES_BEGIN_NIEBLOID(move_backward) /// \brief function template \c move_backward template auto RANGES_FUN_NIEBLOID(move_backward)(I first, S end_, O out) // ->CPP_ret(move_backward_result)( // requires bidirectional_iterator && sentinel_for && bidirectional_iterator && indirectly_movable) { I i = ranges::next(first, end_), last = i; while(first != i) *--out = iter_move(--i); return {last, out}; } /// \overload template auto RANGES_FUN_NIEBLOID(move_backward)(Rng && rng, O out) // ->CPP_ret(move_backward_result, O>)( // requires bidirectional_range && bidirectional_iterator && indirectly_movable, O>) { return (*this)(begin(rng), end(rng), std::move(out)); } RANGES_END_NIEBLOID(move_backward) namespace cpp20 { using ranges::move_backward; using ranges::move_backward_result; } // namespace cpp20 /// @} } // namespace ranges #endif // include guard