[solved] two operators with the same input?
-
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.
- QJsonValue QJsonObject::operator[](const QString & key) const
- 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? -
ok, found answer myself:
http://stackoverflow.com/questions/5762042/const-overloaded-operator-function-and-its-invocation