|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-03-13 11:59:46
----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, March 13, 2002 11:03 AM
Subject: Re: [boost] type_traits: workaround bias
> From: "David Abrahams" <david.abrahams_at_[hidden]>
> > It seems that the known technologies for writing type traits for
> > compilers without partial specialization nearly always force us to
> > choose between supporting array types and supporting abstract
classes.
> > Let's just look at is_pointer, for an example:
> >
> > ----------
> > struct pointer_helper
> > {
> > pointer_helper(const volatile void*);
> > };
> > yes_type BOOST_TT_DECL is_pointer_helper(pointer_helper);
> > no_type BOOST_TT_DECL is_pointer_helper(...);
> >
> >
> > template <typename T>
> > struct is_pointer
> > {
> > private:
> > static T t;
>
> 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.
Perhaps we need
vc6
- array biased
- abstract class biased
vc7
- uses type<> (if that works)
"conforming"
- just works
:-(
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk