Closed manos523 closed 6 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.
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?
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:
char*
because the type is held in a Value
, which is a variant, and therefore the type gets generalised and too much information is lost.string_view
from some functions, where you wish to retrieve a string. The advantage being that the returned string isn't duplicated anywhere. I think perhaps there needs to be support for string_view
being accepted as a general type for parameters. Another solution is to extend the value map in ponder_ext
with a user type.ValueMapper
needs to become part of the runtime functionality, with a more accurate type reflection system backing this up.Apologies for the problems. This is an ongoing project with some limitations.
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.