3 ms·
It'd help with the edge case I showed... "safe" is a strong word though, doesn't handle this one: std::string json() { return "\"123\""; } std::string_view
by MaulingMonkey 6y ago
It'd help with the edge case I showed... "safe" is a strong word though, doesn't handle this one:
std::string json() { return "\"123\""; }
std::string_view unquote(std::string_view s) { return { s.data()+1, s.size()-2 }; }
auto i = from_string(unquote(json()));
It's a fundamental problem of subtly & unexpectedly deferred action.
- ot 6y agoI meant to write "safer" but the "r" fell through :)