I was wondering, if there's a way to get the types/values of the captured variables of a lambda? - The usage scenario would be something alike;
int a = 5;
auto lamb = [a](){ return a; };
static_assert(std::is_same<typename get_capture_type<0>(lamb)::type, int>::value, "");
assert(get_capture_value<0>(lamb) == 5)
Note: get_capture_*<N>(lambda)
should obviously result in a compiler error, when N > #captured_variables
.
What I need is actually just a way to access the captures somehow, if possible. That is, I can do the template meta-programming myself.