Am 03.03.2018 um 21:25 schrieb Allan Sandfeld Jensen:
On Samstag, 3. März 2018 21:11:18 CET Mandeep Sandhu wrote:
On Sat, Mar 3, 2018 at 11:46 AM, Christian Ehrlicher <[email protected]>

wrote:
Hi,

recently rvalue overloads for QVector::append(T), push_back(T) and others
were added to QVector. But not for the convenience functions like
operator<<(T) or operator +=(T). Is this an oversight
Why would an rvalue overload (by that I assume you mean move semantics)
apply to the += operator? You're not discarding the existing object, just
adding values from whats pointed to by the other  reference.

As for the << operator, it _might_ be an oversight, I'm not sure. Someone
else can chime in.

Both of them could make sense assuming we are talking about the single value
variants. I guess it is an oversight, feel free to add them.

inline QVector<T> &operator+=(T &&t)
{ append(std::move(t)); return *this; }
inline QVector<T> &operator<< (T &&t)
{ append(std::move(t)); return *this; }

Note they might be missing from qvarlengtharray too.
QVarLengthArray does not have those convenience functions but it provides 'void append(T &&t) ' unconditionally in 5.11 ...


Christian

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to