Dne 3.3.2016 v 09:58 Shriramana Sharma via Digitalmars-d-learn napsal(a):
Hello people and thanks for your replies.

Jonathan M Davis via Digitalmars-d-learn wrote:

You can't overload a function and an eponymous template like that. They
need to have distinct names.
Why is it not possible for the overload to happen? After all, the compiler
should be able to identify which to use by seeing whether it is followed by
! or (), no?

Now, that being said, I don't understand why
you'd need to do anything with a template for CTFE in this case. Just
write the function and then call it in a context that requires a
compile-time result, and it should work. e.g.
OK but say I have a function which returns an array. If I use enum to CTFE
its result, then it is repeatedly included explicitly in all places it is
used, thereby using more memory.
you can still use immutable instead of enum

Reply via email to