Boost logo

Boost :

Subject: [boost] Variadic to Head/Tail TMP List
From: Fernando Pelliccioni (fpelliccioni_at_[hidden])
Date: 2012-04-25 08:39:45


Hi,

Is this piece of code useful ?

http://pastebin.com/tRrqVHTw

The purpose is to tranform code like the following:

    typedef cons<int, cons<float, cons<char, cons<string>>>> t0;
       // fusion::cons or similar data structures

in

    typedef chain_generator<cons, nil> cons_gen;
    typedef cons_gen::gen<int, float, char, std::string>::type t1;

I don't know if there is something similar in a library.
I think it could be useful.

Compiler tests:
GCC 4.7 -> Compiler Error
GCC 4.7.1 & Trunk -> OK
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53108
Clang Trunk -> OK
MSVC 11 beta -> has no Variadic Templates

Regards,
FP.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk