File indexing completed on 2025-12-16 10:27:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef RANGES_V3_ALGORITHM_ROTATE_COPY_HPP
0014 #define RANGES_V3_ALGORITHM_ROTATE_COPY_HPP
0015
0016 #include <functional>
0017
0018 #include <range/v3/range_fwd.hpp>
0019
0020 #include <range/v3/algorithm/copy.hpp>
0021 #include <range/v3/algorithm/result_types.hpp>
0022 #include <range/v3/functional/identity.hpp>
0023 #include <range/v3/iterator/concepts.hpp>
0024 #include <range/v3/iterator/traits.hpp>
0025 #include <range/v3/range/access.hpp>
0026 #include <range/v3/range/concepts.hpp>
0027 #include <range/v3/range/dangling.hpp>
0028 #include <range/v3/range/traits.hpp>
0029 #include <range/v3/utility/static_const.hpp>
0030
0031 #include <range/v3/detail/prologue.hpp>
0032
0033 namespace ranges
0034 {
0035
0036
0037 template<typename I, typename O>
0038 using rotate_copy_result = detail::in_out_result<I, O>;
0039
0040 RANGES_FUNC_BEGIN(rotate_copy)
0041
0042
0043 template(typename I, typename S, typename O, typename P = identity)(
0044 requires forward_iterator<I> AND sentinel_for<S, I> AND
0045 weakly_incrementable<O> AND indirectly_copyable<I, O>)
0046 constexpr rotate_copy_result<I, O>
0047 RANGES_FUNC(rotate_copy)(I first, I middle, S last, O out)
0048 {
0049 auto res = ranges::copy(middle, std::move(last), std::move(out));
0050 return {std::move(res.in),
0051 ranges::copy(std::move(first), middle, std::move(res.out)).out};
0052 }
0053
0054
0055 template(typename Rng, typename O, typename P = identity)(
0056 requires range<Rng> AND weakly_incrementable<O> AND
0057 indirectly_copyable<iterator_t<Rng>, O>)
0058 constexpr rotate_copy_result<borrowed_iterator_t<Rng>, O>
0059 RANGES_FUNC(rotate_copy)(Rng && rng, iterator_t<Rng> middle, O out)
0060 {
0061 return (*this)(begin(rng), std::move(middle), end(rng), std::move(out));
0062 }
0063
0064 RANGES_FUNC_END(rotate_copy)
0065
0066 namespace cpp20
0067 {
0068 using ranges::rotate_copy;
0069 using ranges::rotate_copy_result;
0070 }
0071
0072 }
0073
0074 #include <range/v3/detail/epilogue.hpp>
0075
0076 #endif