Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-04-05 17:23:14


 Lie-Quan Lee wrote:
> the first template of ct_if in boost/pending/ct_if.hpp is "int
> cond". And there are two specialized verisons. One for cond = 1. The
> other for cond = 0. My suggestion is to change the first template
> argument to be "bool cond". Then specialize for true and false. I was
> trapped into the situation that cond is other than 1 and 0.

Actually the 'ct_if' is going to be replaced by the 'select_type' template
of the boost template metaprogramming library ('boost::mpl'). I need one
more weekend to finish the things up (work is being hectic for me), but
basically the library is pretty much done. As for the proposed change - its'
already incorporated into the library; the primary version of
'boost::mpl::select_type' template (one for standard compliant compilers)
looks like this:

template<bool Condition, typename T1, typename T2> struct select_type
    {
    typedef T1 type;
    };

template<typename T1, typename T2> struct select_type<false, T1, T2>
    {
    typedef T2 type;
    };

Aleksey


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