Closed enojoker closed 1 year ago
some compile time mapping between member variable name
It might not be possible to do this at compile time if the member variable name is not a compile-time constant.
There is refl::runtime::invoke which does what you're attempting to do in your example.
first of all, thanks for this great library. I'm a bit of a newbie to c++ metaprogramming. Hope my question is clear.
Following your serialization example, I tried to write a getter function that takes a member's name as input for a reflected type. The code below is what I got so far. It feels a bit awkward for a getter function to iterator through all members to return the value.
I'm thinking about doing some compile time mapping between member variable name and member index so that I can use
static constexpr decltype(auto) get(U&& target) noexcept
fromfield_descriptor
. But couldn't get it working ...Just wondering if you were to implement a generic getter function how would you do it?
Many thanks!