Reputation: 16575
I can instantiate a QVector containing three QColor values with QVector<QColor>() << x << y << z
.
Is it possible to instantiate it on one line without using the overloaded <<
? Something like QVector<QColor>().addAll(x,y,z)
?
Upvotes: 1
Views: 1046
Reputation: 110698
In C++11, you can use QVector
's initializer list constructor:
QVector<QColor>{x, y, z}
Upvotes: 4