1 /*============================================================================= 2 Copyright (c) 2014 Joel de Guzman 3 4 Distributed under the Boost Software License, Version 1.0. (See accompanying 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 ==============================================================================*/ 7 #if !defined(BOOST_SPIRIT_X3_LAMBDA_VISITOR_MAY_19_2014_1116AM) 8 #define BOOST_SPIRIT_X3_LAMBDA_VISITOR_MAY_19_2014_1116AM 9 10 namespace boost { namespace spirit { namespace x3 11 { 12 template <typename RT, typename... Lambdas> 13 struct lambda_visitor; 14 15 template <typename RT, typename F, typename... Lambdas> 16 struct lambda_visitor<RT, F, Lambdas...> : F, lambda_visitor<RT, Lambdas...> 17 { 18 typedef lambda_visitor<RT , Lambdas...> base_type; 19 using F::operator(); 20 using base_type::operator(); lambda_visitorboost::spirit::x3::lambda_visitor21 lambda_visitor(F f, Lambdas... lambdas) 22 : F(f), base_type(lambdas...) 23 {} 24 }; 25 26 template <typename RT, typename F> 27 struct lambda_visitor<RT, F> : F 28 { 29 typedef RT result_type; 30 using F::operator(); lambda_visitorboost::spirit::x3::lambda_visitor31 lambda_visitor(F f) 32 : F(f) 33 {} 34 }; 35 36 template <typename RT> 37 struct lambda_visitor<RT> 38 { 39 typedef RT result_type; 40 }; 41 42 template <typename RT, typename... Lambdas> make_lambda_visitor(Lambdas...lambdas)43 lambda_visitor<RT, Lambdas...> make_lambda_visitor(Lambdas... lambdas) 44 { 45 return { lambdas... }; 46 } 47 }}} 48 49 #endif 50