Why is it not possible to overload class templates?

后端 未结 3 751
半阙折子戏
半阙折子戏 2020-12-01 13:28

Reading this question made me wonder: is there a technical reason for disallowing class templates overloads?

By overloading, I mean having several templates with the

3条回答
  •  孤城傲影
    2020-12-01 14:19

    You cannot "overload" type parameter, non-type argument and template template parameter, but you can specialize variadic template:

    template 
    struct Foo;
    
    template 
    struct Foo {};
    
    template 
    struct Foo {};
    

提交回复
热议问题