On 02/03/2016 11:39 PM, Andrea Fontana wrote:
On Wednesday, 3 February 2016 at 17:49:39 UTC, Marc Schütz wrote:
On Wednesday, 3 February 2016 at 16:07:59 UTC, Messenger wrote:
What is a good way to try to force it? Using enum? Then optionally
copying the value once to avoid the "manifest constant" copy/paste
behaviour, where applicable?
template forceCTFE(alias expr) {
alias forceCTFE = expr;
}
auto value = forceCTFE!(some_expression());
Interesting :)
Thank you!
I would use enum forceCTFE(alias expr)=expr; though. With alias it won't
force compile-time evaluation of expressions that can be interpreted as
symbols.