lundi 7 août 2017

Copy const abstract class reference into lambda capture

I am looking for a way to capture a const abstract class reference into a lambda using C++ 11 (no 14 allowed).

What i tried now is to forward a tuple into an std::bind, but when I try to apply the tuple there is nonesense in the tuple.

void operator()(Args... args) const
{
    std::function<void(void)> taskFunction = std::bind([this](std::tuple<Args...> boundArgTuple)
    {
        apply_tuple(function, boundArgTuple);
    }, std::forward_as_tuple(args...));
}

The apply tuple function I'm using here receives a tuple with arbitrary values. What am I doing wrong, where am I invalidating the Args before they arrive at apply_tuple?

Aucun commentaire:

Enregistrer un commentaire