Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2004-08-21 10:57:50


On Fri, 20 Aug 2004 18:44:41 -0400, Arkadiy Vertleyb
<vertleyb_at_[hidden]> wrote:
> "Peder Holt" <peder.holt_at_[hidden]> wrote
>
> > I have implemented typeof for
> > compilers not supporting partial specialization.
>
> Before taking a closer look at your code, I assume that the only way to
> emulate partial template specialization is by employing template function
> overloading (I've done it once in the past)... If this is what you did, I
> wonder if base-derived classes are handled correctly...

Yes, that is right, I will have to test it out.
But there are two ways of using functions to implement typeof:
1: Create functions that returns the encoded size of element #N in the
expression
   This is what I have currently done, and VC chokes on it, as it
recurses too deeply.
2: Create functions that return the type of element #N, and then
encode this type.
   This requires that all the recursion be done in the typeof macro.
To get the type of element #3 you would have to do something like:
encode(foo(foo(foo(make_foo(expression))));
It seems VC likes that better. I'll try to follow that approach.

>
> > The max depth of an expression increased
> > from the mpl limit of 60
> > to the preprocessor limit of 256
>
> Is this a real limit in MPL? I've always gotten 50, but I assumed it should
> be easy to lift... Seems unreasonably low...
>
> Can MPL experts comment on this?
>
> > template expressions containing integral values are allowed
> >
> > The template:
> > template<typename T,unsigned long V>
> > struct X {};
> > can be exposed to typeof in the following way:
> > BOOST_TYPEOF_DEFINE_TEMPLATE(X,2,(typename,unsigned long))
>
> This is cool, I will definitely try to implement something similar.
>
> > (VC 7.1 had some problems preprocessing the code needed to make this
> work.)
>
> This will have to be solved, though, I believe this compiler deserves not to
> be overlooked :)
>

Have fixed this.
http://groups.yahoo.com/group/boost/files/typeof_vintage.zip

Everything now compiles on VC 7., except the compiler hangs when the
typeof depth is set to a large number (e.g. 60)

> Regards,
>
> Arkadiy
>
> _______________________________________________
> 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