Adobe Source Libraries 2.0.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
merge.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Adobe
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5*/
6/**************************************************************************************************/
7
8#ifndef ADOBE_ALGORITHM_MERGE_HPP
9#define ADOBE_ALGORITHM_MERGE_HPP
10
11#include <adobe/config.hpp>
12
13#include <boost/range/begin.hpp>
14#include <boost/range/end.hpp>
15
16#include <algorithm>
17#include <functional>
18
19/**************************************************************************************************/
20
21namespace adobe {
22
23/**************************************************************************************************/
31/**************************************************************************************************/
37template <class InputRange1, class InputRange2, class OutputIterator>
38inline OutputIterator merge(const InputRange1& range1, const InputRange2& range2,
39 OutputIterator result) {
40 return std::merge(boost::begin(range1), boost::end(range1), boost::begin(range2),
41 boost::end(range2), result);
42}
43
49template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
50inline OutputIterator merge(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
51 InputIterator2 last2, OutputIterator result, Compare comp) {
52 return std::merge(first1, last1, first2, last2, result,
53 std::bind(comp, std::placeholders::_1, std::placeholders::_2));
54}
55
61template <class InputRange1, class InputRange2, class OutputIterator, class Compare>
62inline OutputIterator merge(const InputRange1& range1, const InputRange2& range2,
63 OutputIterator result, Compare comp) {
64 return adobe::merge(boost::begin(range1), boost::end(range1), boost::begin(range2),
65 boost::end(range2), result, comp);
66}
67
68/**************************************************************************************************/
69
70} // namespace adobe
71
72/**************************************************************************************************/
73
74#endif
75
76/**************************************************************************************************/
OutputIterator merge(const InputRange1 &range1, const InputRange2 &range2, OutputIterator result)
merge implementation
Definition merge.hpp:38