I have some elements in a QMap<double, double> a
-element. Now I want to get a vector of some values of a
. The easiest approach would be (for me):
int length = x1-x0;
QVector<double> retVec;
for(int i = x0; i < length; i++)
{
retVec.push_back(a.values(i));
}
with x1
and x0
as the stop- and start-positions of the elements to be copied. But is there a faster way instead of using this for-loop?
Edit: With "faster" I mean both faster to type and (not possible, as pointed out) a faster execution. As it has been pointed out, values(i)
is not working as expected, thus I will leave it here as pseudo-code until I found a better_working replacement.