Top "Compile-time-constant" questions

Use this tag for questions related to the compile time constant, a constant value that is known at compile time.

How to define a const double inside a class's header file?

Inside the header file of my class, I am trying the following and getting compiler complaints: private: static const double …

c++ constants static-members compile-time-constant
constexpr overloading

Related: Function returning constexpr does not compile I feel like constexpr is limited in usefulness in C++11 because of the …

c++ c++11 overloading compile-time-constant constexpr
Is there no built-in way to compute a power at compile time in C++?

I have the following very simple template. As I learned, ^ is not the exponential operator. Now I'm looking for a …

c++ templates compile-time-constant
Compiletime build up of std::regex

Since I know the regexes at compiletime, and building up a regex is in O(2^m) where m is the …

c++ regex c++11 compile-time-constant
Difference between final variables and compile time constant

What is the difference between final variables and compile time constants? Consider the following code final int a = 5; final int …

java compile-time-constant
Using a variable in a Java case statment

I am making an expression parser for a calculator. The expressions will contain a variable, for instance, a user could …

java switch-statement compile-time-constant