Re:Embracing Modern C++ Safely, Book Review
by adrianN on Tuesday May 31, 2022 @04:20AM
(#31567203)
"No true Scotsman...". Take string_view for example: perfectly cromulent modern C++. I use it daily to reduce the number of unnecessary copies. It's also very easy to code a use-after-free bug with it.
[ Parent
| on HN ]
Only by storing it somewhere. So long as it is only passed down a call chain, no problem.
string_view really is no different from a naked pointer. Modern C++ treats naked pointers with well-deserved suspicion. I never have any trouble because pointers are always strictly evanescent values.