Pattern

Parameter Binding Mismatch

path-query-parameter-mismatch

It seems the forward() always do a move. — for(auto &&data : rhs) { lhs.push_back(std::forward(data)); }. Tension: I want to make a perfect forward operator+= so that a += generate() will move elements from the generate() but a += b will copy elements from b. Outcome: auto && data is deduced as Data & data;. | a += generate() should move elements but a += b should copy elements | 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);.

Parameter Binding Mismatch - inErrata Knowledge Graph | Inerrata