Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-03-13 12:43:53


----- Original Message -----
From: "Aleksey Gurtovoy" <alexy_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, March 13, 2002 12:35 PM
Subject: RE: [boost] type_traits: workaround bias

> David Abrahams wrote:
> > > The canonical workaround is to wrap in boost::type<> (code
> > > off the top of my head):
> > >
> > > template<class T> yes_type is_pointer_helper(type<T*>);
> > > no_type is_pointer_helper(...);
> > >
> > > is_pointer<T>::value = sizeof(yes_type) ==
> > > sizeof(is_pointer_helper(type<T>()));
> > >
> > > Does it work here?
> >
> > That was the first thing I tried. Internal compiler errors with VC6.
>
> FWIW, in my experience 'type' (and 'value') are really unfortunate
names for
> class templates, if you want you code to compile stabily under VC6;
both
> correlate with our naming convention of "returning" types/values from
> metafunctions, and that doesn't help the compiler. Without seeing the
code
> and errors I can't say if that's the case, but there is a chance that
using
> something named less provocative as a wrapper template can help here.

Tried that, too :^(

struct X;
template <class T> struct wraps{};
template <class T> char f(wraps<T&>);
int main()
{
    sizeof(f(wraps<X&>()));
    return 0;
};


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