4 ms·
This is to allow foo(temporary_string) where foo takes std::string_view. The real problem is that in C++ temporaries are destructed at the end of the expressio
by _0w8t 4y ago
This is to allow foo(temporary_string) where foo takes std::string_view.
The real problem is that in C++ temporaries are destructed at the end of the expression, not at the end of the block that contains them. With the latter rule the example and many other cases will be safe.