hello.cpp 587 B

1234567891011121314151617181920212223242526272829
  1. // Range v3 library
  2. //
  3. // Copyright Jeff Garland 2017
  4. //
  5. // Use, modification and distribution is subject to the
  6. // Boost Software License, Version 1.0. (See accompanying
  7. // file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. // Project home: https://github.com/ericniebler/range-v3
  11. //
  12. ///[hello]
  13. #include <iostream>
  14. #include <range/v3/all.hpp> // get everything
  15. #include <string>
  16. using std::cout;
  17. int
  18. main()
  19. {
  20. std::string s{"hello"};
  21. // output: h e l l o
  22. ranges::for_each(s, [](char c) { cout << c << ' '; });
  23. cout << '\n';
  24. }
  25. ///[hello]