rttrorg / rttr

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

how to get field address of nested struct? #279

Open bruceauyeung opened 4 years ago

bruceauyeung commented 4 years ago

I have 2 struct definitions:

typedef struct {
int a;
int b;
}A;
typedef struct {
    A stA;
    int c;
    int d;
}B;

I try to register struct B like this:

    registration::class_<B>("B")
        .constructor<>()(policy::ctor::as_raw_ptr)
        .property("a", &B::stA::a);

but the msvc 2017 compiler said that name before :: should be namespace name or class name. how can i get field address of nested struct?