![]() |
Lumiera 0.pre.04
»edit your freedom«
|
This file defines a simple alternative to boost::variant. More...
Go to the source code of this file.
This file defines a simple alternative to boost::variant.
It pulls in fewer headers and has a shorter code path, but also doesn't deal with alignment issues and is not threadsafe.
Values can be stored using operator= . In order to access the value stored in lib::VariantO, you additionally need to define an access "functor"
providing a static Ret access(ELM&) function for each of the types used in the VariantO "The" typical example for such an access "functor" is the util::AccessCasted template.
the instance handling for the accessor seems somewhat clumsy: we're creating a static accessor instance for each type of access functor, and each of these accessors holds a trampoline table. Why are we building a table, while we're using a templated access functor anyway? This table inhibits inlining, and there seems to be no runtime benefit. This whole design indeed was a hastily made (prompted by actual need) first attempt. It should be rewritten from scratch (HIV 4/2015)
///////////////////////////////////////TICKET #738 should be rewritten from scratch
///////////////////////////////////////TICKET #141 write an unit test for variant
Definition in file variant-o.hpp.
Namespaces | |
| namespace | lib |
| Implementation namespace for support and library code. | |
| namespace | lib::variant |
Classes | |
| struct | Holder< TYPES > |
| internal helper used to build a variant storage wrapper. More... | |
| struct | Holder< TYPES >::Buffer |
| Storage to hold the actual value. More... | |
| struct | Holder< TYPES >::PlacementAdapter< T, BASE, idx > |
| struct | Holder< TYPES >::CaseSelect< FUNCTOR > |
| provide a dispatcher table based visitation mechanism More... | |
| struct | Holder< TYPES >::CasePrepare< T, BASE, i > |
| initialise the dispatcher (trampoline) for the case of accessing type T More... | |
| struct | Holder< TYPES >::Deleter |
| class | VariantO< TYPES, Access > |
| A variant wrapper (typesafe union) capable of holding a value of any of a bounded collection of types. More... | |