Closed mjendruk closed 9 years ago
I think the problem is, that you actually want to use a dynamic cast. Both static and reinterpret casts are dangerous here as both assume that the Property is the first superclass.
Hm, you maybe right. Anyway, it doesn't change the problem.
Under OS X, you get warning in
ValueProperty.hpp
that instead ofreinterpret_cast
you should use astatic_cast
. This is a legit warning, because is thereinterpret_cast
is potentially dangerous. However, when doing so, you get an error, because you're trying to instantiate an undefined template . This errors occurs for all *.cpp files that do not includereflectionzeug/Property.h
. For exampleColorProperty.cpp
. If you try to includereflectionzeug/Property.h
you get an error that you're trying to inherit from an undefined class. The following image illustrates the problem and shows to possible fixes. I prefer #2: The problem with approach #2 is that adding own properties gets even more difficult because you would also have to implement the accept() method on your own for each property. I would like to use macros for this, so we could also hide the constructor forwarding. What do you think?