when compiling following code with C++11 (gcc 4.9), I get a compiler error:
//converts tuple vector to single component vector
template<class In, class Out, int Idx>
QVector<Out> tuple_vector_to_member_vector (const QVector<In>& in_vector)
{
QVector<Out> out_vector;
for (In in : in_vector)
out_vector.push_back(in.get<Idx>());
return out_vector;
}
The error is as following (and occurs as well when the template is not instantiated):
error: expected primary-expression before ')' token
out_vector.push_back(in.get<Idx>());
(Visual C++ 2013 accepts it on the other hand.)
I guess that one have to place
typename In::get<Idx>
or similar in any form, but I don't know where.
Has someone an idea?
Thank you.