Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nobody in their right mind will use `shared_ptr` in this context. It will be `string_view` in and out with lifetime management left as an exercise to the programmer.


I read your parent as saying "assume we start from needing this to be checked," and then saying that this is the best that can be done. You're absolutely 1000% right that nobody would write that ever and would use string_view and not have it statically checked.


That’s exactly it. Just showing how trying to get the same safety guarantee in c++ is an either or between performance and safety.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: