4#ifndef TETL_ALGORITHM_SET_UNION_HPP
5#define TETL_ALGORITHM_SET_UNION_HPP
7#include <etl/_algorithm/copy.hpp>
8#include <etl/_functional/less.hpp>
19template <
typename InputIt1,
typename InputIt2,
typename OutputIt,
typename Compare>
21set_union(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination, Compare comp)
24 for (; first1 != last1; ++destination) {
25 if (first2 == last2) {
26 return etl::copy(first1, last1, destination);
28 if (comp(*first2, *first1)) {
29 *destination = *first2++;
33 *destination = *first1;
34 if (
not comp(*first1, *first2)) {
39 return etl::copy(first2, last2, destination);
42template <
typename InputIt1,
typename InputIt2,
typename OutputIt>
43constexpr auto set_union(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination)
46 return etl::set_union(first1, last1, first2, last2, destination,
etl::
less());
constexpr auto set_union(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination) -> OutputIt
Constructs a sorted union beginning at destination consisting of the set of elements present in one o...
Definition set_union.hpp:43
constexpr auto set_union(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination, Compare comp) -> OutputIt
Constructs a sorted union beginning at destination consisting of the set of elements present in one o...
Definition set_union.hpp:21
Definition adjacent_find.hpp:9
Function object for performing comparisons. Unless specialised, invokes operator< on type T....
Definition less.hpp:15