c++ - unpack variadic template with scoped_ptr -


i'm using variadic templates, , find way unpack parameters

template <typename kernel_type, typename ...kernel_types> class metakernel : public mykernel<kernel_type, kernel_types...> { public:     metakernel (         unsigned int m,         unsigned int n,         const kernel_type& kernel_,         const kernel_types&... kernels_     ) :         mykernel<kernel_type, kernel_types...>(m, n)     {         ks.set_max_size(sizeof...(kernel_types));         ks.set_size(sizeof...(kernel_types));         // each kernels_, add myobskernel ks         // ks[sizeof...(kernel_types)].reset((new myobskernel<kernel_type, kernel_types...>(kernels_, prototypes_, m, n))...);     } private:     array < scoped_ptr < myobskernel<kernel_type, kernel_types...> > > ks; } 

from documentation (http://en.cppreference.com/w/cpp/language/parameter_pack), saw how unpack this:

int dummy[sizeof...(ts)] = { (std::cout << args, 0)... }; 

but i'm working on scoped_ptr table, need initialize "reset". solution not work. how can unpack parameters using scoped_ptr ?

thanks help, jerome

you may initialize std::array initializer-list. following may help: https://ideone.com/ptwatb

metakernel (unsigned int m, unsigned int n, const kernel_type& kernel_, const kernel_types&... kernels_) :     mykernel<kernel_type, kernel_types...>(m, n),     ks({scoped_ptr<myobskernel<kernel_type, kernel_types...> >(new myobskernel<kernel_type, kernel_types...>(kernels_, kernel_, m, n))...}) { } 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -