RTTI 的 Boost 库

发布于 2024-08-18 06:07:53 字数 53 浏览 2 评论 0 原文

我应该使用哪个 boost 库在我的项目中实现 RTTI?它是 Statechart 库吗?

which boost library should I use to implement RTTI in my project?? Is it Statechart library?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

只是在用心讲痛 2024-08-25 06:07:53

RTTI 内置于 C++ 语言中,具有 dynamic_casttypeid。您不需要增强即可使用它。

RTTI is built into the C++ language, with features like dynamic_cast and typeid. You don't need boost to use it.

苍白女子 2024-08-25 06:07:53

RTTI 内置于 C++ 语言中。不过,您会在 Boost 中找到一些与 RTTI 相关的便捷工具,例如 Boost.TypeTraits 使您能够检查诸如 is_base_of()has_trivial_constructor() 和其他内容的负载。 Boost.FunctionTypes 也可能是值得一看。

RTTI is built into the C++ language. However, you'll find a few RTTI-related, convenient tools in Boost, e.g. Boost.TypeTraits which enables you to checks such as is_base_of(), has_trivial_constructor() and loads of other stuff. Boost.FunctionTypes might also be worth checking out.

三五鸿雁 2024-08-25 06:07:53

C++ 语言中内置了一个简单的 RTTI,但您可以选择退出它(减少二进制大小)。您可以在这里阅读C++ 中的 RTTI

如果您正在寻找更强大的东西(例如反射),不幸的是没有简单的解决方案,但它计划用于 C++0x 之后。有人建议使用 Boost 的 Reflection 库,但它尚未被接受(还?)。您可以在这里找到它:http://boost-extension.blogspot.com/

A simple RTTI is built into the C++ language, although you can opt out of it (decreases binary size). You can read about RTTI in C++ here.

If you're searching for something more robust (e.g. Reflection) unfortunately there's no simple solution for that, but it's planned for after-C++0x. There was a Reflection library suggested for Boost, but it hasn't been accepted (yet?). You can find it here : http://boost-extension.blogspot.com/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文