3 ms·
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
by PaulDavisThe1st 5y ago
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?
- hn_go_brrrrr 5y agoWhen does std::variant allocate?
- PaulDavisThe1st 5y agoboost::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.
- gumby 5y agoIs std::variant forbidden from doing this per standard or is it simply one (or several) implementations that made this choice?
- jcelerier 5y agoBoost even has variant2 which comes with another set of design tradeoffs