C++ template specialization of constructor

后端 未结 7 1009
醉话见心
醉话见心 2021-02-05 17:15

I have a templated class A and two typedefs A and A. How do I override the constructor for A ? The following does not wor

7条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-05 17:39

    This may be a little bit late, but if you have access to c++11 you can use SFINAE to accomplish just what you want:

      template , A>::value>::type // Can be called only on A
      > 
      A() {
        // Default constructor
      }
    

    Working example

提交回复
热议问题