Fix MSVC 15.9 (2017) warning C4866

by changing operator[] param type from JSONCPP_STRING to const JSONCPP_STRING& for CharReaderBuilder and StreamWriterBuilder (as it is already in Value).

https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c4866?view=vs-2017
This commit is contained in:
Radoslav Atanasov 2018-12-13 14:18:04 +01:00 committed by Christopher Dunn
parent 4abf4ec208
commit ccd077ffce
5 changed files with 5 additions and 5 deletions

View File

@ -358,7 +358,7 @@ public:
/** A simple way to update a specific setting.
*/
Value& operator[](JSONCPP_STRING key);
Value& operator[](const JSONCPP_STRING& key);
/** Called by ctor, but you can use this to reset settings_.
* \pre 'settings' != NULL (but Json::null is fine)

View File

@ -132,7 +132,7 @@ public:
bool validate(Json::Value* invalid) const;
/** A simple way to update a specific setting.
*/
Value& operator[](JSONCPP_STRING key);
Value& operator[](const JSONCPP_STRING& key);
/** Called by ctor, but you can use this to reset settings_.
* \pre 'settings' != NULL (but Json::null is fine)

View File

@ -1969,7 +1969,7 @@ bool CharReaderBuilder::validate(Json::Value* invalid) const {
}
return 0u == inv.size();
}
Value& CharReaderBuilder::operator[](JSONCPP_STRING key) {
Value& CharReaderBuilder::operator[](const JSONCPP_STRING& key) {
return settings_[key];
}
// static

View File

@ -1145,7 +1145,7 @@ const Value& Value::operator[](const char* key) const {
return nullSingleton();
return *found;
}
Value const& Value::operator[](JSONCPP_STRING const& key) const {
Value const& Value::operator[](const JSONCPP_STRING& key) const {
Value const* found = find(key.data(), key.data() + key.length());
if (!found)
return nullSingleton();

View File

@ -1231,7 +1231,7 @@ bool StreamWriterBuilder::validate(Json::Value* invalid) const {
}
return 0u == inv.size();
}
Value& StreamWriterBuilder::operator[](JSONCPP_STRING key) {
Value& StreamWriterBuilder::operator[](const JSONCPP_STRING& key) {
return settings_[key];
}
// static