Does a templated constructor override the implicit copy constructor in C++?

前端 未结 3 655
梦毁少年i
梦毁少年i 2021-01-18 05:29

Does a templated constructor (such as the following) override the implicit copy constructor?

template 
struct Foo
{
    T data;

    // ...

          


        
3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-18 06:17

    A templated constructor or assignment operator which looks like a templated [default constructor/copy constructor/move constructor/copy assignment operator/move assignment operator] is not really a [default constructor/copy constructor/move constructor/copy assignment operator/move assignment operator] and will not replace it or prevent it from being implicitly generated.

提交回复
热议问题