Created
May 5, 2013 04:37
-
-
Save alexeiz/5519730 to your computer and use it in GitHub Desktop.
Redirect cout to a null sink using boost::iostreams.
This file contains hidden or 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 <boost/iostreams/stream_buffer.hpp> | |
#include <boost/iostreams/device/null.hpp> | |
#include <iostream> | |
namespace io = boost::iostreams; | |
int main() | |
{ | |
io::stream_buffer<io::null_sink> null_buf{io::null_sink()}; | |
std::cout.rdbuf(&null_buf); | |
std::cout << "some junk" << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment