expanding variadic into format

Stanislav Blinov stanislav.blinov at gmail.com
Wed Oct 31 12:09:04 UTC 2018


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);
     // ...
}
```


More information about the Digitalmars-d-learn mailing list