Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-05-21 08:40:50


"Tobias Schwinger" <tschwinger_at_[hidden]> wrote

> > Agreed. Also I think Steve Dewhurst (who apparently did a lot of
research
> > in this area) once published an article about decomposing a type and
> > bringing it back together...
> >
>
> Are you talking about the 'typeints'- or the 'typeof'-article ?
> Can you perhaps post a link ?

Can't find it :-(

I think he used type tags instead if integers, decomposed a type into a
typelist of these tags with the help of partial template specialization,
applied some transformation to the list, and then reassembled the new type.
I don't remember if he mentioned any practical usage of this, though...

> I'm talking about making the client code for the registration look like
this (e.g.):
>
> #define BOOST_TYPEOF_REGISTRATION \
> ( typename(boost::lambda::greater_action) ) \
> ( template(boost::lambda::functor,1) ) \
> ( template(boost::lambda::lambda_functor_base,2) ) \
> [...]
> #include BOOST_TYPEOF_REGISTER()

Understood. Let me think about this...

> > We did some work with Aleksandr Nasonov to port the library to Intel
8.0,
> > and we came pretty close -- only the exotic case "template<class T, Tn>"
> > didn't work, and we proved to ourselves that this was because of the
> > compiler bug. So I think Intel will be among first compilers to extend
our
> > support.
> >
>
> Good to hear it's a compiler bug. Btw. I had to do something like this
once and
> got away with member templates:
>
> template<typename T> class X { template<T n> [...]
>
> (IIRC this works with Intel) and to be honest I didn't even know it is a
valid
> possibilty to do it within a single template parameter list, until now
(well,
> don't know for sure - I just believe you ;-) ).

Here is the final minimal example Alexander (sorry for misspelling his name
the first time) came up with:

//------
template<class T, T n> struct a {};

template<class V, class T>
struct traits;

template<class V, class T, T n>
struct traits<V, a<T, n> >
{};

struct X {};

int main()
{
    traits<int, a<int,0> > good;
    traits<X , a<int,0> > bad; // error: incomplete type is not allowed.
}
//------

This was the only problem with Intel 8.0, but I think other versions have a
few more (your experience demonstrated it).

Regards,
Arkadiy


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