Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
hn_go_brrrrr
4y ago
0 comments
Save
Share
When does std::variant allocate?
0 comments
2 comments · 1 top-level
top
newest
oldest
PaulDavisThe1st
4y ago
· 1 in thread
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.
gumby
4y ago
Is std::variant forbidden from doing this per standard or is it simply one (or several) implementations that made this choice?
j
/
k
navigate · click thread line to collapse