url
url copied to clipboard
The method `string` is surprising since it does not return a string
Before reading the documentation, it seemed obvious to me that in the following code:
auto
as_string(boost::urls::url_view uv)
{
return uv.string();
}
Would return a string. In fact it returns a string_view, which may well actually be a dangling reference.
It seems to me that this is likely to be the source of many future support calls by surprised library users.
Proposal:
Provide both url[_view]::string() which returns a std::string, and url[_view]::string_view() which returns a std::string_view.