The Boost C++ library has Function Template tee
The class templates tee_filter and tee_device provide two ways to split an output sequence so that all data is directed simultaneously to two different locations.
I am looking for a complete C++ example using Boost tee to output to standard out and to a file like "sample.txt".