I am recieving the following compile warning/error message from g++:
this is the code that is giving it:main.cpp:8: warning: cannot pass objects of non-POD type `class Vector4d'
through `...'; call will abort at runtime
now, here is the definition of Magnitude:Code:#include "3DMath.h" int main(int argc, char **argv) { Vector4d x= Vector4d(2,4,5,1); float mag = Magnitude(x); printf("%f\n",x); // dont worry, 3DNath.h links the stdio.h header return -1; };
what exactly am I doing wrong in the use of the templated function as I am just learning templates(decided that after a year, I really did need to use them).Code:template <class Vector>float Magnitude(Vector vVector) { return float(sqrt( (vVector.x * vVector.x) + (vVector.y * vVector.y) + (vVector.z * vVector.z))); };



LinkBack URL
About LinkBacks


