Is it possible to force CTFE?

Jacob Carlborg doob at me.com
Thu Sep 27 11:46:53 PDT 2012


On 2012-09-27 15:01, bearophile wrote:
> Tommi:
>
>> 2) Is it possible to specialize a function based on whether or not the
>> parameter that was passed in is a compile time constant?
>
> I am interested in this since some years. I think it's useful, but I
> don't know if it can be implemented. I don't remember people discussing
> about this much.

There's the if (__ctfe) hack. Also using only template parameters will 
force the function to be CTFE.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list