annotate DEPENDENCIES/generic/include/boost/algorithm/cxx14/mismatch.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /*
Chris@16 2 Copyright (c) Marshall Clow 2008-2012.
Chris@16 3
Chris@16 4 Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 5 file LICENSE10.txt or copy at http://www.boost.org/LICENSE10.txt)
Chris@16 6 */
Chris@16 7
Chris@16 8 /// \file mismatch.hpp
Chris@16 9 /// \brief Find the first mismatched element in a sequence
Chris@16 10 /// \author Marshall Clow
Chris@16 11
Chris@16 12 #ifndef BOOST_ALGORITHM_MISMATCH_HPP
Chris@16 13 #define BOOST_ALGORITHM_MISMATCH_HPP
Chris@16 14
Chris@16 15 #include <algorithm> // for std::mismatch
Chris@16 16 #include <utility> // for std::pair
Chris@16 17
Chris@16 18 namespace boost { namespace algorithm {
Chris@16 19
Chris@16 20 /// \fn mismatch ( InputIterator1 first1, InputIterator1 last1,
Chris@16 21 /// InputIterator2 first2, InputIterator2 last2,
Chris@16 22 /// BinaryPredicate pred )
Chris@16 23 /// \return a pair of iterators pointing to the first elements in the sequence that do not match
Chris@16 24 ///
Chris@16 25 /// \param first1 The start of the first range.
Chris@16 26 /// \param last1 One past the end of the first range.
Chris@16 27 /// \param first2 The start of the second range.
Chris@16 28 /// \param last2 One past the end of the second range.
Chris@16 29 /// \param pred A predicate for comparing the elements of the ranges
Chris@16 30 template <class InputIterator1, class InputIterator2, class BinaryPredicate>
Chris@16 31 std::pair<InputIterator1, InputIterator2> mismatch (
Chris@16 32 InputIterator1 first1, InputIterator1 last1,
Chris@16 33 InputIterator2 first2, InputIterator2 last2,
Chris@16 34 BinaryPredicate pred )
Chris@16 35 {
Chris@16 36 for (; first1 != last1 && first2 != last2; ++first1, ++first2)
Chris@16 37 if ( !pred ( *first1, *first2 ))
Chris@16 38 break;
Chris@16 39 return std::pair<InputIterator1, InputIterator2>(first1, first2);
Chris@16 40 }
Chris@16 41
Chris@16 42 /// \fn mismatch ( InputIterator1 first1, InputIterator1 last1,
Chris@16 43 /// InputIterator2 first2, InputIterator2 last2 )
Chris@16 44 /// \return a pair of iterators pointing to the first elements in the sequence that do not match
Chris@16 45 ///
Chris@16 46 /// \param first1 The start of the first range.
Chris@16 47 /// \param last1 One past the end of the first range.
Chris@16 48 /// \param first2 The start of the second range.
Chris@16 49 /// \param last2 One past the end of the second range.
Chris@16 50 template <class InputIterator1, class InputIterator2>
Chris@16 51 std::pair<InputIterator1, InputIterator2> mismatch (
Chris@16 52 InputIterator1 first1, InputIterator1 last1,
Chris@16 53 InputIterator2 first2, InputIterator2 last2 )
Chris@16 54 {
Chris@16 55 for (; first1 != last1 && first2 != last2; ++first1, ++first2)
Chris@16 56 if ( *first1 != *first2 )
Chris@16 57 break;
Chris@16 58 return std::pair<InputIterator1, InputIterator2>(first1, first2);
Chris@16 59 }
Chris@16 60
Chris@16 61 // There are already range-based versions of these.
Chris@16 62
Chris@16 63 }} // namespace boost and algorithm
Chris@16 64
Chris@16 65 #endif // BOOST_ALGORITHM_MISMATCH_HPP