diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index e238d6c..7528f9e 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -77,3 +77,11 @@ exe external_transforms : external_transforms.cpp ; + +exe lambda + : + lambda.cpp + : + . + clang:-Wno-unused-local-typedef + ; diff --git a/example/lambda.cpp b/example/lambda.cpp new file mode 100644 index 0000000..bb5c1f0 --- /dev/null +++ b/example/lambda.cpp @@ -0,0 +1,17 @@ +//[ Lambda +/////////////////////////////////////////////////////////////////////////////// +// Copyright 2008 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) +// +// This example builds a simple but functional lambda library using Proto. + +#include +#include "./lambda.hpp" + +int main() +{ + using namespace boost::lambda; + int i = (_1 + _1)(42); + std::cout << i << std::endl; +} diff --git a/example/lambda.hpp b/example/lambda.hpp index 1802578..a08d9bf 100644 --- a/example/lambda.hpp +++ b/example/lambda.hpp @@ -257,7 +257,7 @@ #define M0(Z, N, DATA) \ case proto::tag_of::type>::type::value: \ - eval_lambda(proto::child_c(expr), state, data); \ + eval_lambda(proto::child_c(expr), state, data); \ break; \ /**/ @@ -274,7 +274,7 @@ , typename impl2::data_param data \ ) const \ { \ - switch(eval_lambda(proto::child_c<0>(expr), state, data)) \ + switch(eval_lambda(proto::child_c<0>(expr), state, data)) \ { \ BOOST_PP_REPEAT_FROM_TO_ ## Z(1, N, M0, ~) \ default: \ @@ -295,11 +295,11 @@ , typename impl2::data_param data \ ) const \ { \ - switch(eval_lambda(proto::child_c<0>(expr), state, data)) \ + switch(eval_lambda(proto::child_c<0>(expr), state, data)) \ { \ BOOST_PP_REPEAT_FROM_TO_ ## Z(1, BOOST_PP_DEC(N), M0, ~) \ default:; \ - eval_lambda(proto::child_c(expr), state, data); \ + eval_lambda(proto::child_c(expr), state, data); \ break; \ } \ } \ @@ -475,13 +475,8 @@ template<> struct AssignOps::case_ : proto::not_ {}; template<> struct AssignOps::case_ : proto::not_ {}; - namespace exprns_ - { - template - struct llexpr; - } - - using exprns_::llexpr; + template + struct llexpr; // Wrap expressions in lambda::llexpr<>. struct Generator @@ -565,7 +560,7 @@ BOOST_MPL_ASSERT_RELATION(result_of::type::value, <=, SIZE); \ BOOST_PP_CAT(fusion::vector, SIZE) args \ (BOOST_PP_SEQ_FOR_EACH_I_R(R, M6, ~, PRODUCT)); \ - return eval_lambda(*this, no_exception, args); \ + return eval_lambda(*this, no_exception, args); \ } \ /**/