August 2005
Intermediate to advanced
432 pages
9h 41m
English
• Typesafe storage and retrieval of a user-specified set of types
• A means to store heterogeneous types in Standard Library containers
• Compile-time checked visitation of variants
• Efficient, stack-based storage for variants
The Variant library focuses on typesafe storage and retrieval of a bounded set of types—that is, on discriminated unions. The Boost.Variant library has many features in common with Boost.Any, but there are different tradeoffs as well as differences in functionality. The need for discriminated unions (variant types) is very common in everyday programming. One typical solution while retaining type safety is to use abstract base classes, but that's not ...
Read now
Unlock full access