2 Copyright (c) Marshall Clow 2011-2012.
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 /// \file find_if_not.hpp
9 /// \brief Find the first element in a sequence that does not satisfy a predicate.
10 /// \author Marshall Clow
12 #ifndef BOOST_ALGORITHM_FIND_IF_NOT_HPP
13 #define BOOST_ALGORITHM_FIND_IF_NOT_HPP
15 #include <boost/range/begin.hpp>
16 #include <boost/range/end.hpp>
18 namespace boost { namespace algorithm {
20 /// \fn find_if_not(InputIterator first, InputIterator last, Predicate p)
21 /// \brief Finds the first element in the sequence that does not satisfy the predicate.
22 /// \return The iterator pointing to the desired element.
24 /// \param first The start of the input sequence
25 /// \param last One past the end of the input sequence
26 /// \param p A predicate for testing the elements of the range
27 /// \note This function is part of the C++2011 standard library.
28 template<typename InputIterator, typename Predicate>
29 InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p )
31 for ( ; first != last; ++first )
37 /// \fn find_if_not ( const Range &r, Predicate p )
38 /// \brief Finds the first element in the sequence that does not satisfy the predicate.
39 /// \return The iterator pointing to the desired element.
41 /// \param r The input range
42 /// \param p A predicate for testing the elements of the range
44 template<typename Range, typename Predicate>
45 typename boost::range_iterator<const Range>::type find_if_not ( const Range &r, Predicate p )
47 return boost::algorithm::find_if_not (boost::begin (r), boost::end(r), p);
51 #endif // BOOST_ALGORITHM_FIND_IF_NOT_HPP