Member function template with the number of parameters depending on an integral template parameter

前端 未结 4 539
闹比i
闹比i 2021-02-04 10:27

I have the following class template:

template
class MyClass;

where T is some type, N - num

4条回答
  •  萌比男神i
    2021-02-04 11:09

    May be, based on your 3rd variant, you can extract first argument from initializer list and deduce type by it

    template::type = 0>
    void foo(U u, T2... args)
    {
        MyClass({u, args...});
    }
    

提交回复
热议问题