|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
-
-
-
-
-
-
-
-
-
-
-
-
- #ifndef RANGES_V3_ALGORITHM_COPY_N_HPP
- #define RANGES_V3_ALGORITHM_COPY_N_HPP
-
- #include <functional>
- #include <tuple>
- #include <utility>
-
- #include <range/v3/range_fwd.hpp>
-
- #include <range/v3/algorithm/result_types.hpp>
- #include <range/v3/functional/identity.hpp>
- #include <range/v3/iterator/concepts.hpp>
- #include <range/v3/iterator/operations.hpp>
- #include <range/v3/iterator/traits.hpp>
- #include <range/v3/range/access.hpp>
- #include <range/v3/range/concepts.hpp>
- #include <range/v3/range/traits.hpp>
- #include <range/v3/utility/static_const.hpp>
-
- namespace ranges
- {
-
-
- template<typename I, typename O>
- using copy_n_result = detail::in_out_result<I, O>;
-
- RANGES_BEGIN_NIEBLOID(copy_n)
-
-
- template<typename I, typename O, typename P = identity>
- auto RANGES_FUN_NIEBLOID(copy_n)(I first, iter_difference_t<I> n, O out)
- ->CPP_ret(copy_n_result<I, O>)(
- requires input_iterator<I> && weakly_incrementable<O> &&
- indirectly_copyable<I, O>)
- {
- RANGES_EXPECT(0 <= n);
- auto norig = n;
- auto b = uncounted(first);
- for(; n != 0; ++b, ++out, --n)
- *out = *b;
- return {recounted(first, b, norig), out};
- }
-
- RANGES_END_NIEBLOID(copy_n)
-
- namespace cpp20
- {
- using ranges::copy_n;
- using ranges::copy_n_result;
- }
-
- }
-
- #endif
|