callback.cpp 605 B

123456789101112131415161718192021222324
  1. /*=============================================================================
  2. Copyright (c) 2001-2007 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #include <iostream>
  7. #include <boost/phoenix/core.hpp>
  8. template <typename F>
  9. void print(F f)
  10. {
  11. std::cout << f() << std::endl;
  12. }
  13. int
  14. main()
  15. {
  16. using boost::phoenix::val;
  17. print(val(3));
  18. print(val("Hello World"));
  19. return 0;
  20. }