C++ Boost.Any 与 Boost.Variant
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1366524/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Boost.Any vs. Boost.Variant
提问by the_drow
I'm having trouble choosing between Boost.Any and Boost.Variant.
When should I use each one?
我无法在 Boost.Any 和 Boost.Variant 之间进行选择。
我应该什么时候使用每一种?
What are the advantages and disadvantages of each?
各自的优缺点是什么?
I am basically looking to store some states from external sources.
我基本上希望从外部来源存储一些状态。
采纳答案by drby
Have you looked at the comparisonin the variant library already?
您是否已经查看了变体库中的比较?
(Not sure what states from external sources are, so it's kind of hard to say what's more appropriate for you.)
(不确定来自外部来源的状态是什么,所以很难说哪个更适合你。)