PrintSream class encapsulates multiple std::ofstream objects allowing to print result of threads on different ofstream it there is only one thread available, print as usual in a single file.
Construct such object from one name file, e.g print.txt then the following file will be created print.txt for thread 0 or no multithreading print1.txt for thread 1 print2.txt for thread 2 …
PrintSream inherits from std::ostream and can be used as ordinary stream, for instance PrintStream thePrintStream(“print.txt”); thePrintStream << “toto “<<i<<…