注意,构造函数模板并不遮蔽(hide)隐式拷贝构造函数(implicit copy constructor)。如果类型完全吻合,隐式拷贝构造函数就会被产生出来并被调用。
基于1个网页-相关网页
Is there any way to make the implicit copy constructor use initialization lists? Is there any other way around manually writing the initialization list?
有什么方法可以利用隐式的拷贝构造函数初始化列表吗?有没有其他方式手动编写初始化列表吗?
We all know that the implicit copy constructor operates as follows: default construct all member variables, then assign each member variable the appropriate corresponding value.
我们都知道,这个隐式的拷贝构造函数操作如下:默认构建所有成员变量,然后分配每个成员变量相应的对应值。
Because a template constructor is never a copy constructor, the presence of such a template does not suppress the implicit declaration of a copy constructor.
由于模板构造函数终究不是拷贝构造函数,因此这种模板的出现并不会隐藏原来隐含的拷贝构造函数之声明。
应用推荐