Why are GLM constructors explicit?

I started using 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.

It starts to annoy me. I cannot come up with good reasons to prohibit the implicit construction of such simple value types. Did the authors blindly follow some inappropriate sayings or do they know something that I don’t know?

+6
source share
1 answer

In the latest version, he added C ++ 11; see changes for 0.9.5.0 in README

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

and upload it to g-truc

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

I just threw it into my project and everything seems to be fine. Initializer lists are a welcome addition.

In addition, I agree that placing spaces around :: makes parsing this signature a bit complicated, at least for my brain.

+1
source

Source: https://habr.com/ru/post/951958/


All Articles