veselink1/refl-cpp

Variadic expansion order is guaranteed for brace initializer expressions

martinitus opened this issue · 2 comments

Hi folks,

I just stumbled over the following block in your code:

refl-cpp/refl.hpp

Lines 1442 to 1446 in fbdb82c

// This whole jazzy workaround is needed since C++ does not specify
// the order in which function arguments are evaluated and this leads
// to incorrect order of evaluation (noticeable when using indexes).
// Otherwise we could simply do std::make_tuple(f(Ts{}, Idx)...).
template <typename F, typename T, typename... Ts, size_t I, size_t... Idx, typename... Carry>

I had similar issues and found the following soltion:

https://stackoverflow.com/questions/61229653/mapping-odbc-bindings-to-function-callback-via-function-argument-evaluation-orde

However, this is apparently broken in current MSVC:

https://developercommunity.visualstudio.com/content/problem/1015101/invoking-a-constructor-using-brace-constructor-syn.html?childToView=1095038#comment-1095038

Regards, Marti

Hello Marti,

Thanks for the suggestion. I too would like to see the current implementation be replaced with a simpler one. We are aiming for good support for the last two versions of MSVC, v142 & v141. Therefore, unfortunately, we will not be able to make the suggested changes while we are still supporting those toolchains.

Regards, Veselin

I will close this issue now, as is it likely to be at least a couple of years before support for those can be dropped.