1 /////////////////////////////////////////////////////////////////////////////// 2 /// \file null.hpp 3 /// Definintion of null_context\<\>, an evaluation context for 4 /// proto::eval() that simply evaluates each child expression, doesn't 5 /// combine the results at all, and returns void. 6 // 7 // Copyright 2008 Eric Niebler. Distributed under the Boost 8 // Software License, Version 1.0. (See accompanying file 9 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 11 #ifndef BOOST_PROTO_CONTEXT_NULL_HPP_EAN_06_24_2007 12 #define BOOST_PROTO_CONTEXT_NULL_HPP_EAN_06_24_2007 13 14 #include <boost/preprocessor/iteration/iterate.hpp> 15 #include <boost/preprocessor/repetition/repeat.hpp> 16 #include <boost/proto/proto_fwd.hpp> 17 #include <boost/proto/eval.hpp> 18 #include <boost/proto/traits.hpp> 19 20 namespace boost { namespace proto { namespace context 21 { 22 23 template< 24 typename Expr 25 , typename Context 26 , long Arity // = Expr::proto_arity_c 27 > 28 struct null_eval 29 {}; 30 31 template<typename Expr, typename Context> 32 struct null_eval<Expr, Context, 0> 33 { 34 typedef void result_type; operator ()boost::proto::context::null_eval35 void operator()(Expr &, Context &) const 36 {} 37 }; 38 39 // Additional specializations generated by the preprocessor 40 #include <boost/proto/context/detail/null_eval.hpp> 41 42 /// null_context 43 /// 44 struct null_context 45 { 46 /// null_context::eval 47 /// 48 template<typename Expr, typename ThisContext = null_context const> 49 struct eval 50 : null_eval<Expr, ThisContext> 51 {}; 52 }; 53 54 }}} 55 56 #endif 57