]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/algorithm/cxx11/find_if_not.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / 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
92f5a8d4 15#include <boost/config.hpp>
7c673cae
FG
16#include <boost/range/begin.hpp>
17#include <boost/range/end.hpp>
18
19namespace boost { namespace algorithm {
20
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.
24///
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.
29template<typename InputIterator, typename Predicate>
92f5a8d4 30BOOST_CXX14_CONSTEXPR InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p )
7c673cae
FG
31{
32 for ( ; first != last; ++first )
33 if ( !p(*first))
34 break;
35 return first;
36}
37
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.
41///
42/// \param r The input range
43/// \param p A predicate for testing the elements of the range
44///
45template<typename Range, typename Predicate>
92f5a8d4 46BOOST_CXX14_CONSTEXPR typename boost::range_iterator<const Range>::type find_if_not ( const Range &r, Predicate p )
7c673cae
FG
47{
48 return boost::algorithm::find_if_not (boost::begin (r), boost::end(r), p);
49}
50
51}}
52#endif // BOOST_ALGORITHM_FIND_IF_NOT_HPP