3 ms·
https://github.com/ssloy/tinyrenderer/blob/master/geometry.cpp#L3 https://github.com/ssloy/tinyrenderer/blob/master/geometry.c... What's going on there with th
by jahnu 11y ago
https://github.com/ssloy/tinyrenderer/blob/master/geometry.cpp#L3 https://github.com/ssloy/tinyrenderer/blob/master/geometry.c...
What's going on there with the template<> template<> ?
- sclangdon 11y agoThe 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.
- jahnu 11y agoEdit: 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.