
On 11/26/2015 11:58 PM, ☂Josh Chia (谢任中) wrote:
It seems that boost::variant has non-trivial destructor even for something like boost::variant<int32_t, int64_t>. Thus, It cannot be used in situations that call for a POD where calling the destructor is trivial.
Particularly, I can't have a boost::lock_free::queue<boost::variant<X, Y>> even both X and Y are trivially destructible.
Just making `variant` trivially destructible would not be enough, as `boost::lockfree::queue` also requires a trivial copy-assignment operator.
How about making boost::variant trivially-destructible when everything in it is trivially-destructible?
For your particular use case, it would be far simpler to just use plain old discriminated-unions. Regards, -- Agustín K-ballo Bergé.- http://talesofcpp.fusionfenix.com