Template specialized functions creating runtime instructions?

ads relay.public.adnan at outlook.com
Wed Aug 21 00:11:23 UTC 2019

On Wednesday, 21 August 2019 at 00:04:37 UTC, H. S. Teoh wrote:
> On Tue, Aug 20, 2019 at 11:48:04PM +0000, ads via 
> Digitalmars-d-learn wrote: [...]
> 2) Deducing the string as you describe would require CTFE 
> (compile-time function evaluation), which usually isn't done 
> unless the result is *required* at compile-time.  The typical 
> way to force this to happen is to store the result into an enum:
> 	enum myStr = fizzbuzz!...(...);
> 	writeln(myStr);
> Since enums have to be known at compile-time, this forces CTFE 
> evaluation of fizzbuzz, which is probably what you're looking 
> for here.
> T

Thank you for clearing those up. However even if I force CTFE 
(line 35), it doesn't seem to help much.


More information about the Digitalmars-d-learn mailing list