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/config.hpp>
16 #include <boost/range/begin.hpp>
17 #include <boost/range/end.hpp>
19 namespace boost { namespace algorithm {
21 /// \fn find_if_not(InputIterator first, InputIterator last, Predicate p)
22 /// \brief Finds the first element in the sequence that does not satisfy the predicate.
23 /// \return The iterator pointing to the desired element.
25 /// \param first The start of the input sequence
26 /// \param last One past the end of the input sequence
27 /// \param p A predicate for testing the elements of the range
28 /// \note This function is part of the C++2011 standard library.
29 template<typename InputIterator, typename Predicate>
30 BOOST_CXX14_CONSTEXPR InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p )
32 for ( ; first != last; ++first )
38 /// \fn find_if_not ( const Range &r, Predicate p )
39 /// \brief Finds the first element in the sequence that does not satisfy the predicate.
40 /// \return The iterator pointing to the desired element.
42 /// \param r The input range
43 /// \param p A predicate for testing the elements of the range
45 template<typename Range, typename Predicate>
46 BOOST_CXX14_CONSTEXPR typename boost::range_iterator<const Range>::type find_if_not ( const Range &r, Predicate p )
48 return boost::algorithm::find_if_not (boost::begin (r), boost::end(r), p);
52 #endif // BOOST_ALGORITHM_FIND_IF_NOT_HPP