Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-11-20 06:10:54


I agree on all counts.
It's easy to make a friendly version for broken compilers (see the MPL, once
again):

template <bool flag, class T, class F>
struct select_type : if_true<flag>::template then<T,F>
{
};

This is the standard MSVC "poor man's partial specialization" workaround.

----- Original Message -----
From: "Andrei Alexandrescu" <andrewalex_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, November 20, 2001 3:09 AM
Subject: [boost] select_type.hpp

> I think if_true in select_type ought to become a first-class citizen. It's
> useful enough to everyone.
>
> I also suggest including the friendlier version:
>
> template <bool flag, typename T, typename U>
> struct select
> {
> typedef T type;
> };
> template <typename T, typename U>
> struct Select<false, T, U>
> {
> typedef U type;
> };
>
> for compilers that support partial specialization. The if_true is
> compiler-friendlier but considerably harder to use (that "template" in the
> middle of it is really annoying).
>
>
> Andrei
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


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