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

I mean I get it. On the other hand you really should know the constructs you are using. std::string_view is essentially a reference to a char array and you are assigning a temporary object (r-value) to it. Standard C++ rules say that you can't expect the lifetime of that object hold past the expression.


Sure I get it too.

If you want to write safe c++ you have to understand memory and lifetimes and what the code is doing. Humans have been shown to be quite bad at doing this - even experienced programmers.

Rust offloads that work to the compiler.




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

Search: