Is there any use for named parameters into template template parameters

后端 未结 1 1961
感动是毒
感动是毒 2020-12-10 14:09

If I need to define a template foo function with a template-template parameter, I usually do the following:

// Notice that the template paramete         


        
相关标签:
1条回答
  • 2020-12-10 14:34

    [basic.scope.temp]/p1:

    The declarative region of the name of a template parameter of a template template-parameter is the smallest template-parameter-list in which the name was introduced.

    (Now try saying that 10 times.)

    It can be used inside that list. For instance,

    template < template<class T, T t> class TP > class foo {};
    //                           ^  ^-----T's scope ends here
    //                           |
    //                           T can be used here
    
    foo<std::integral_constant> bar;
    
    0 讨论(0)
提交回复
热议问题