find_not.hpp 986 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. Copyright (c) T. Zachary Laine 2018.
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. */
  6. #ifndef BOOST_ALGORITHM_FIND_NOT_HPP
  7. #define BOOST_ALGORITHM_FIND_NOT_HPP
  8. #include <utility>
  9. #include <boost/config.hpp>
  10. #include <boost/range/begin.hpp>
  11. #include <boost/range/end.hpp>
  12. namespace boost { namespace algorithm {
  13. template<typename InputIter, typename Sentinel, typename T>
  14. BOOST_CXX14_CONSTEXPR
  15. InputIter find_not(InputIter first, Sentinel last, const T & x)
  16. {
  17. for (; first != last; ++first) {
  18. if (*first != x)
  19. break;
  20. }
  21. return first;
  22. }
  23. template<typename Range, typename T>
  24. BOOST_CXX14_CONSTEXPR
  25. typename boost::range_iterator<Range>::type find_not(Range & r, const T & x)
  26. {
  27. return ::boost::algorithm::find_not(boost::begin(r), boost::end(r), x);
  28. }
  29. }} // namespace boost and algorithm
  30. #endif // BOOST_ALGORITHM_FIND_NOT_HPP