I have a method that takes std::string_view
and uses function, which takes null terminated string as parameter. For example:
void stringFunc(std::experimental::string_view str) {
some_c_library_func(/* Expects null terminated string */);
}
The question is, what is the proper way to handle this situation? Is str.to_string().c_str()
the only option? And I really want to use std::string_view
in this method, because I pass different types of strings in it.