c++ template args inside class

  args, c++, templates

Hello I want to store template arguments inside class, see following code:

template<typename... Args>
class Test {
    private:
    Args... args;
    public:
    Test(Args... args) {
        this->args = args;
    }
}

But I am getting error:

main.cc:4:9: error: expected unqualified-id before ‘...’ token
    4 |     Args... args;

When I remove dots it says:

main.cc:4:10: error: parameter packs not expanded with ‘...’:
    4 |     Args args;

Source: Windows Questions C++

LEAVE A COMMENT