Boost logo

Boost Users :

From: Hicham Mouline (hicham_at_[hidden])
Date: 2008-01-28 18:13:20


Great. This works.

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Steven Watanabe
Sent: 28 January 2008 22:39
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Template instantiation function arguments and
Boost.Preprocessor

AMDG

Ah. You still need the preprocessor, but you can rearrange the
definitions slightly.
(untested)

template<int N>
struct TreeSumImpl;

#define TREE_SUM_DEF(z, n, data)\
    template<>\
    struct TreeSumImpl<n> {\
        static double sum(BOOST_PP_ENUM_PARAMS_Z(z, n, double arg)) { ... }\
    };

BOOST_PP_REPEAT(20, TREE_SUM_DEF, ~)

template<int N>
struct Tree : TreeSumImpl<N> {
    // other code
};

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net