4 ms·
Unfortunately the abi requires non-trivially copyable/destructible types to be passed by (hidden) reference. It should be possible to implement std::variant in
by gpderetta 10y ago
Unfortunately the abi requires non-trivially copyable/destructible types to be passed by (hidden) reference.
It should be possible to implement std::variant in such a way that it is trivially constructible and destructible as long as all elements are, but apparently stdlibc++ doesn't. This is GCC choice and other compilers apparently do differently. Unless GCC changes it before finalising their c++17 implementation, the choice will be unfortunately set in stone for them as they guarantee abi stability of the library.
P0602R0 is a proposal to require trivial copy/move (but strangely not destruct), don't know whether it has been accepted though.
- ambrop7 10y agoRight, this is basically what I said in my comment :) Thanks for the proposal reference.