mardi 31 juillet 2018

Using remove_reference in function header

Say I have the following:

template <typename... A>
class MyClass
{
public:

    void func(A... args)
    {
        // do stuff
    }
};

What I really want is for func() to take l-value references, so something like this:

template <typename... A>
class MyClass
{
public:

    void func(std::remove_reference<A>::type&... args)
    {
        // do stuff
    }
};

This doesn't compile; is this sort of thing possible? Thanks.

Aucun commentaire:

Enregistrer un commentaire