diff --git a/include/boost/algorithm/cxx14/equal.hpp b/include/boost/algorithm/cxx14/equal.hpp index d10c096..cfc62d5 100644 --- a/include/boost/algorithm/cxx14/equal.hpp +++ b/include/boost/algorithm/cxx14/equal.hpp @@ -12,41 +12,41 @@ #ifndef BOOST_ALGORITHM_EQUAL_HPP #define BOOST_ALGORITHM_EQUAL_HPP -#include // for std::equal -#include // for std::equal_to +#include // for std::equal +#include // for std::equal_to namespace boost { namespace algorithm { namespace detail { - template - struct eq : public std::binary_function { - bool operator () ( const T1& v1, const T2& v2 ) const { return v1 == v2 ;} - }; - - template - bool equal ( RandomAccessIterator1 first1, RandomAccessIterator1 last1, - RandomAccessIterator2 first2, RandomAccessIterator2 last2, BinaryPredicate pred, - std::random_access_iterator_tag, std::random_access_iterator_tag ) - { - // Random-access iterators let is check the sizes in constant time - if ( std::distance ( first1, last1 ) != std::distance ( first2, last2 )) - return false; - // If we know that the sequences are the same size, the original version is fine - return std::equal ( first1, last1, first2, pred ); - } + template + struct eq : public std::binary_function { + bool operator () ( const T1& v1, const T2& v2 ) const { return v1 == v2 ;} + }; + + template + bool equal ( RandomAccessIterator1 first1, RandomAccessIterator1 last1, + RandomAccessIterator2 first2, RandomAccessIterator2 last2, BinaryPredicate pred, + std::random_access_iterator_tag, std::random_access_iterator_tag ) + { + // Random-access iterators let is check the sizes in constant time + if ( std::distance ( first1, last1 ) != std::distance ( first2, last2 )) + return false; + // If we know that the sequences are the same size, the original version is fine + return std::equal ( first1, last1, first2, pred ); + } - template - bool equal ( InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred, - std::input_iterator_tag, std::input_iterator_tag ) - { - for (; first1 != last1 && first2 != last2; ++first1, ++first2 ) - if ( !pred(*first1, *first2 )) - return false; + template + bool equal ( InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred, + std::input_iterator_tag, std::input_iterator_tag ) + { + for (; first1 != last1 && first2 != last2; ++first1, ++first2 ) + if ( !pred(*first1, *first2 )) + return false; - return first1 == last1 && first2 == last2; - } + return first1 == last1 && first2 == last2; + } } /// \fn equal ( InputIterator1 first1, InputIterator1 last1, @@ -63,10 +63,10 @@ template bool equal ( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred ) { - return boost::algorithm::detail::equal ( - first1, last1, first2, last2, pred, - typename std::iterator_traits::iterator_category (), - typename std::iterator_traits::iterator_category ()); + return boost::algorithm::detail::equal ( + first1, last1, first2, last2, pred, + typename std::iterator_traits::iterator_category (), + typename std::iterator_traits::iterator_category ()); } /// \fn equal ( InputIterator1 first1, InputIterator1 last1, @@ -81,16 +81,16 @@ template bool equal ( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2 ) { - return boost::algorithm::detail::equal ( - first1, last1, first2, last2, - boost::algorithm::detail::eq< - typename std::iterator_traits::value_type, - typename std::iterator_traits::value_type> (), - typename std::iterator_traits::iterator_category (), - typename std::iterator_traits::iterator_category ()); + return boost::algorithm::detail::equal ( + first1, last1, first2, last2, + boost::algorithm::detail::eq< + typename std::iterator_traits::value_type, + typename std::iterator_traits::value_type> (), + typename std::iterator_traits::iterator_category (), + typename std::iterator_traits::iterator_category ()); } -// There are already range-based versions of these. +// There are already range-based versions of these. }} // namespace boost and algorithm diff --git a/include/boost/algorithm/cxx14/mismatch.hpp b/include/boost/algorithm/cxx14/mismatch.hpp index 5229e3b..926ab19 100644 --- a/include/boost/algorithm/cxx14/mismatch.hpp +++ b/include/boost/algorithm/cxx14/mismatch.hpp @@ -12,13 +12,11 @@ #ifndef BOOST_ALGORITHM_MISMATCH_HPP #define BOOST_ALGORITHM_MISMATCH_HPP -#include // for std::mismatch -#include // for std::pair +#include // for std::mismatch +#include // for std::pair namespace boost { namespace algorithm { -template - /// \fn mismatch ( InputIterator1 first1, InputIterator1 last1, /// InputIterator2 first2, InputIterator2 last2, /// BinaryPredicate pred ) @@ -29,10 +27,11 @@ template /// \param first2 The start of the second range. /// \param last2 One past the end of the second range. /// \param pred A predicate for comparing the elements of the ranges +template std::pair mismatch ( - InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - BinaryPredicate pred ) + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + BinaryPredicate pred ) { for (; first1 != last1 && first2 != last2; ++first1, ++first2) if ( !pred ( *first1, *first2 )) @@ -50,8 +49,8 @@ std::pair mismatch ( /// \param last2 One past the end of the second range. template std::pair mismatch ( - InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2 ) + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2 ) { for (; first1 != last1 && first2 != last2; ++first1, ++first2) if ( *first1 != *first2 ) @@ -59,7 +58,7 @@ std::pair mismatch ( return std::pair(first1, first2); } -// There are already range-based versions of these. +// There are already range-based versions of these. }} // namespace boost and algorithm diff --git a/string/test/find_test.cpp b/string/test/find_test.cpp index 66d9337..8439b3c 100644 --- a/string/test/find_test.cpp +++ b/string/test/find_test.cpp @@ -181,20 +181,20 @@ void find_test() ( (cv_result.begin()-str1.begin()) == 3) && ( (cv_result.end()-str1.begin()) == 6) ); - string s1("abc def ghi jkl"); - find_iterator fEnd; + string s1("abc def ghi jkl"); + find_iterator fEnd; - find_iterator fxIt = make_find_iterator(s1, - token_finder(is_alnum(), token_compress_on)); - BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("abc"))); - ++fxIt; - BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("def"))); - ++fxIt; - BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("ghi"))); - ++fxIt; - BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("jkl"))); - ++fxIt; - BOOST_CHECK(fxIt == fEnd); + find_iterator fxIt = make_find_iterator(s1, + token_finder(is_alnum(), token_compress_on)); + BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("abc"))); + ++fxIt; + BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("def"))); + ++fxIt; + BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("ghi"))); + ++fxIt; + BOOST_CHECK((fxIt != fEnd) && (*fxIt == string("jkl"))); + ++fxIt; + BOOST_CHECK(fxIt == fEnd); nc_result=find_token( str1, is_any_of("abc"), token_compress_off ); BOOST_CHECK( diff --git a/string/test/split_test.cpp b/string/test/split_test.cpp index 429f3c4..582472b 100644 --- a/string/test/split_test.cpp +++ b/string/test/split_test.cpp @@ -46,7 +46,7 @@ void iterator_test() const char* pch1="xx-abc--xx-abb"; vector tokens; vector< vector > vtokens; - + // find_all tests find_all( tokens, @@ -182,7 +182,7 @@ void iterator_test() BOOST_CHECK(siter==split_iterator()); // Make sure we work with forward iterators -// See bug #7989 +// See bug #7989 list l1; find_iterator::iterator> liter=make_find_iterator(l1, first_finder("xx")); } diff --git a/test/iterator_test.hpp b/test/iterator_test.hpp index cd77fb6..a79e7cf 100644 --- a/test/iterator_test.hpp +++ b/test/iterator_test.hpp @@ -1,12 +1,21 @@ +/* + Copyright (c) Marshall Clow 2013. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + For more information, see http://www.boost.org +*/ + #ifndef ITERATOR_TEST_H #define ITERATOR_TEST_H /* - A set of iterator adapters for constructing test cases - From an iterator (or a pointer), you can make any class of iterator. - Assuming you want to degrade the capabilities. - - Modeled closely on work that Howard Hinnant did for libc++. + A set of iterator adapters for constructing test cases + From an iterator (or a pointer), you can make any class of iterator. + Assuming you want to degrade the capabilities. + + Modeled closely on work that Howard Hinnant did for libc++. */ #include @@ -269,10 +278,10 @@ public: private: It it_; template friend class output_iterator; - }; - -// No comparison operators for output iterators - + }; + +// No comparison operators for output iterators + // == Get the base of an iterator; used for comparisons == template @@ -290,7 +299,7 @@ inline Iter base(bidirectional_iterator i) { return i.base(); } template inline Iter base(random_access_iterator i) { return i.base(); } -template // everything else +template // everything else inline Iter base(Iter i) { return i; } #endif // ITERATORS_H