ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
[boost] MPL's "round" lambda
by Aleksey Gurtovoy other posts by this author
Nov 18 2002 10:56AM messages near this date
RE: [boost] MPL lambda | Re: [boost] MPL's "round" lambda
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);

Or this one:

    typedef eval<
          find_if( 
              filter_view(
                  list(int,float,char,long,double)
                , lambda(not_(is_float(_)))
                )
            , lambda( or_( 
                  is_same(_,short)
                , less(sizeof_(_),sizeof_(int))
                ) )
            )
        > ::type iter;

    typedef eval< is_same(iter::type,char) > ::type res2;
        
    BOOST_STATIC_ASSERT(res2::value);

The above actually compiles on Comeau C/C++ 4.3.0.1 and Intel C++ 6.0 with
the current MPL sources in the CVS; see
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/boost/boost/libs/m
pl/example/lambda2.cpp for an example. Note that the "factorial" snippet
there doesn't work yet (if you ask 'fact::value', it will blow).

Aleksey
_______________________________________________
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved