I
I
IliaNeverov2021-08-08 13:41:48
C++ / C#
IliaNeverov, 2021-08-08 13:41:48

How to take out the definition of a template class (variable) constructor outside of it?

How to take out the definition of a template class (variable) constructor outside of it?
If I write like this:

template<typename ...Args>
class UniformBuffer
{
public:
  UniformBuffer(Args... arg);
};

template<typename ...Args>
UniformBuffer::UniformBuffer( Args ...arg)
{ 
//код
}

then the compiler writes: the list of template arguments must match the list of parameters. Please tell me why this is and how to fix it

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wataru, 2021-08-08
@IliaNeverov

It should be like this:

template<typename ...Args>
UniformBuffer<Args...>::UniformBuffer(Args... arg)
{ 
//код
}

Your template is the class itself, not its methods.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question