Open
Description
when passing a Json::Value pointer to a const Json::Value &;
compiler will automatically transform the pointer to bool then to a json::value;
void LogJson(const Json::Value& value) {
LOG(ERROR) << value.toStyledString();
}
int main() {
Json::Value json = Json::Value(Json::objectValue)
const Json::Value *json_p = &json;
LogJson(json);
LogJson(json_p);
}
the first LogJson will log a "{}"
the second LogJson will log a "true", caused by implict conversation
Expecte the second LogJson will compile fail.