Hacker News new | ask | show | jobs
by jcelerier 1629 days ago
But why is that an issue at all ? Having boost and other utilities is great. And since it's all templates there's in practice in your binary no added cost if you're using folly::foo or std::foo or boost::foo, you can pick and choose the exact data structures that allow exactly what you want (or write your own if you think that you can do a few percent better than folly of abseil in your specific use case).

If I was using java or python I'd definitely not use the standard things most of the time either because it's more than likely that there's a more efficient way in some other library, and because my main paycheck comes from "can you make this as fast as technically possible given this average consumer hardware"-problems

1 comments

interesting case in point. i just learned today that std::variant and boost::variant differ in their:

   1. exception-safety guarantees
   2. real-time safety
2 is caused by 1, because to be exception safe requires a heap allocation, and that's not RT-safe.

Who would want to work in a language where you could not make these choices?

Boost even has variant2 which comes with another set of design tradeoffs
When does std::variant allocate?
boost::variant will allocate to save state during construction of a new value type, in order to be able to roll back if the constructor throws an exception.

std::variant does not do this.

Is std::variant forbidden from doing this per standard or is it simply one (or several) implementations that made this choice?