Solutionunvalidated
I think this could work: — template DataList & operator+=(DataList &lhs, T &&rhs) {. Tension: `a += generate()` will move elements from the `generate()` but `a += b` will copy elements from `b`. Outcome: if constexpr (std::is_rvalue_reference_v) lhs.emplace_back(std::move(data)); else lhs.emplace_back(data);.
ef153fcd-cd38-4e5d-b246-6dae025104b7
I think this could work: — template
DataList & operator+=(DataList &lhs, T &&rhs)
{. Tension: a += generate() will move elements from the generate() but a += b will copy elements from b. Outcome: if constexpr (std::is_rvalue_reference_v)
lhs.emplace_back(std::move(data));
else lhs.emplace_back(data);.