Unpacking arguments of a functional parameter to a C++ template class

后端 未结 1 586
小鲜肉
小鲜肉 2020-12-16 21:22

I have a question involving functional template arguments to template classes in C++.

I\'d like to define a template class Foo taking a single template

1条回答
  •  渐次进展
    2020-12-16 22:23

    Declare a primary template and leave it unimplemented.

    template
    struct foo;     // unimplemented primary template
    

    Then provide a partial specialization that matches function types as the template argument.

    template
    struct foo
    {
        using args_t = std::tuple;
    };
    

    You can access the nested type as

    foo::args_t
    

    Live demo

    0 讨论(0)
提交回复
热议问题