Creating std.format.format warpper
Anonymouse
zorael at gmail.com
Sat May 1 16:21:33 UTC 2021
On Saturday, 1 May 2021 at 09:10:09 UTC, novice2 wrote:
> Hello.
>
> Can please anybody help me create template format2 like
> std.format.format,
> so it can access to format string (change it for example)
> then instantiate std.format.format template in
> compile-time-checkable way
Since `std.format.format` already does this, just create
templates that simply pass on their arguments to it and let it
validate them. "Prefixing" the format pattern is trivially done
(in a separate template) before deferring to `format`.
https://run.dlang.io/is/QsYCkq
If you're not familiar with templates and the difference between
compile-time and runtime parameters, there are several good
write-ups, such as the template chapter of Ali Çehreli's book
(which is available online at
http://ddili.org/ders/d.en/templates.html).
More information about the Digitalmars-d-learn
mailing list