|
|
x*x is inlined isn't it?| As constexpr means a compile time function |
| and we know if it is invoked with a constant, the result is a constant known at compile time -- but does that mean it executes the multiplication during compilation? |
| If it does, couldn't we say constexpr functions are "super-inlines"? |
| And, when invoked with a variable, what do we win compared to an ordinary inline? I mean, the code x*x is inlined isn't it? |
| couldn't we say constexpr functions are "super-inlines"? |
x*x in this case, is not inlined, then in what respects does the constexpr function differ from an inline function and a regular function?| Seems to me you are not taking my question seriously. Specifically: |
| What I meant was, if parameters are not known at compile time, what difference does it have from an inline version? |
| If the code, x*x in this case, is not inlined, then in what respects does the constexpr function differ from an inline function and a regular function? |
|
|
| constexpr |
|
|
| Jaun wrote: |
|---|
| , does multiplication occur at compile time if and only if its arguments are known at compile time, as in: |
12.5 was a non compile time non const variable, that would be an error.| cppreference wrote: |
|---|
| The constexpr specifier declares that it is possible to evaluate the value of the function or variable at compile time. |