To clarify what I mean:
const T & operator[](int I) const &
T & operator[](int I) &
T && operator[](int I) &&
By rvalue overloads, I'm referring not to the arguments to push_back etc, but rather overloading on the object's value category.
For example, vector does not provide the above set of overloads. It does not overload on value category, providing just const and non const versions, as a result:
vector<vector<double>> v;
// populate
vector<double> u(move(v)[0]);
Does not move construct u. I can go into more detail about why this is bad if necessary.
Does anyone know why these overloads weren't added?
Aucun commentaire:
Enregistrer un commentaire