templates - Constructing c++ parameter pack from vector -
although final use case different, want solve prolem:
// assumption: length of fields same of vector. template<typename... fields> void increment(const string &name, const std::vector<string> &fields) { // *** how implement function can call like: // specializedcounter<typeof(fields)...> counter = new counter<typeof(fields)>(); // counter->increment(name, field_pack); } template <typename... fields> class specializedcounter : public counter<fields...> { // public counter provides generalized interface how increment counters. void increment(const string &name, const fields... &fields) { // know how implement this. } };
the crux of question is, how transform list/vector or matter iterable type parameter pack. happy if question dup! :)
Comments
Post a Comment