1 //[ HelloWorld 2 //////////////////////////////////////////////////////////////////// 3 // Copyright 2008 Eric Niebler. Distributed under the Boost 4 // Software License, Version 1.0. (See accompanying file 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 7 #include <iostream> 8 #include <boost/proto/core.hpp> 9 #include <boost/proto/context.hpp> 10 // This #include is only needed for compilers that use typeof emulation: 11 #include <boost/typeof/std/ostream.hpp> 12 namespace proto = boost::proto; 13 14 proto::terminal< std::ostream & >::type cout_ = {std::cout}; 15 16 template< typename Expr > evaluate(Expr const & expr)17void evaluate( Expr const & expr ) 18 { 19 proto::default_context ctx; 20 proto::eval(expr, ctx); 21 } 22 main()23int main() 24 { 25 evaluate( cout_ << "hello" << ',' << " world" ); 26 return 0; 27 } 28 //] 29