]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/test/function/lazy_templated_struct_tests.cpp
1 ////////////////////////////////////////////////////////////////////////////
2 // lazy_templated_struct_tests.cpp
4 // lazy templated struct test to check this works everywhere.
6 ////////////////////////////////////////////////////////////////////////////
7 /*=============================================================================
8 Copyright (c) 2001-2007 Joel de Guzman
9 Copyright (c) 2015 John Fletcher
11 Distributed under the Boost Software License, Version 1.0. (See accompanying
12 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
13 ==============================================================================*/
15 #include <boost/phoenix/core/limits.hpp>
17 #include <boost/detail/lightweight_test.hpp>
18 #include <boost/phoenix/core.hpp>
19 #include <boost/phoenix/function.hpp>
20 #include <boost/function.hpp>
25 // Example of templated struct.
26 template <typename Result
>
29 typedef Result result_type
;
31 Result
operator()(Result
const & r
) const
37 template <typename Result
>
40 typedef Result result_type
;
42 Result
operator()() const
51 boost::function1
<int, int > what_int
= impl::what
<int>();
52 boost::function0
<int> what0_int
= impl::what0
<int>();
53 BOOST_PHOENIX_ADAPT_FUNCTION(int,what
,what_int
,1)
54 BOOST_PHOENIX_ADAPT_FUNCTION_NULLARY(int,what0
,what0_int
)
60 using boost::phoenix::arg_names::arg1
;
61 BOOST_TEST(example::what_int(a
) == a
);
62 BOOST_TEST(example::what(a
)() == a
);
63 BOOST_TEST(example::what(arg1
)(a
) == a
);
64 BOOST_TEST(example::what0_int() == 100);
65 BOOST_TEST(example::what0()() == 100);
67 return boost::report_errors();