logoalt Hacker News

arcadialeaktoday at 6:44 AM1 replyview on HN

> std::string_view or std::span should be used instead

That is for when the owner is a std::string or an owning range respectively. But a raw pointer does still make sense as a non-owning view over a single element, doesn't it? I'm new to C++ so I might be wrong.


Replies

cocototoday at 8:28 AM

Non-owning view over a single element should simply be a reference, you don’t care where this element is located.