lexicographical_compare.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_LEXICOGRAPHICAL_COMPARE_HPP 00010 #define ADOBE_ALGORITHM_LEXICOGRAPHICAL_COMPARE_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> 00039 inline bool lexicographical_compare(const InputRange1& range1, const InputRange2& range2) 00040 { 00041 return std::lexicographical_compare(boost::begin(range1), boost::end(range1), 00042 boost::begin(range2), boost::end(range2)); 00043 } 00044 00050 template <class InputIterator1, class InputIterator2, class Compare> 00051 inline bool lexicographical_compare(InputIterator1 first1, InputIterator1 last1, 00052 InputIterator2 first2, InputIterator2 last2, 00053 Compare comp) 00054 00055 { 00056 return std::lexicographical_compare(first1, last1, first2, last2, boost::bind(comp, _1, _2)); 00057 } 00058 00064 template <class InputRange1, class InputRange2, class Compare> 00065 inline bool 00066 lexicographical_compare(const InputRange1& range1, const InputRange2& range2, Compare comp) 00067 { 00068 return adobe::lexicographical_compare( boost::begin(range1), boost::end(range1), 00069 boost::begin(range2), boost::end(range2), 00070 comp); 00071 } 00072 00073 /*************************************************************************************************/ 00074 00075 } // namespace adobe 00076 00077 /*************************************************************************************************/ 00078 00079 #endif 00080 00081 /*************************************************************************************************/ |