fork download
  1. #define BOOST_RESULT_OF_USE_DECLTYPE
  2. #include <boost/range/istream_range.hpp>
  3. #include <boost/range/algorithm.hpp>
  4. #include <boost/range/adaptors.hpp>
  5. #include <iostream>
  6.  
  7. using boost::copy;
  8. using boost::for_each;
  9. using boost::adaptors::transformed;
  10. using boost::adaptors::indexed;
  11.  
  12. template <typename Rng, unsigned per_line=8>
  13. void dump(const Rng& data)
  14. {
  15. auto idx = data | indexed(1);
  16. for(auto it = begin(idx); it != end(idx); ++it)
  17. std::cout << *it << ((it.index() % per_line == 0)? '\n' : ' ');
  18. }
  19.  
  20. int main() {
  21. using std::string;
  22.  
  23. auto toupper = [](string s) -> string { for_each(s, [](char& c) { c = std::toupper((unsigned char) c); }); return s; };
  24. auto input = boost::istream_range<string>(std::cin);
  25.  
  26. dump(input | transformed(toupper));
  27.  
  28. return 0;
  29. }
  30.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:41: fatal error: boost/range/istream_range.hpp: No such file or directory
compilation terminated.
stdout
Standard output is empty