17template <
typename _ForwardIteratorSource,
class _Tp,
class _BinaryOperation,
class _UnaryOperation>
18_Tp do_transform_reduce(
19 _ForwardIteratorSource&& container,
21 _BinaryOperation __binary_op,
22 _UnaryOperation __unary_op)
25 using _ForwardIterator =
decltype(container.begin());
26 return std::transform_reduce(
27 std::execution::par_unseq,
28 static_cast<_ForwardIterator
>(container.begin()),
29 static_cast<_ForwardIterator
>(container.end()),
35template <
typename M,
class F>
36const M merge_maps_generic(
41 using const_iterator =
typename M::const_iterator;
42 using value_type =
typename M::value_type;
43 using key_type =
typename M::key_type;
44 using mapped_type =
typename M::mapped_type;
45 std::function<mapped_type(
const mapped_type&,
const mapped_type&)> fct_merge = f;
47 const_iterator it_lhs = lhs.begin();
48 const_iterator it_rhs = rhs.begin();
49 const_iterator end_lhs = lhs.end();
50 const_iterator end_rhs = rhs.end();
53 if (end_lhs == it_lhs)
55 while (end_rhs != it_rhs)
62 if (end_rhs == it_rhs)
64 while (end_lhs != it_lhs)
72 const value_type& pair0 = *it_lhs;
73 const value_type& pair1 = *it_rhs;
74 const key_type& k0 = pair0.first;
75 const key_type& k1 = pair1.first;
76 const mapped_type& m0 = pair0.second;
77 const mapped_type& m1 = pair1.second;
91 const mapped_type merged = fct_merge(m0, m1);
92 out.emplace(pair<const key_type, const mapped_type>(k0, merged));