![]() |
Home | Libraries | People | FAQ | More |
作為一個可識別的聯合空器,Variant 庫共享了 Any 庫的許多相同特性。不過,由於沒有一個庫可以完全包含另一個庫的所有特性,所以沒有哪一個庫被推薦優於另一個庫。
可以說,Boost.Variant 有幾個優於 Boost.Any 之處,如:
當然,Boost.Any 也有優於 Boost.Variant 之處,如:
本庫的目標是 100% ANSI/ISO C++ 的兼容性。但是,這是不可能的,因為
Type Traits 庫的
type_with_alignment 工具固有的不可移植性。儘管在實際中,還沒有發現某個編譯器或平台有這方面的問題。
此外,我們還做出了重大努力,在各種編譯器缺陷和標準符合度問題下保證正確的功能。到目前為止,本庫的測試組件至少在以下編譯器上編譯和測試通過,測試是針對各種基本和高級功能的:
| 基本 |
variant<T&>
|
make_variant_over
|
make_recursive_variant
|
|
|---|---|---|---|---|
| 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 |
最後,在 CVS 中的測試組件當前狀態可以在 Test Summary 頁找到。不過請注意,該網頁按天報告在 Boost CVS 中的內部版本代碼的變化,所以與 Boost 發佈版的代碼狀態會不匹配。
由於
variant 的實現大量使用了模板,所以常常會出現與模板實例化深度、編譯器內存等有關的問題。本節試圖對在常用編譯器上會遇到的常見問題提出一些建議。
(本節還在完成中,歡迎提出建議和反饋。請將任何有用的經驗發送到 Boost-Users 列表)。
Eric Friedman and Itay Maman designed the initial submission; Eric was the primary implementer.
Eric is also the library maintainer and has expanded upon the initial
submission -- adding
make_recursive_variant,
make_variant_over, support for
reference content, etc.
Andrei Alexandrescu's work in [Ale01a] and [Ale02] inspired the library's design.
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 |