Created
May 7, 2018 14:29
-
-
Save jflopezfernandez/b85e5e75ca87d9d542d348890e195a5f to your computer and use it in GitHub Desktop.
Printing the contents of a stream buffer using an iterator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iterator> | |
#include <string> | |
int main() | |
{ | |
const std::string text("Hello, my name is Jean-Pierre Williams."); | |
std::ostreambuf_iterator<char> bufferWriter(std::cout); | |
std::copy(text.begin(), text.end(), bufferWriter); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment