boost :: TypeIndex :: Type_id<>()。pretty_name()不同系统/编译器/boost versions的差异?

发布于 2025-02-13 11:34:26 字数 466 浏览 0 评论 0 原文

我正在尝试运行一个项目,其中 boost :: typeIndex :: type_id<>()。pretty_name()用于将className转换为字符串,以将其注册在工厂中。

例如,A类应转换为“ A” ,B类TO “ B” 等。

这是通过使用 boost ::的Linux GCC环境中的。 typeIndex :: type_id< a>()。pretty_name()

当我尝试使用MSVC 14和Boost 1.78.0在Windows中运行该项目时,类名称以这种方式进行转换:

A类转换为“ A类”“ ”,B类将转换为> >“ B类“ ,等等……

这是因为OS差异或编译器差异或某些增强参数或增强版本差异吗?

I am trying to run a project where boost::typeindex::type_id<>().pretty_name() is used to transform the classname to a string, to register it in a factory.

For example class A should transform to "A", class B to "B", etc.

This is working in a Linux gcc environment by using boost::typeindex::type_id<A>().pretty_name().

When I try to run the project in Windows with MSVC 14 and Boost 1.78.0 however class names are transformed in this way:

class A transforms to "class A", class B transforms to "class B", and so on...

Is this because of the OS differences or the compiler differences or some boost parameters or boost version differences?

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

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

发布评论

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

评论(1

夏见 2025-02-20 11:34:26

boost's std :: type_info 纯粹是实现dippertiment-depentent的示例,请注意cppreference对应于您的案件。

Boost’s docs state this library is just a wrapper for std::type_info which is purely implementation-dependent, notice how the example on cppreference corresponds to your case.

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