As a discriminated union container, the Variant library shares many of the same features of the Any library. However, since neither library wholly encapsulates the features of the other, one library cannot be generally recommended for use over the other.
That said, Boost.Variant has several advantages over Boost.Any, such as:
Of course, Boost.Any has several advantages over Boost.Variant, such as:
The library aims for 100% ANSI/ISO C++ conformance. However, this is strictly impossible due to the inherently non-portable nature of the Type Traits library's type_with_alignment facility. In practice though, no compilers or platforms have been discovered where this reliance on undefined behavior has been an issue.
Additionally, significant effort has been expended to ensure proper functioning despite various compiler bugs and other conformance problems. To date the library testsuite has been compiled and tested successfully on at least the following compilers for basic and advanced functionality:
|Borland C++ 5.5.1 and 5.6.4||X||X|
|Comeau C++ 4.3.0||X||X||X||X|
|GNU GCC 3.3.1||X||X||X||X|
|GNU GCC 2.95.3||X||X||X|
|Intel C++ 7.0||X||X||X|
|Metrowerks CodeWarrior 8.3||X||X||X|
|Microsoft Visual C++ 7.1||X||X||X||X|
|Microsoft Visual C++ 6 SP5 and 7||X|
Finally, the current state of the testsuite in CVS may be found on the Test Summary page. Please note, however, that this page reports on day-to-day changes to inter-release code found in the Boost CVS and thus likely does not match the state of code found in Boost releases.
Due to the heavy use of templates in the implementation of variant, it is not uncommon when compiling to encounter problems related to template instantiaton depth, compiler memory, etc. This section attempts to provide advice to common problems experienced on several popular compilers.
(This section is still in progress, with additional advice/feedback welcome. Please post to the Boost-Users list with any useful experiences you may have.)
Eric Friedman and Itay Maman designed the initial submission; Eric was the primary implementer.
Jeff Garland was the formal review manager.
Douglas Gregor, Dave Abrahams, Anthony Williams, Fernando Cacciola, Joel de Guzman, Dirk Schreib, Brad King, Giovanni Bajo, Eugene Gladyshev, and others provided helpful feedback and suggestions to refine the semantics, interface, and implementation of the library.
|Copyright © 2002, 2003 Eric Friedman, Itay Maman|