Variable number of constructor parameters depending on integer template

后端 未结 3 990
感动是毒
感动是毒 2021-01-03 02:51

I\'m writing a container storage class template that wraps a private std::array in order to add some functionality to it. The template parametrises the number o

3条回答
  •  别那么骄傲
    2021-01-03 03:19

    Don't get what you mean by this:

    Variadic arguments don't provide a mechanism to check how many of them there are, so they're right out

    template 
    Vector(T... args) {
        static_assert(sizeof...(args) <= N, "oops");
    }
    

    Should work..

提交回复
热议问题