Hacker News new | ask | show | jobs
by pie_flavor 1620 days ago
I mean, that ship's basically sailed. People are too lazy even to take `std::string_view` instead of `std::string&`, trying to avoid pointless allocations and clones with any API but your own is almost a fool's errand at this point.
1 comments

I think the issue with string_view is less laziness and more recency: most libraries still need to support C++ versions prior to C++17. Rust had the advantage that slices were there from day one.
I don't think it's just recency either, it's just incredibly easy to shoot yourself into the foot with string_view when the language has no way of checking that the pointed to memory is actually valid. People moved to smart pointers for good reasons and string_view just undoes all of that.
Yeah, it was a bad decision.

While using C++, adding something like gsl to the toolbox is worth gold, and also enabling bounds checking even in release (really, most of the time it hardly matters to the application users).

For example, Bloomberg is still on their transition to C++14, let alone C++17.

"C++11/14 at Scale: What Have We Learned?"

https://www.youtube.com/watch?v=E3JG2Ijjei4