On Tuesday, 9 June 2015 at 20:01:24 UTC, Walter Bright wrote:
On 6/9/2015 4:25 AM, "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= <[email protected]>" wrote:
When constexpr is part of the prototype you know that it isn't supposed to do
substantial work.

That doesn't follow.

What doesn't follow? All my constexpr functions are simple. I absolutely don't want to solve N-Queens problems at CT.

Without it, you risk the compiler spending a lot of time computing constants/tables that should be done at runtime to save compile time and object code size. And since C++ programmers expect that level of control, it would have
ended up as a pragma if it was not part of the language?

This is just made up problems.

Nah, sometimes I want my big lookup tables to be evaluated at runtime so I don't get bloated binaries. But neither C++ or D cuts it. Because sometimes I want the code that uses constant indexing to look it up in the LUT, but actually generate the LUT at runtime.

Can D check that a parameter is a CT value so that one can overload on it? That would work.

Reply via email to