/// \file // Range v3 library // // Copyright Eric Niebler 2013-present // // Use, modification and distribution is subject to the // Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // Project home: https://github.com/ericniebler/range-v3 // #ifndef RANGES_V3_ACTION_SPLIT_WHEN_HPP #define RANGES_V3_ACTION_SPLIT_WHEN_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include namespace ranges { /// \addtogroup group-actions /// @{ namespace actions { struct split_when_fn { template using split_value_t = meta::if_c<(bool)ranges::container, // uncvref_t, std::vector>>; template constexpr auto operator()(Fun fun) const { return make_action_closure( bind_back(split_when_fn{}, static_cast(fun))); } // BUGBUG something is not right with the actions. It should be possible // to move a container into a split and have elements moved into the result. template(typename Rng, typename Fun)( requires forward_range AND invocable, sentinel_t> AND invocable, iterator_t> AND copy_constructible AND convertible_to, sentinel_t>, std::pair>>) std::vector> operator()(Rng && rng, Fun fun) const { return views::split_when(rng, std::move(fun)) | to>>(); } template(typename Rng, typename Fun)( requires forward_range AND predicate> AND copy_constructible) std::vector> operator()(Rng && rng, Fun fun) const { return views::split_when(rng, std::move(fun)) | to>>(); } }; /// \relates actions::split_when_fn RANGES_INLINE_VARIABLE(split_when_fn, split_when) } // namespace actions /// @} } // namespace ranges #include #endif