hello.cpp 780 B

12345678910111213141516171819202122232425262728
  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. #include <iostream>
  7. #include <boost/proto/core.hpp>
  8. #include <boost/proto/context.hpp>
  9. // This #include is only needed for compilers that use typeof emulation:
  10. #include <boost/typeof/std/ostream.hpp>
  11. namespace proto = boost::proto;
  12. proto::terminal< std::ostream & >::type cout_ = {std::cout};
  13. template< typename Expr >
  14. void evaluate( Expr const & expr )
  15. {
  16. proto::default_context ctx;
  17. proto::eval(expr, ctx);
  18. }
  19. int main()
  20. {
  21. evaluate( cout_ << "hello" << ',' << " world" );
  22. return 0;
  23. }
  24. //]