Ticket #8148: is_lambda_expression_counterexample.cpp

File is_lambda_expression_counterexample.cpp, 835 bytes (added by James Hirschorn <James.Hirschorn@…>, 10 years ago)
Line 
1#include <boost/mpl/assert.hpp>
2#include <boost/mpl/lambda.hpp>
3#include <boost/mpl/not.hpp>
4#include <boost/mpl/placeholders.hpp>
5#include <boost/mpl/plus.hpp>
6using namespace boost::mpl;
7
8// define if your boost distribution includes boost::tti
9#define BOOST_TTI
10#ifdef BOOST_TTI
11#include <boost/tti/detail/dlambda.hpp>
12#endif // BOOST_TTI
13
14struct MetafunctionClass
15{
16 template<typename T1, typename T2>
17 struct apply
18 {
19 typedef typename plus<T1,T2>::type type;
20 };
21};
22
23// work correctly:
24BOOST_MPL_ASSERT((is_lambda_expression<plus<_1, _2> >));
25#ifdef BOOST_TTI
26BOOST_MPL_ASSERT((boost::tti::detail::is_lambda_expression<MetafunctionClass>));
27#endif // BOOST_TTI
28// does not work correctly
29BOOST_MPL_ASSERT((not_<is_lambda_expression<MetafunctionClass> >));
30
31int main(int argc, char * argv[])
32{
33}