Hello guys,
I’m trying the new Qt5 json feature. I found that there are two [] operators defined for QJsonObject.
My understanding is that c++ doesn’t allow this, because there is no way to tell which one is the one you want to call. They both have the same function name “operator[]” and parameter. But things can compile.
1. QJsonValue QJsonObject::operator[](const QString & key) const
2. QJsonValueRef QJsonObject::operator[](const QString & key)
now, I want to call the first [] operator. I call it like this: jsonObj[“key name”]; but what I actually call is the second operator, I get QJsonValueRef instead of QJsonValue.
Question:
How do I call the first operator?
↧