Re:Learn Modern C++
by erik_seaberg on Wednesday December 27, 2023 @07:02PM
(#38788406)
I don’t have a modern implementation handy, but according to https://en.cppreference.com/w/cpp/string/basic_string_view/d... a string_view depends on its data() pointer, and the lifetime of that buffer doesn’t seem to be guaranteed by anything.
[ Parent
| on HN ]
Re:Learn Modern C++
by angiosperm on Thursday December 28, 2023 @01:16AM
(#38790622)
Thus, the word "view". It refers to storage being managed by the creator of the string_view object, in this case a file mapped using mmap and not unmapped until after program termination.