It seems unions can be templated in c++11, they are used for example in the reference implementation of std::optional.
Was that possible before c++11 ?
It seems unions can be templated in c++11, they are used for example in the reference implementation of std::optional.
Was that possible before c++11 ?
In place of a union you can also use std::variant as of c++17 https://en.cppreference.com/w/cpp/utility/variant