3#ifndef TETL_ALGORITHM_MERGE_HPP
4#define TETL_ALGORITHM_MERGE_HPP
14template <
typename InputIt1,
typename InputIt2,
typename OutputIt,
typename Compare>
16merge(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination, Compare comp) -> OutputIt
18 for (; first1 != last1; ++destination) {
19 if (first2 == last2) {
20 return etl::copy(first1, last1, destination);
22 if (comp(*first2, *first1)) {
23 *destination = *first2;
26 *destination = *first1;
30 return etl::copy(first2, last2, destination);
34template <
typename InputIt1,
typename InputIt2,
typename OutputIt>
35constexpr auto merge(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination) -> OutputIt
constexpr auto merge(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination, Compare comp) -> OutputIt
Merges two sorted ranges [first1, last1) and [first2, last2) into one sorted range beginning at desti...
Definition merge.hpp:16
constexpr auto copy(InputIt first, InputIt last, OutputIt destination) -> OutputIt
Copies the elements in the range, defined by [first, last), to another range beginning at destination...
Definition copy.hpp:18
Definition adjacent_find.hpp:8
Function object for performing comparisons. Unless specialised, invokes operator< on type T....
Definition less.hpp:14