billyquith / ponder

C++ reflection library with Lua binding, and JSON and XML serialisation.
http://billyquith.github.io/ponder/
Other
640 stars 93 forks source link

Does (Ponder C++ Reflection Library) support pointers to types? #65

Closed manos523 closed 6 years ago

manos523 commented 7 years ago

Does (Ponder C++ Reflection Library) support pointers to types? For example, if I try char * the following error appears: 'PONDER_TYPE_NOT_REGISTERED'

Unlikely, that makes no sense to me because I have already declared that type using the following macro PONDER_TYPE(char *)

The same problem exists for any pointer type like int , float etc.

Thanks in advance for your help.

billyquith commented 7 years ago

For example, if I try char * the following error appears: 'PONDER_TYPE_NOT_REGISTERED'

What are you trying to do?

There are different aspects of reflection. There is compile-time reflection, like type-traits, which is useful for implementing Ponder and general template meta-programming. And there is runtime reflection, which is "what is in this class", get/set values, etc.

Ponder supports "properties", which are a generalisation of members. Pointers are ambiguous: what is a char*? So you may want to wrap the pointer with get and set accessors and then use these via a property.

manos523 commented 7 years ago

Thank you for your prompt response. What I am trying to do is to use existing classes with Ponder with properties like pointers to types. For example, how should I declare a Person class to Ponder (like the example class coming with Ponder) and having the constructor receiving a "char *" argument instead of nothing?

billyquith commented 7 years ago

Short answer: I think you are expected to use std::string for strings, which is from CAMP, the original library. Once you start using char* ambiguity starts to appear. In fact they've changed C++11 to address some of these issues.

Long answer:

Apologies for the problems. This is an ongoing project with some limitations.