File indexing completed on 2025-01-18 10:09:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef RANGES_V3_ACTION_JOIN_HPP
0015 #define RANGES_V3_ACTION_JOIN_HPP
0016
0017 #include <vector>
0018
0019 #include <meta/meta.hpp>
0020
0021 #include <range/v3/range_fwd.hpp>
0022
0023 #include <range/v3/action/action.hpp>
0024 #include <range/v3/action/concepts.hpp>
0025 #include <range/v3/action/push_back.hpp>
0026 #include <range/v3/iterator/concepts.hpp>
0027 #include <range/v3/iterator/traits.hpp>
0028 #include <range/v3/utility/static_const.hpp>
0029
0030 #include <range/v3/detail/prologue.hpp>
0031
0032 namespace ranges
0033 {
0034
0035
0036 namespace actions
0037 {
0038 template<typename Rng>
0039 using join_action_value_t_ =
0040 meta::if_c<(bool)ranges::container<range_value_t<Rng>>,
0041 range_value_t<Rng>,
0042 std::vector<range_value_t<range_value_t<Rng>>>>;
0043
0044 struct join_fn
0045 {
0046 template(typename Rng)(
0047 requires input_range<Rng> AND input_range<range_value_t<Rng>> AND
0048 semiregular<join_action_value_t_<Rng>>)
0049 join_action_value_t_<Rng> operator()(Rng && rng) const
0050 {
0051 join_action_value_t_<Rng> ret;
0052 auto last = ranges::end(rng);
0053 for(auto it = begin(rng); it != last; ++it)
0054 push_back(ret, *it);
0055 return ret;
0056 }
0057 };
0058
0059
0060
0061 RANGES_INLINE_VARIABLE(action_closure<join_fn>, join)
0062 }
0063
0064 }
0065
0066 #include <range/v3/detail/epilogue.hpp>
0067
0068 #endif