expanding variadic into format
rikki cattermole
rikki at cattermole.co.nz
Wed Oct 31 11:56:31 UTC 2018
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, ...)
> {
> /* matrix math and other stuff removed for readability */
> string message = format(frmt, _arguments);
>
>
> no surprise this naive attempt causes a runtime error as its trying to
> format a range using the first format specifier in frmt
>
> am I going to have to chop frmt into descrete chunks that have just one
> % symbol in them and then build up the formatted message string like that?
>
> 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.
More information about the Digitalmars-d-learn
mailing list