从字符串到对象标识符的C ++转换 [英] C++ conversion from string to object identifier
本文介绍了从字符串到对象标识符的C ++转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在用C ++编写程序,该程序从外部文件中读取一些数据,以便设置静态变量的值.
I'm writing a program in C++ that reads in some data from an external file in order to set the values of static variables.
是否可以将字符串转换为对象标识符? (例如,将字符串"CheckBox :: Unchecked"转换为对象CheckBox :: unchecked的标识符)
Is it possible to convert a string to an object identifier? (e.g. convert the string "CheckBox::Unchecked" into an identifier for the object CheckBox::unchecked)
推荐答案
否.如果要执行此操作,则必须手动解析字符串并自己完成工作.
No. If you want to do this, you will have to parse the string manually and do the work yourself.
这篇关于从字符串到对象标识符的C ++转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文