stlab.adobe.com Adobe Systems Incorporated
merge.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2005-2007 Adobe Systems Incorporated
3  Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
4  or a copy at http://stlab.adobe.com/licenses.html)
5 */
6 
7 /*************************************************************************************************/
8 
9 #ifndef ADOBE_ALGORITHM_MERGE_HPP
10 #define ADOBE_ALGORITHM_MERGE_HPP
11 
12 #include <adobe/config.hpp>
13 
14 #include <boost/range/begin.hpp>
15 #include <boost/range/end.hpp>
16 #include <boost/bind.hpp>
17 
18 #include <algorithm>
19 
20 /*************************************************************************************************/
21 
22 namespace adobe {
23 
24 /*************************************************************************************************/
32 /*************************************************************************************************/
38 template <class InputRange1, class InputRange2, class OutputIterator>
39 inline OutputIterator
40 merge(const InputRange1& range1, const InputRange2& range2, OutputIterator result)
41 {
42  return std::merge( boost::begin(range1), boost::end(range1),
43  boost::begin(range2), boost::end(range2),
44  result);
45 }
46 
52 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
53 inline OutputIterator merge(InputIterator1 first1, InputIterator1 last1,
54  InputIterator2 first2, InputIterator2 last2,
55  OutputIterator result, Compare comp)
56 {
57  return std::merge(first1, last1, first2, last2, result, boost::bind(comp, _1, _2));
58 }
59 
65 template <class InputRange1, class InputRange2, class OutputIterator, class Compare>
66 inline OutputIterator
67 merge(const InputRange1& range1, const InputRange2& range2, OutputIterator result, Compare comp)
68 {
69  return adobe::merge( boost::begin(range1), boost::end(range1),
70  boost::begin(range2), boost::end(range2),
71  result, comp);
72 }
73 
74 /*************************************************************************************************/
75 
76 } // namespace adobe
77 
78 /*************************************************************************************************/
79 
80 #endif
81 
82 /*************************************************************************************************/
OutputIterator merge(const InputRange1 &range1, const InputRange2 &range2, OutputIterator result, Compare comp)
merge implementation
Definition: merge.hpp:67
OutputIterator merge(const InputRange1 &range1, const InputRange2 &range2, OutputIterator result)
merge implementation
Definition: merge.hpp:40

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google