I have a home grown template class called Vec
which is a pale shadow of: std::vector<T>
To avoid re-inventing the wheel the header overloads for assign
are copied from: std::vector::assign
..so
As part of testing Str
class, ..test code is also run against std::vector<T>
to ensure equivalent output...
If std::vector<T>
is used then compiler will choose the correct overload:
However, when Vec<T>
is used then compiler insists on choosing the incorrect overload:
There is an obvious work around via casting the args to lvalues prior to use:
Question:
Given that both Vec<T>
and std::vector<T>
use identical header overloads for their respective assign
...how is std::vector<T>
able to implement rvalues arg without confusing the compiler?