According to this question a copy constructor is called when the object is passed by value into another function.
I removed my copy constructor as a test but can still pass it by value. Does this make sense?
I commented out the copy constructor:
/*
Matrix4(const Matrix4<T>& m)
{
x.x = m.x.x; x.y = m.x.y; x.z = m.x.z; x.w = m.x.w;
y.x = m.y.x; y.y = m.y.y; y.z = m.y.z; y.w = m.y.w;
z.x = m.z.x; z.y = m.z.y; z.z = m.z.z; z.w = m.z.w;
w.x = m.w.x; w.y = m.w.y; w.z = m.w.z; w.w = m.w.w;
}
*/
typedef Matrix4<float> mat4;
Then this compiles and runs fine:
void ttt(mat4 hi){
}
void yyy(){
mat4 x;
ttt(x);
}
So perhaps the copy constructor is not called in such a case? What is happening here?