mismatch.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_MISMATCH_HPP 00010 #define ADOBE_ALGORITHM_MISMATCH_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 #if ADOBE_HAS_CPLUS0X_CONCEPTS 00022 00023 namespace std { concept_map CopyConstructible<pair<const unsigned char*, const unsigned char*> > {}} 00024 00025 #endif 00026 /*************************************************************************************************/ 00027 00028 namespace adobe { 00029 00030 /*************************************************************************************************/ 00038 /*************************************************************************************************/ 00044 template <class InputRange1, class InputIterator2> 00045 inline std::pair<typename boost::range_iterator<InputRange1>::type, InputIterator2> 00046 mismatch(InputRange1& range1, InputIterator2 first2) 00047 { 00048 return std::mismatch(boost::begin(range1), boost::end(range1), first2); 00049 } 00050 00051 00057 template <class InputRange1, class InputIterator2> 00058 inline std::pair<typename boost::range_const_iterator<InputRange1>::type, InputIterator2> 00059 mismatch(const InputRange1& range1, InputIterator2 first2) 00060 { 00061 return std::mismatch(boost::begin(range1), boost::end(range1), first2); 00062 } 00063 00069 template <class InputIterator1, class InputIterator2, class BinaryPredicate> 00070 inline std::pair<InputIterator1, InputIterator2> mismatch(InputIterator1 first1, 00071 InputIterator1 last1, 00072 InputIterator2 first2, 00073 BinaryPredicate pred) 00074 { 00075 return std::mismatch(first1, last1, first2, boost::bind(pred, _1, _2)); 00076 } 00077 00083 template <class InputRange1, class InputIterator2, class BinaryPredicate> 00084 inline std::pair<typename boost::range_iterator<InputRange1>::type, InputIterator2> 00085 mismatch(InputRange1& range1, InputIterator2 first2, BinaryPredicate pred) 00086 { 00087 return adobe::mismatch(boost::begin(range1), boost::end(range1), first2, pred); 00088 } 00089 00095 template <class InputRange1, class InputIterator2, class BinaryPredicate> 00096 inline std::pair<typename boost::range_const_iterator<InputRange1>::type, InputIterator2> 00097 mismatch(const InputRange1& range1, InputIterator2 first2, BinaryPredicate pred) 00098 { 00099 return adobe::mismatch(boost::begin(range1), boost::end(range1), first2, pred); 00100 } 00101 00102 /*************************************************************************************************/ 00103 00104 } // namespace adobe 00105 00106 /*************************************************************************************************/ 00107 00108 #endif 00109 00110 /*************************************************************************************************/ |