Type programming game

Stefan Koch uplink.coder at googlemail.com
Sat Oct 10 23:42:46 UTC 2020


Hi,

just now I came up with a nice game.

Write a template/function takes a sequence of types, and 
"returns" a string.
Whenever the same type appears twice in the sequence directly 
after the previous occurrence,
append ("double " ~ name_of_type) to the string.
Whenever it appears three times, append ("triple " ~ 
name_of_type).

So (int, int, uint, uint, uint) would return "double int triple 
uint")
Or (char, char, wchar, dchar, dchar) would return "double char 
double dchar"

I am looking forward to what you come up with.

After a few submissions have been made I will post my type 
function, which fulfills this task.

Have a good day,

Stefan


More information about the Digitalmars-d mailing list