【问题标题】:Reflection in C++ [duplicate]C ++中的反射[重复]
【发布时间】:2023-03-27 19:40:02
【问题描述】:

我目前正在将一个游戏从用 ObjectiveC 编写的 Cocos2d 移植到用 C++ 编写的 Cocos2d-x。现在客观的 C 家伙已经使用反射从 json 对象填充模态类。在 C++ 中是否也一样 我们可以在 C++ 中使用反射吗?

亲切的问候

【问题讨论】:

标签: c++ cocos2d-x porting


【解决方案1】:

如 cmets 中所述,C++ has no reflection

默认解决方案是将您需要的所有符号注册到关联数组中,例如unordered_mapHere are examples of that.

【讨论】: