Template constructor in a class template - how to explicitly specify template argument for the 2nd parameter?

后端 未结 3 799
借酒劲吻你
借酒劲吻你 2020-12-03 15:26

Template constructor in a class template - how to explicitly specify template argument for the 2nd parameter?

compile error when tried to explicit specify template

3条回答
  •  醉酒成梦
    2020-12-03 15:34

    You can explicitly specify the template arguments for your calls to foo because those member functions foo have names -- and the template arguments are part of that name.

    That doesn't work with constructors because a constructor has no name. You can't (directly) call a constructor. A constructor is of course called when you create an object, but the call is generated code.

提交回复
热议问题