Cuberite Forum
Using c++11 constexpr - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Using c++11 constexpr (/thread-1776.html)



Using c++11 constexpr - Tommy Santerre - 02-15-2015

I'm doing something that could benefit from c++11 constexpr and since there is currently no use of the feature yet I wanted to make sure it's okay to use them as documented in the contributing.md file.

constexpr allows us to define function that can be run at compile time or run-time. When an argument of a constexpr is a constexpr itself (a constant or constexpr function) the compiler will instead insert the result of the function call directly. I thinks this is something we should take advantage of.

http://www.cprogramming.com/c++11/c++11-compile-time-processing-with-constexpr.html

VS2013 doesn't have support for constexpr so I guess this will have to wait :/