Compile Time Argument Evaluation

Philippe Sigaud philippe.sigaud at gmail.com
Fri Jan 4 06:09:56 PST 2013


On Fri, Jan 4, 2013 at 2:59 AM, bearophile <bearophileHUGS at lycos.com> wrote:

>
>> Someday I'd like a function like this in Phobos, that verifies the
> formatting string at compile-time:
>
> ctwritefln!"%d %s"(5, "hello");
>
> Such function can be written with just a very light wrapper around a
> normal writefln (and later to something more optimized). This means that
> the actual template bloat can be minimized a lot, but not fully removed.
>

You can find a partial version in a template tutorial I put on github.

https://github.com/PhilippeSigaud/D-templates-tutorial/

Select either of the .md, .pdf, .html or .epub version of the tutorial.
It's section 5.11 "Statically-Checked Writeln".

The code worked the last time I launched the automated extractor/tester
(before 2.061).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130104/c2adc1b9/attachment.html>


More information about the Digitalmars-d-learn mailing list