The C++ equivalent of your Python would be something like:
typedef boost::counting_iterator<int> ci; auto sum = std::accumulate(ci(0), ci(10), 0, [](auto x, auto y) { return x + (y*y); });
The C++ equivalent of your Python would be something like:
No special streaming library required.