|
||||
File indexing completed on 2025-01-18 09:28:22
0001 /* 0002 Copyright (c) Marshall Clow 2011-2012. 0003 0004 Distributed under the Boost Software License, Version 1.0. (See accompanying 0005 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 0006 */ 0007 0008 /// \file find_if_not.hpp 0009 /// \brief Find the first element in a sequence that does not satisfy a predicate. 0010 /// \author Marshall Clow 0011 0012 #ifndef BOOST_ALGORITHM_FIND_IF_NOT_HPP 0013 #define BOOST_ALGORITHM_FIND_IF_NOT_HPP 0014 0015 #include <boost/config.hpp> 0016 #include <boost/range/begin.hpp> 0017 #include <boost/range/end.hpp> 0018 0019 namespace boost { namespace algorithm { 0020 0021 /// \fn find_if_not(InputIterator first, InputIterator last, Predicate p) 0022 /// \brief Finds the first element in the sequence that does not satisfy the predicate. 0023 /// \return The iterator pointing to the desired element. 0024 /// 0025 /// \param first The start of the input sequence 0026 /// \param last One past the end of the input sequence 0027 /// \param p A predicate for testing the elements of the range 0028 /// \note This function is part of the C++2011 standard library. 0029 template<typename InputIterator, typename Predicate> 0030 BOOST_CXX14_CONSTEXPR InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p ) 0031 { 0032 for ( ; first != last; ++first ) 0033 if ( !p(*first)) 0034 break; 0035 return first; 0036 } 0037 0038 /// \fn find_if_not ( const Range &r, Predicate p ) 0039 /// \brief Finds the first element in the sequence that does not satisfy the predicate. 0040 /// \return The iterator pointing to the desired element. 0041 /// 0042 /// \param r The input range 0043 /// \param p A predicate for testing the elements of the range 0044 /// 0045 template<typename Range, typename Predicate> 0046 BOOST_CXX14_CONSTEXPR typename boost::range_iterator<const Range>::type find_if_not ( const Range &r, Predicate p ) 0047 { 0048 return boost::algorithm::find_if_not (boost::begin (r), boost::end(r), p); 0049 } 0050 0051 }} 0052 #endif // BOOST_ALGORITHM_FIND_IF_NOT_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |