expanding variadic into format
Codifies
a at b.com
Wed Oct 31 12:13:57 UTC 2018
On Wednesday, 31 October 2018 at 12:09:04 UTC, Stanislav Blinov
wrote:
> On Wednesday, 31 October 2018 at 11:53:52 UTC, Codifies wrote:
>
>> void printValue(Font fnt,float x, float y, string frmt, ...)
>> {
>> /* matrix math and other stuff removed for readability */
>> string message = format(frmt, _arguments);
>
>>
>> is there some way to somehow transfer my input variadic into
>> formats variadic ?
>
>>> Just to confirm, format there is std.format:format right?
>>> Because that isn't using C variadics, its using template
>>> variadics.
>
> ...as in:
>
> ```
> void printValue(Args...)(Font fnt, float x, float y, string
> frmt, auto ref Args args) {
> // ...
> import std.functional : forward;
> string message = format(frmt, forward!args);
> // ...
> }
> ```
thats fantastic thanks so much, can you explain a little more
about whats going on here ?
More information about the Digitalmars-d-learn
mailing list