4#ifndef TETL_ALGORITHM_MERGE_HPP
5#define TETL_ALGORITHM_MERGE_HPP
7#include <etl/_algorithm/copy.hpp>
8#include <etl/_functional/less.hpp>
15template <
typename InputIt1,
typename InputIt2,
typename OutputIt,
typename Compare>
17merge(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination, Compare comp) -> OutputIt
19 for (; first1 != last1; ++destination) {
20 if (first2 == last2) {
21 return etl::copy(first1, last1, destination);
23 if (comp(*first2, *first1)) {
24 *destination = *first2;
27 *destination = *first1;
31 return etl::copy(first2, last2, destination);
35template <
typename InputIt1,
typename InputIt2,
typename OutputIt>
36constexpr auto merge(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination) -> OutputIt
38 return etl::merge(first1, last1, first2, last2, destination,
etl::
less());
constexpr auto merge(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination) -> OutputIt
Definition merge.hpp:36
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:17
Definition adjacent_find.hpp:9
Function object for performing comparisons. Unless specialised, invokes operator< on type T....
Definition less.hpp:15