Extended union types in C++11
This C++ library explores advanced definitions of union-types, using C++11 features. As such, your compiler (and standard library) needs to be set to run in C++11 mode. The library has (so far):
super_union
, aunion
that has its variant member types listed as template parameters. You can ignore having to recall the name (or name path) for each variant member and just address them by type. There is an option to address them via type index.tagged_union
, aunion
that works likesuper_union
except it also keeps track of which variant member is current. Addressing members must be done through the custom access functions.variant_size
andvariant_element
, analogs to the meta-functionsstd::tuple_size
andstd::tuple_element
that support thestd::tuple
(andstd::pair
andstd::array
) class templates. These class templates are specialized for the provided advanced union types in this library, and should be specialized for any union-like types you make.
The format of the library is like a prototype Boost library submission, which it may become. As such, the code is under the Boost license.