Quantcast
Channel: Installation and Deployment
Viewing all articles
Browse latest Browse all 22112

[solved] two operators with the same input?

$
0
0
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?

Viewing all articles
Browse latest Browse all 22112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>