lightburst
lightburst

Reputation: 231

qualifier errors

I keep getting this passing 'const QString' as 'this' argument of 'QString& QString::operator=(const QString&)' discards qualifiers error and I don't know why... I already somewhat isolated this piece to make free of external causes but still persists.

QVector< QPair<QString, QString> > some;
some.at(0).first = QString("HA");

Ignore the fact that I'm working with an empty vector, unless it's the source of the problem. :( It should only create a runtime error instead of a compile-time error, no?

Upvotes: 0

Views: 653

Answers (1)

Jarosław Gomułka
Jarosław Gomułka

Reputation: 4995

const T & QVector::at ( int i ) const

You cannot assign value to const reference.

use

some[0]

in order to get a non-const reference

Upvotes: 2

Related Questions