Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Copyright (c) 2009 Alexander Stepanov and Paul McJones
0014 //
0015 // Permission to use, copy, modify, distribute and sell this software
0016 // and its documentation for any purpose is hereby granted without
0017 // fee, provided that the above copyright notice appear in all copies
0018 // and that both that copyright notice and this permission notice
0019 // appear in supporting documentation. The authors make no
0020 // representations about the suitability of this software for any
0021 // purpose. It is provided "as is" without express or implied
0022 // warranty.
0023 //
0024 // Algorithms from
0025 // Elements of Programming
0026 // by Alexander Stepanov and Paul McJones
0027 // Addison-Wesley Professional, 2009
0028 #ifndef RANGES_V3_ALGORITHM_AUX_MERGE_N_WITH_BUFFER_HPP
0029 #define RANGES_V3_ALGORITHM_AUX_MERGE_N_WITH_BUFFER_HPP
0030 
0031 #include <tuple>
0032 
0033 #include <range/v3/range_fwd.hpp>
0034 
0035 #include <range/v3/algorithm/aux_/merge_n.hpp>
0036 #include <range/v3/algorithm/copy_n.hpp>
0037 #include <range/v3/functional/comparisons.hpp>
0038 #include <range/v3/functional/identity.hpp>
0039 #include <range/v3/iterator/concepts.hpp>
0040 #include <range/v3/iterator/traits.hpp>
0041 #include <range/v3/utility/static_const.hpp>
0042 
0043 #include <range/v3/detail/prologue.hpp>
0044 
0045 namespace ranges
0046 {
0047     namespace aux
0048     {
0049         struct merge_n_with_buffer_fn
0050         {
0051             template(typename I, typename B, typename C = less, typename P = identity)(
0052                 requires same_as<iter_common_reference_t<I>,
0053                                      iter_common_reference_t<B>> AND
0054                         indirectly_copyable<I, B> AND mergeable<B, I, I, C, P, P>)
0055             I operator()(I begin0,
0056                          iter_difference_t<I> n0,
0057                          I begin1,
0058                          iter_difference_t<I> n1,
0059                          B buff,
0060                          C r = C{},
0061                          P p = P{}) const
0062             {
0063                 copy_n(begin0, n0, buff);
0064                 return merge_n(buff, n0, begin1, n1, begin0, r, p, p).out;
0065             }
0066         };
0067 
0068         RANGES_INLINE_VARIABLE(merge_n_with_buffer_fn, merge_n_with_buffer)
0069     } // namespace aux
0070 } // namespace ranges
0071 
0072 #include <range/v3/detail/epilogue.hpp>
0073 
0074 #endif