Boost logo

Boost :

Subject: [boost] tuple<T,T,...> generator meta-function
From: Emre Turkay (emreturkay2_at_[hidden])
Date: 2009-10-23 08:51:38


Hi folks,

How can I do this in a better way?

    template <typename T, size_t N>
    struct make_tuple { };

    template <typename T>
    struct make_tuple<T, 1>
    {
        typedef boost::tuple<T> type;
    };

    template <typename T>
    struct make_tuple<T, 2>
    {
        typedef boost::tuple<T, T> type;
    };

    template <typename T>
    struct make_tuple<T, 3>
    {
        typedef boost::tuple<T, T, T> type;
    };

    template <typename T>
    struct make_tuple<T, 4>
    {
        typedef boost::tuple<T, T, T, T> type;
    };

    // ...

Thanks,

    emre


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