Hacker News new | ask | show | jobs
by moltopoco 19 days ago
Understood, and I also use string_view where it makes sense. But while overusing std::string can cause unnecessary and hidden allocations, overusing string_view often leads to memory errors.

I also love C++11 "auto", but overusing it then makes the string/string_view bugs harder to find.

I am perfectly happy with with idiomatic C++11 plus features from recent standards, but I don't feel like that counts as "modern C++" anymore. A sibling comment put it better: idiomatic C++20 has become its own separate thing, and I personally don't love it, and it is certainly not more robust in my experience.

1 comments

> I also love C++11 "auto", but overusing it then makes the string/string_view bugs harder to find.

Yes, I have soured a bit on the "almost always auto" mantra myself. There are cases where explicit types are both clearer and safer.