Constructor arguments from tuple

后端 未结 5 954
礼貌的吻别
礼貌的吻别 2020-12-01 19:41

Suppose I have a template which is parametrized by a class type and a number of argument types. a set of arguments matching these types are stored in a tuple. How can one pa

5条回答
  •  醉酒成梦
    2020-12-01 19:59

    C++17 has std::make_from_tuple for this:

    template 
    struct foo
    {
      std::tuple args;
      T gen() { return std::make_from_tuple(args); }
    };
    

提交回复
热议问题