]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/algorithm/include/boost/algorithm/cxx11/find_if_not.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / algorithm / include / boost / algorithm / cxx11 / find_if_not.hpp
CommitLineData
7c673cae
FG
1/*
2 Copyright (c) Marshall Clow 2011-2012.
3
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)
6*/
7
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
11
12#ifndef BOOST_ALGORITHM_FIND_IF_NOT_HPP
13#define BOOST_ALGORITHM_FIND_IF_NOT_HPP
14
15#include <boost/range/begin.hpp>
16#include <boost/range/end.hpp>
17
18namespace boost { namespace algorithm {
19
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.
23///
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.
28template<typename InputIterator, typename Predicate>
29InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p )
30{
31 for ( ; first != last; ++first )
32 if ( !p(*first))
33 break;
34 return first;
35}
36
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.
40///
41/// \param r The input range
42/// \param p A predicate for testing the elements of the range
43///
44template<typename Range, typename Predicate>
45typename boost::range_iterator<const Range>::type find_if_not ( const Range &r, Predicate p )
46{
47 return boost::algorithm::find_if_not (boost::begin (r), boost::end(r), p);
48}
49
50}}
51#endif // BOOST_ALGORITHM_FIND_IF_NOT_HPP