Re: [boost] MPL's "round" lambda
by Peter Dimov other posts by this author
Nov 18 2002 2:17PM messages near this date
[boost] Re: MPL's "round" lambda
|
Re: [boost] MPL's "round" lambda
From: "Joel de Guzman" <djowel@[...].uk>
> From: "Peter Dimov" <pdimov@[...].net>
> > From: "Aleksey Gurtovoy" <agurtovoy@[...].com>
> > > If you are tired of angle brackets in your templates (no, it's not a
TV
> > > commercial :), may be you'll like this one:
> > >
> > > typedef eval<
> > > count_if(
> > > list(int,char,long,int)
> > > , lambda(is_same(_,int))
> > > )
> > > >::type res;
> > >
> > > BOOST_STATIC_ASSERT(res::value == 2);
> >
> > OK, I give up. How does this work?
>
> I've been twisting my mind very hard the past hour trying to
> imagine how this will work without peeking at the code.
> Whew, this is a tough one to crack!
I wrote "I don't understand how it works even _after_ (briefly) looking at
the code. ;-)" but then it occured to me that list(int, char, long, int) is
a function type. Cool trick. Cv qualifiers will probably be a problem but
it's cool. Aleksey wins the Boost obfuscated C++ contest of the week.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Aleksey Gurtovoy
=?iso-8859-1?Q?Terje_Sletteb=F8?=
Joel de Guzman
Dirk Gerrits
Peter Dimov
Peter Dimov
Dirk Gerrits
Douglas Gregor
David Abrahams
|