From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/boost/libs/proto/test/mpl.cpp | 67 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/boost/libs/proto/test/mpl.cpp (limited to 'src/boost/libs/proto/test/mpl.cpp') diff --git a/src/boost/libs/proto/test/mpl.cpp b/src/boost/libs/proto/test/mpl.cpp new file mode 100644 index 00000000..292e582b --- /dev/null +++ b/src/boost/libs/proto/test/mpl.cpp @@ -0,0 +1,67 @@ +/////////////////////////////////////////////////////////////////////////////// +// mpl.hpp +// +// Copyright 2012 Eric Niebler. 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) + +#include +#include +#include +#include +#include +#include +namespace mpl = boost::mpl; +namespace proto = boost::proto; +namespace fusion = boost::fusion; +using proto::_; + +template +struct my_expr; + +struct my_domain + : proto::domain > +{}; + +template +struct my_expr + : proto::extends, my_domain> +{ + my_expr(E const &e = E()) + : proto::extends, my_domain>(e) + {} + + typedef fusion::fusion_sequence_tag tag; +}; + +template +void test_impl(T const &) +{ + typedef typename mpl::pop_back::type result_type; + BOOST_STATIC_ASSERT( + (boost::is_same< + result_type + , my_expr::type>&> > > + >::value) + ); +} + +// Test that we can call mpl algorithms on proto expression types, and get proto expression types back +void test_mpl() +{ + my_expr::type> i; + test_impl(i + i); +} + +using namespace boost::unit_test; +/////////////////////////////////////////////////////////////////////////////// +// init_unit_test_suite +// +test_suite* init_unit_test_suite( int argc, char* argv[] ) +{ + test_suite *test = BOOST_TEST_SUITE("test proto mpl integration via fusion"); + + test->add(BOOST_TEST_CASE(&test_mpl)); + + return test; +} -- cgit v1.2.3