Variadic template arguments unpacking
Max Strakhov
monnoroch at gmail.com
Sat Jul 6 05:21:28 PDT 2013
Artur, if i use your solution like
printf("...", ForEach!(val => conv(val).c_str())(values).tuple);
Than i would get a crash, because all the tuple elements would be
char*'s, pointing to already freed memory, as std::string's
destructor gets called each time right after alias function
exits. Ths is what c++ unpacking operator for: i actually return
a packed list of std::string's, apply .c_str() to each and than
unpack the list to current context.
More information about the Digitalmars-d-learn
mailing list