Why compile error with enable_if

前端 未结 5 1925
小蘑菇
小蘑菇 2020-12-09 07:50

Why this does not compile with gcc48 and clang32?

#include 

template  
struct S {

    template 
    typename         


        
5条回答
  •  伪装坚强ぢ
    2020-12-09 08:57

    Because you use enable_if without using the template parameter T in your function templates. If you want to specialize for when the struct S has a certain template parameter value N, you'll need to use class template specialization.

    template  
    struct S {  };
    
    template 
    struct S::type>
    {
      ....
    };
    

提交回复
热议问题