Boost logo

Boost :

From: Yitzhak Sapir (yitzhaks_at_[hidden])
Date: 2002-03-21 07:56:40


I sent this, and apparently because of email address confusion along
with moderation going into effect I was left out as a non-subscriber.

I don't know how much it matters though. I was looking into it because
David Abrahams wrote "it's not clear
that the solutions don't exploit bugs in the MSVC compilers." It seems
though I'm using the same bug (a function whose instantiation is illegal
is turned into a function returning T*). So my solution ended up not
being any better.

> The example you posted does:
>
> template<typename T>
> struct has_key_type
> {
> public:
> enum {
> value = sizeof(has_key_type_helper(static_cast<T*>(0), 0))
> == sizeof(yes)
> };
> };
>
> This assumes that T is not a reference, since if T is a
> reference, T&* is illegal. But I want to use the is_class to
> solve the is_reference, while allowing both abstract classes
> and arrays, under MSVC6.5.

Given this, though, you might want to have your solution switch on
is_reference, and have a has_key_type_reference_helper that gets
static_cast<T> instead?

> > -----Original Message-----
> > From: Aleksey Gurtovoy [mailto:agurtovoy_at_[hidden]]
> > Sent: Wednesday, March 20, 2002 8:23 PM
> > To: 'boost_at_[hidden]'
> > Subject: RE: [boost] is_class
> >
> >
> > Yitzhak Sapir wrote:
> > > I couldn't get it to work for MSVC6. In fact, I had problems
> > > calling a templated function in sizeof in a a class definition.
> > > The solution I had sent here about a week ago makes use of a
> > > bug similar to the one we had before. In particular, the
> > > following function: template <class T> T* make_tptr(wraps<T>);
> > > is instantiated as T** make_tptr(wraps<T*>); when called as
> > > make_tptr(wraps<X&>)
> > >
> > > I also tried an alternative implementation of is_class that
> > > is based on inheritance. It doesn't work with MSVC6.5 though.
> >
> > I posted an implementation that works under Comeau C/C++
> > 4.2.45.2, gcc 2.95.3-5, MSVC 6.5 and VC 7.0, see
> > http://groups.google.com/groups?hl=en&ie=ISO-8859-1&oe=ISO-885
> 9-1&selm=81667
> c9.0203181152.3c09e9b1%40posting.google.com
>
> Aleksey
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost


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