一个模板构造函数(如下所示)是否会覆盖隐式复制构造函数?
template <class T>
struct Foo
{
T data;
// ...
template <class U>
Foo(const Foo<U> &other) : data((T)doSomethingWith(other.data)) {}
// ...
};
如果是这样,如果通过值而不是常量引用传递
other
,它仍然会覆盖吗?如果是这样,有没有任何方法可以避免显式定义复制构造函数?