summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/mpl/test/lambda.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/mpl/test/lambda.cpp
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/mpl/test/lambda.cpp')
-rw-r--r--src/boost/libs/mpl/test/lambda.cpp78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/boost/libs/mpl/test/lambda.cpp b/src/boost/libs/mpl/test/lambda.cpp
new file mode 100644
index 00000000..22e6236c
--- /dev/null
+++ b/src/boost/libs/mpl/test/lambda.cpp
@@ -0,0 +1,78 @@
+
+// Copyright Aleksey Gurtovoy 2001-2004
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/mpl for documentation.
+
+// $Id$
+// $Date$
+// $Revision$
+
+#include <boost/mpl/logical.hpp>
+#include <boost/mpl/comparison.hpp>
+#include <boost/mpl/lambda.hpp>
+#include <boost/mpl/size_t.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/sizeof.hpp>
+#include <boost/mpl/apply.hpp>
+
+#include <boost/mpl/aux_/test.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_float.hpp>
+
+struct my
+{
+ char a[100];
+};
+
+MPL_TEST_CASE()
+{
+ // !(x == char) && !(x == double) || sizeof(x) > 8
+ typedef lambda<
+ or_<
+ and_<
+ not_< boost::is_same<_1, char> >
+ , not_< boost::is_float<_1> >
+ >
+ , greater< sizeof_<_1>, mpl::size_t<8> >
+ >
+ >::type f;
+
+ MPL_ASSERT_NOT(( apply_wrap1<f,char> ));
+ MPL_ASSERT_NOT(( apply_wrap1<f,double> ));
+ MPL_ASSERT(( apply_wrap1<f,long> ));
+ MPL_ASSERT(( apply_wrap1<f,my> ));
+}
+
+MPL_TEST_CASE()
+{
+ // x == y || x == my || sizeof(x) == sizeof(y)
+ typedef lambda<
+ or_<
+ boost::is_same<_1, _2>
+ , boost::is_same<_2, my>
+ , equal_to< sizeof_<_1>, sizeof_<_2> >
+ >
+ >::type f;
+
+ MPL_ASSERT_NOT(( apply_wrap2<f,double,char> ));
+ MPL_ASSERT_NOT(( apply_wrap2<f,my,int> ));
+ MPL_ASSERT_NOT(( apply_wrap2<f,my,char[99]> ));
+ MPL_ASSERT(( apply_wrap2<f,int,int> ));
+ MPL_ASSERT(( apply_wrap2<f,my,my> ));
+ MPL_ASSERT(( apply_wrap2<f,signed long, unsigned long> ));
+}
+
+MPL_TEST_CASE()
+{
+ // bind <-> lambda interaction
+ typedef lambda< less<_1,_2> >::type pred;
+ typedef bind2< pred, _1, int_<4> > f;
+
+ MPL_ASSERT(( apply_wrap1< f,int_<3> > ));
+}