When I use map<string, string> kv; in protobuf 3.8.0, the next code works:
std::string_view key("key");
kv[key] = "value";
While in protobuf 3.19.4, the above code doesn't work.
The error msg is:
error: no match for 'operator[]' (operand types are 'google::protobuf::Map<std::__cxx11::basic_string , std::__cxx11::basic_string>' and 'std::string_view' {aka 'std::basic_string_view'})
In 3.8.0,
Map::operator[]is declared as:Where, in your case,
Keyisstd::string.std::string_viewis convertible tostd::string, which is why the code works in 3.8.0.In 3.19.4,
Map::operator[]is declared as:Where
key_argis declared as:And, in your case,
key_typeisstd::string.std::string_viewis not convertible toTransparentSupport::key_arg, which is why the code doesn't work in 3.19.4.