rttrorg / rttr

C++ Reflection Library
https://www.rttr.org
MIT License
3.12k stars 430 forks source link

Casting void pointers to rttr:type pointers #322

Open VRrkrishnan opened 2 years ago

VRrkrishnan commented 2 years ago

I've been going over the documentation and I don't see if there's a way to do what the title says. This is roughly the C++ code of what I'm trying to do.

using namespace rttr;
void *someData = SomeFunction()
type myType = type::get_by_name("MyReflectionType");
variant var = myType.get_property_value("MyProperty", someData);

This obviously doesn't work but I don't know how I can cast someData as myType. Is my workflow wrong? Any help would be greatly appreciated!