Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are GLM constructors all explicit?

Tags:

c++

glm-math

I have started to use the GLM library in my code. Seems pretty good but I can't do things like this:

void foo (const glm :: vec3 & arg);

foo ({x, y, z});

because the constructors are all explicit.

This is starting to annoy the hell out of me. I can't think of a good reason to prohibit implicit construction of such simple value types. Have the authors blindly followed some irrelevant dictum or do they know something I don't?

like image 505
spraff Avatar asked Aug 18 '13 09:08

spraff


1 Answers

In the newest version he's added C++11; see the changes for 0.9.5.0 in the README

https://github.com/g-truc/glm

and download it at g-truc

http://glm.g-truc.net/

I just dropped it into my project and all seems to be well. The initializer lists are a welcomed addition.

Also, I'll agree that putting spaces around the :: makes parsing that signature a little difficult, at least for my brain.

like image 83
Najati Avatar answered Oct 19 '22 06:10

Najati