Since I know Java, c # language, reflected the function after
Is hope also supports c + + function, but the Internet ages, are still say c + + without this function,
Really want to have to go to write a class, some specifications, can make to
In fact I also wrote a simple library, can complete the basic requirements
But I always have a problem
Such as BCB, Visual Studio IDE, after we enter the object name
Often there will be a hint, what is the object function of the available hint Windows out
This function is implemented?
Is pure analytical source file, record down what are the variables, the object function is available, like this?
Because I usually do to project need to deal with the often struct structure
Different structure, members of different, different types, is often the need for them to do some UI interface to display
Has been in the pursuit of what method can automatically identify structure, traverse a member variable, the function of automatically generated report
Do people have similar needs and solutions?
Thank you & lt; (_ _) & gt;
CodePudding user response:
Can refer to Qt Meta Object system, (Meta Object),But need to explicitly "registered" type again,
Also you can refer to the
https://github.com/bytemaster/boost_reflect
boost_reflect
CodePudding user response:
Qt moc only do compile-time reflection (the general called introspection), no runtime reflection (QML is possible. After all, is the runtime interpretive execution js), in addition, the realization of the moc is very awkward, to insert some in the source of macro as a marker positioning, it is also does not have its own compiler and necessity method, reflection is the basis of RTTI, or kung fu in the compiler, the program can look very conciseCodePudding user response: