To allow more expressive constant expressions C++-11 introduces the keyword constexpr. Now with constant expression we really mean constant expression evaluated at compile time. So by saying that a function is constexpr means the compiler will compute the value at compile time. It can look like this:
constexpr int doubleIt(int x) {return x * 2;}
This function doubles its argument. Because it is declared with constexpr it can be used in places where a constant expression is needed. So now we can do this:
char char_array[doubleIt(6)];
Now there are some limiting rules for these constexpr functions. The body should be a single statement of the form "return expression;". The expression must only refer to other constexpr expressions. The later sounds reasonable since how could it be evaluated at compile time if not all parts of it was constant?
That could sound rather limiting but since functions can call other functions or even call themselves recursively some complexity can be computed. The conditional operator "?" is also allowed.
The constexpr functions is not limited to be used only for compile time computing. If called with a non const argument the function is computed in runtime.