David Abrahams wrote:
> Aleksey Gurtovoy <[EMAIL PROTECTED]> writes:
> > Yep, the later will give you all the functionality of
> > 'boost::tuple<int,...>' except the constructors and assignment from
> > 'std::pair'. A generator for it is as simple as this:
> >
> >     template< typename Types > struct tuple_gen
> >         : fold_backward<
> >               Types
> >             , boost::tuples::null_type
> >             , boost::tuples::cons<_2,_1>
> 
> Wow, is cons a metafunction?

A "reduced" one, yes :).

> 
> It doesn't appear to be.  I know we discussed making non-metafunctions
> usable as MPL lambda-expressions, but I didn't think you would opt for
> the transparent approach, with automatic detection of nested ::type.

People keep writing code along the lines of 'cons<_2,_1>' and expect it to
work. You can explain to them why it doesn't work, and that they can fix it
easily, by writing, for instance, 'reduced< cons<_2,_1> >' instead - or,
often, they realize the mistake for themselves - but for some reason that
doesn't decrease the likelihood of the same mistake happening the next time
they write a similar code. In other word, the experience shows that the
transparent approach is more intuitive.

> 
> I thought you were going to require some explicit wrapper
> template... 

Explicit wrapper, something like

    reduced< cons<_2,_1> >

is still planned, to cover all use cases (better names are welcome!).


> Not that I mind this approach.
> 

Good! :)

Aleksey
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to