vendredi 19 février 2021

Is it possible to write variadic template constructor initializing all members of a class/struct?

Is it possible to achieve this:

struct S
{
    int a;
    std::string s;

    template<typename... Args>
    S(Args... args)
    :  // what next?
    {
        // what next?
    }
};

Or is there any other way to achieve (something like) this? (std::tuple?)

Aucun commentaire:

Enregistrer un commentaire