lundi 28 janvier 2019

A variadic function that accepts Strings and Ints, Format the latter and concatenate all?

I'm trying to use the answer from DanielKO in this question for my needs but i'm not familiar with templates and variadic functions, and i don't get what should i do.

What i'd need is a variadic c++(11) function which i can call like this:

 String NewMsg = CreateMessage("SET",16,1,17,0,"RED",47);

and have NewMsg= "SET,0010,0001,0011,0000,RED,002F".

I'm not even able to get where should i add the comma between the arguments. And then: How could i distinguish between integers and string while parsing the args, so to format each integer to hexadecimal strings?

Aucun commentaire:

Enregistrer un commentaire