T
toton
I have a class like
template<typename T>
class my_class{
public:
int x_;
public:
template<typename U>
my_class(const my_class<U>& other ) : x_(other.x_){}
};
Now this one is not copy ctor in general. However in cases like when T
and U are of same type, will it be a copy ctor, or still machine
generated one will be used?
like
my_class<int> a_class;
my_class<int> other(a_class); => here what I am finding is that auto
generated copy ctor is used.
template<typename T>
class my_class{
public:
int x_;
public:
template<typename U>
my_class(const my_class<U>& other ) : x_(other.x_){}
};
Now this one is not copy ctor in general. However in cases like when T
and U are of same type, will it be a copy ctor, or still machine
generated one will be used?
like
my_class<int> a_class;
my_class<int> other(a_class); => here what I am finding is that auto
generated copy ctor is used.