mirror of
https://github.com/boostorg/mpl.git
synced 2025-08-05 15:54:39 +02:00
lambda2 example tweaks
[SVN r16311]
This commit is contained in:
@@ -16,7 +16,8 @@
|
|||||||
|
|
||||||
#include "boost/mpl/v2_1.hpp"
|
#include "boost/mpl/v2_1.hpp"
|
||||||
|
|
||||||
#include "boost/mpl/logical/and.hpp"
|
#include "boost/mpl/logical/not.hpp"
|
||||||
|
#include "boost/mpl/logical/or.hpp"
|
||||||
#include "boost/mpl/comparison/less.hpp"
|
#include "boost/mpl/comparison/less.hpp"
|
||||||
#include "boost/mpl/comparison/equal_to.hpp"
|
#include "boost/mpl/comparison/equal_to.hpp"
|
||||||
#include "boost/mpl/arithmetic/multiplies.hpp"
|
#include "boost/mpl/arithmetic/multiplies.hpp"
|
||||||
@@ -42,16 +43,27 @@ typedef eval<
|
|||||||
list(int,char,long,int)
|
list(int,char,long,int)
|
||||||
, lambda(is_same(_,int))
|
, lambda(is_same(_,int))
|
||||||
)
|
)
|
||||||
>::type r2;
|
>::type res;
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(r2::value == 2);
|
BOOST_STATIC_ASSERT(res::value == 2);
|
||||||
|
|
||||||
typedef eval<
|
typedef eval<
|
||||||
find_if(
|
find_if(
|
||||||
filter_view(list(int,char,long,double), lambda(is_float(_)))
|
filter_view(
|
||||||
, lambda( and_( is_same(_,int), less(sizeof_(_),sizeof_(double)) ) )
|
list(int,float,char,long,double)
|
||||||
|
, lambda(not_(is_float(_)))
|
||||||
|
)
|
||||||
|
, lambda( or_(
|
||||||
|
is_same(_,short)
|
||||||
|
, less(sizeof_(_),sizeof_(int))
|
||||||
|
) )
|
||||||
)
|
)
|
||||||
>::type t2;
|
>::type iter;
|
||||||
|
|
||||||
|
typedef eval< is_same(iter::type,char) >::type res2;
|
||||||
|
|
||||||
|
BOOST_STATIC_ASSERT(res2::value);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
METAFUNCTION(factorial, (N)
|
METAFUNCTION(factorial, (N)
|
||||||
|
Reference in New Issue
Block a user