stlab.adobe.com Adobe Systems Incorporated

merge.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2005-2007 Adobe Systems Incorporated
00003     Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
00004     or a copy at http://stlab.adobe.com/licenses.html)
00005 */
00006 
00007 /*************************************************************************************************/
00008 
00009 #ifndef ADOBE_ALGORITHM_MERGE_HPP
00010 #define ADOBE_ALGORITHM_MERGE_HPP
00011 
00012 #include <adobe/config.hpp>
00013 
00014 #include <boost/range/begin.hpp>
00015 #include <boost/range/end.hpp>
00016 #include <boost/bind.hpp>
00017 
00018 #include <algorithm>
00019 
00020 /*************************************************************************************************/
00021 
00022 namespace adobe {
00023 
00024 /*************************************************************************************************/
00032 /*************************************************************************************************/
00038 template <class InputRange1, class InputRange2, class OutputIterator>
00039 inline OutputIterator
00040 merge(const InputRange1& range1, const InputRange2& range2, OutputIterator result)
00041 {
00042     return std::merge(  boost::begin(range1), boost::end(range1),
00043                         boost::begin(range2), boost::end(range2),
00044                         result);
00045 }
00046 
00052 template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
00053 inline OutputIterator merge(InputIterator1 first1, InputIterator1 last1, 
00054                             InputIterator2 first2, InputIterator2 last2,
00055                             OutputIterator result, Compare comp)
00056 {
00057     return std::merge(first1, last1, first2, last2, result, boost::bind(comp, _1, _2));
00058 }
00059 
00065 template <class InputRange1, class InputRange2, class OutputIterator, class Compare>
00066 inline OutputIterator
00067 merge(const InputRange1& range1, const InputRange2& range2, OutputIterator result, Compare comp)
00068 {
00069     return adobe::merge(    boost::begin(range1), boost::end(range1),
00070                                 boost::begin(range2), boost::end(range2),
00071                                 result, comp);
00072 }
00073 
00074 /*************************************************************************************************/
00075 
00076 } // namespace adobe
00077 
00078 /*************************************************************************************************/
00079 
00080 #endif
00081 
00082 /*************************************************************************************************/

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