Horizon
Loading...
Searching...
No Matches
merge_n_with_buffer.hpp
Go to the documentation of this file.
1
2// Range v3 library
3//
4// Copyright Eric Niebler 2014-present
5//
6// Use, modification and distribution is subject to the
7// Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10//
11// Project home: https://github.com/ericniebler/range-v3
12//
13// Copyright (c) 2009 Alexander Stepanov and Paul McJones
14//
15// Permission to use, copy, modify, distribute and sell this software
16// and its documentation for any purpose is hereby granted without
17// fee, provided that the above copyright notice appear in all copies
18// and that both that copyright notice and this permission notice
19// appear in supporting documentation. The authors make no
20// representations about the suitability of this software for any
21// purpose. It is provided "as is" without express or implied
22// warranty.
23//
24// Algorithms from
25// Elements of Programming
26// by Alexander Stepanov and Paul McJones
27// Addison-Wesley Professional, 2009
28#ifndef RANGES_V3_ALGORITHM_AUX_MERGE_N_WITH_BUFFER_HPP
29#define RANGES_V3_ALGORITHM_AUX_MERGE_N_WITH_BUFFER_HPP
30
31#include <tuple>
32
34
41#include <range/v3/utility/static_const.hpp>
42
43#include <range/v3/detail/prologue.hpp>
44
45namespace ranges
46{
47 namespace aux
48 {
50 {
51 template(typename I, typename B, typename C = less, typename P = identity)(
52 requires same_as<iter_common_reference_t<I>,
53 iter_common_reference_t<B>> AND
54 indirectly_copyable<I, B> AND mergeable<B, I, I, C, P, P>)
55 I operator()(I begin0,
56 iter_difference_t<I> n0,
57 I begin1,
58 iter_difference_t<I> n1,
59 B buff,
60 C r = C{},
61 P p = P{}) const
62 {
63 copy_n(begin0, n0, buff);
64 return merge_n(buff, n0, begin1, n1, begin0, r, p, p).out;
65 }
66 };
67
68 RANGES_INLINE_VARIABLE(merge_n_with_buffer_fn, merge_n_with_buffer)
69 } // namespace aux
70} // namespace ranges
71
72#include <range/v3/detail/epilogue.hpp>
73
74#endif
The indirectly_copyable concept.
Definition merge_n_with_buffer.hpp:50
Definition identity.hpp:25
Definition comparisons.hpp:50