Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using constexpr for constant functions. #198

Closed
suikki opened this issue May 1, 2014 · 2 comments
Closed

Using constexpr for constant functions. #198

suikki opened this issue May 1, 2014 · 2 comments
Assignees
Milestone

Comments

@suikki
Copy link

suikki commented May 1, 2014

It would be nice if glm would use the constexpr keyword more.

For example constats:

    template <typename genType>
    GLM_FUNC_DECL genType pi();

Would instead be:

    template <typename genType>
    GLM_FUNC_DECL GLM_CONSTEXPR genType pi();

Also some functions like degrees() and radians() should use it too.

It would allow using glm constants and many functions like degrees to radians conversion in users own constexpr functions.

It would make sense to add constexpr to many more places too, like some vector and matrix constructors and math operations. It would make possible to move some matrix/vector math to compile time.

@Groovounet Groovounet self-assigned this May 4, 2014
@JesseTG
Copy link

JesseTG commented Jul 21, 2015

To really take advantage of this, C++14 has to be fully implemented in all the major compilers; C++11 heavily restricts what constexpr functions can do, but C++14 doesn't.

@Groovounet
Copy link
Member

This change has been made in master branch for GLM 0.9.7.1 release.
constexpr coverage could still be improved but that will be for later.

Thanks for contributing,
Christophe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants