Variadic template arguments unpacking

Artur Skawina art.08.09 at gmail.com
Sat Jul 6 08:23:25 PDT 2013


On 07/06/13 14:21, Max Strakhov wrote:
> 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.

Can you show some simple code that exhibits the problem?

artur


More information about the Digitalmars-d-learn mailing list