Re: expanding variadic into format

2018-10-31 Thread Codifies via Digitalmars-d-learn
On Wednesday, 31 October 2018 at 12:54:52 UTC, Stanislav Blinov wrote: On Wednesday, 31 October 2018 at 12:13:57 UTC, Codifies wrote: [...] [...] As rikki already explained, std.format is a variadic template, which gets expanded into argument list at compile time. That's why it can't be u

Re: expanding variadic into format

2018-10-31 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 31 October 2018 at 12:13:57 UTC, Codifies wrote: On Wednesday, 31 October 2018 at 12:09:04 UTC, Stanislav Blinov wrote: ``` void printValue(Args...)(Font fnt, float x, float y, string frmt, auto ref Args args) { // ... import std.functional : forward; string message

Re: expanding variadic into format

2018-10-31 Thread rikki cattermole via Digitalmars-d-learn
On 01/11/2018 1:08 AM, Codifies wrote: On Wednesday, 31 October 2018 at 11:56:31 UTC, rikki cattermole wrote: On 01/11/2018 12:53 AM, Codifies wrote: [...] Just to confirm, format there is std.format:format right? Because that isn't using C variadics, its using template variadics. thought

Re: expanding variadic into format

2018-10-31 Thread Codifies via Digitalmars-d-learn
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, _a

Re: expanding variadic into format

2018-10-31 Thread Codifies via Digitalmars-d-learn
On Wednesday, 31 October 2018 at 11:56:31 UTC, rikki cattermole wrote: On 01/11/2018 12:53 AM, Codifies wrote: [...] Just to confirm, format there is std.format:format right? Because that isn't using C variadics, its using template variadics. thought I was using core.vararg and std.format

Re: expanding variadic into format

2018-10-31 Thread Stanislav Blinov via Digitalmars-d-learn
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 i

Re: expanding variadic into format

2018-10-31 Thread rikki cattermole via Digitalmars-d-learn
On 01/11/2018 12:53 AM, Codifies wrote: I have a routine that was happily printing ASCII strings and values using opengl, however I want to improve it so it can be used in the same manner as some other languages printf function... void printValue(Font fnt,float x, float y, string frmt, ...) {