File indexing completed on 2025-01-18 10:09:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef RANGES_V3_ACTION_DROP_WHILE_HPP
0015 #define RANGES_V3_ACTION_DROP_WHILE_HPP
0016
0017 #include <range/v3/range_fwd.hpp>
0018
0019 #include <range/v3/action/action.hpp>
0020 #include <range/v3/action/erase.hpp>
0021 #include <range/v3/algorithm/find_if_not.hpp>
0022 #include <range/v3/functional/bind_back.hpp>
0023 #include <range/v3/iterator/concepts.hpp>
0024 #include <range/v3/iterator/traits.hpp>
0025 #include <range/v3/utility/static_const.hpp>
0026
0027 #include <range/v3/detail/prologue.hpp>
0028
0029 namespace ranges
0030 {
0031
0032
0033 namespace actions
0034 {
0035 struct drop_while_fn
0036 {
0037 template(typename Fun)(
0038 requires (!range<Fun>))
0039 constexpr auto operator()(Fun fun) const
0040 {
0041 return make_action_closure(bind_back(drop_while_fn{}, std::move(fun)));
0042 }
0043
0044 template(typename Rng, typename Fun)(
0045 requires forward_range<Rng> AND
0046 indirect_unary_predicate<Fun, iterator_t<Rng>> AND
0047 erasable_range<Rng &, iterator_t<Rng>, iterator_t<Rng>>)
0048 Rng operator()(Rng && rng, Fun fun) const
0049 {
0050 ranges::actions::erase(
0051 rng, begin(rng), find_if_not(begin(rng), end(rng), std::move(fun)));
0052 return static_cast<Rng &&>(rng);
0053 }
0054 };
0055
0056
0057 RANGES_INLINE_VARIABLE(drop_while_fn, drop_while)
0058 }
0059
0060 }
0061
0062 #include <range/v3/detail/epilogue.hpp>
0063
0064 #endif