GitXplorerGitXplorer
C

Unionize

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
00d2f5726108e2ebe6b4d8c6a0fcb623d828c1f5

Corrected comments.

CCTMacUser committed 13 years ago
Unverified
9fe6671b95238ee1994a0b6f584090593e2489ba

Added tagged_union union template, example program, and many support templates.

CCTMacUser committed 13 years ago
Unverified
c22c478282cc10a647942bd49e27f866c1926b72

Added demo for function that returns a run-time variant-type list; renamed that function; made sure implementation worked.

CCTMacUser committed 13 years ago
Unverified
d47a21a153586af1c10a18845d6f7ae2825008d2

Added file-level Doxygen comments; tweaked some other comments.

CCTMacUser committed 13 years ago
Unverified
fcd12e1916585022f9f30d6e7cd2ac77d95095b2

Changed return values to flat-level aggregate initialization lists.

CCTMacUser committed 13 years ago
Unverified
535241c3f13a9488bd845549ce3b1cf661ffcbac

Added compile-fail test file for the super_union member-access functions.

CCTMacUser committed 13 years ago

README

The README file for this repository.

Unionize

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, a union 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, a union that works like super_union except it also keeps track of which variant member is current. Addressing members must be done through the custom access functions.
  • variant_size and variant_element, analogs to the meta-functions std::tuple_size and std::tuple_element that support the std::tuple (and std::pair and std::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.