Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / algorithm / find_not.hpp
1 /*
2    Copyright (c) T. Zachary Laine 2018.
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 #ifndef BOOST_ALGORITHM_FIND_NOT_HPP
8 #define BOOST_ALGORITHM_FIND_NOT_HPP
9
10 #include <utility>
11
12 #include <boost/config.hpp>
13 #include <boost/range/begin.hpp>
14 #include <boost/range/end.hpp>
15
16 namespace boost { namespace algorithm {
17
18 template<typename InputIter, typename Sentinel, typename T>        
19 BOOST_CXX14_CONSTEXPR
20 InputIter find_not(InputIter first, Sentinel last, const T & x)
21 {
22     for (; first != last; ++first) {
23         if (*first != x)
24             break;
25     }
26     return first;
27 }
28
29 template<typename Range, typename T>
30 BOOST_CXX14_CONSTEXPR
31 typename boost::range_iterator<Range>::type find_not(Range & r, const T & x)
32 {
33     return ::boost::algorithm::find_not(boost::begin(r), boost::end(r), x);
34 }
35
36 }} // namespace boost and algorithm
37
38 #endif // BOOST_ALGORITHM_FIND_NOT_HPP