Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:27:54

0001 /// \file
0002 // Range v3 library
0003 //
0004 //  Copyright Andrew Sutton 2014
0005 //  Copyright Gonzalo Brito Gadeschi 2014
0006 //
0007 //  Use, modification and distribution is subject to the
0008 //  Boost Software License, Version 1.0. (See accompanying
0009 //  file LICENSE_1_0.txt or copy at
0010 //  http://www.boost.org/LICENSE_1_0.txt)
0011 //
0012 // Project home: https://github.com/ericniebler/range-v3
0013 //
0014 #ifndef RANGES_V3_ALGORITHM_NONE_OF_HPP
0015 #define RANGES_V3_ALGORITHM_NONE_OF_HPP
0016 
0017 #include <utility>
0018 
0019 #include <range/v3/range_fwd.hpp>
0020 
0021 #include <range/v3/functional/identity.hpp>
0022 #include <range/v3/functional/invoke.hpp>
0023 #include <range/v3/iterator/concepts.hpp>
0024 #include <range/v3/iterator/traits.hpp>
0025 #include <range/v3/range/access.hpp>
0026 #include <range/v3/range/concepts.hpp>
0027 #include <range/v3/range/traits.hpp>
0028 #include <range/v3/utility/static_const.hpp>
0029 
0030 #include <range/v3/detail/prologue.hpp>
0031 
0032 namespace ranges
0033 {
0034     /// \addtogroup group-algorithms
0035     /// @{
0036     RANGES_FUNC_BEGIN(none_of)
0037 
0038         /// \brief function template \c none_of
0039         template(typename I, typename S, typename F, typename P = identity)(
0040             requires input_iterator<I> AND sentinel_for<S, I> AND
0041             indirect_unary_predicate<F, projected<I, P>>)
0042         constexpr bool RANGES_FUNC(none_of)(I first, S last, F pred, P proj = P{}) //
0043         {
0044             for(; first != last; ++first)
0045                 if(invoke(pred, invoke(proj, *first)))
0046                     return false;
0047             return true;
0048         }
0049 
0050         /// \overload
0051         template(typename Rng, typename F, typename P = identity)(
0052             requires input_range<Rng> AND
0053             indirect_unary_predicate<F, projected<iterator_t<Rng>, P>>)
0054         constexpr bool RANGES_FUNC(none_of)(Rng && rng, F pred, P proj = P{}) //
0055         {
0056             return (*this)(begin(rng), end(rng), std::move(pred), std::move(proj));
0057         }
0058 
0059     RANGES_FUNC_END(none_of)
0060 
0061     namespace cpp20
0062     {
0063         using ranges::none_of;
0064     }
0065     /// @}
0066 } // namespace ranges
0067 
0068 #include <range/v3/detail/epilogue.hpp>
0069 
0070 #endif