boost any library的典型用法是什么? [英] What is the typical usage of boost any library?

查看:74
本文介绍了boost any library的典型用法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用boost.any库有什么优势?你能给我一些现实生活中的例子吗?为什么通过在对象层次结构的根中具有某种通用类型并创建具有该基本类型的容器而无法实现相同的功能?

What are the advantages of using boost.any library ? Could you please give me some real life examples ? Why the same functionality couldn't be achieved by having some generic type in the root of object's hierarchy and creating containers with that base type ?

推荐答案

我认为应该始终首选Boost.Variant,因为它是非侵入性的,并且仍然需要非常结构化的编程.

I consider that Boost.Variant should always be preferred as it's non-intrusive and still calls for very structured programming.

但是我想boost.any的主要思想是提供等效的Java和C#对象类型.这是说是的,我们可以的"的一种方式! :-)

But i guess the main idea behind boost.any is to provide the equivalent of java and c# object types. It's a way of saying "yes we can" ! :-)

这篇关于boost any library的典型用法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆