boost-ext/reflect

Broken forwarding in visit

tgurriet opened this issue · 2 comments

Hello again,

There is a little issue with the get function. Something like:

struct S{int a; int b};
S s;

auto & a = reflect::get<0>(s);

doesn't work, as reflect::get<0>(s) returns an rvalue reference.

I believe the issue is with the visit function, and is related to https://stackoverflow.com/questions/44219864/perfect-forwarding-of-variables-declared-with-structured-binding.

Made the fix, works on gcc and clang but msvc complains, though I think it's not related to this issue but rather that msvc has problems with returning rvalues from the nth_pack_element

Thanks, you're the man!