Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The struct vec takes a template parameter T, and it's constructor takes a different template parameter U. Therefore, you must specify both template directives when defining the constructor; one for the class type, and one for the constructor's argument.


Edit: re-wording this reply.

I guess what surprised me is I would almost expect it to look something like this...

template <> vec<3,int> ::vec(template <> const vec<3,float> &v) : x(int(v.x+.5f)),y(int(v.y+.5f)),z(int(v.z+.5f)) {}

I can tell that is silly but still.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: