Output file which creation/opening is delayed until the first output. More...
#include <wipal/tool/datafile.hh>
Public Member Functions | |
datafile (const std::string &) | |
operator std::ostream & () | |
template<class T > | |
std::ostream & | operator<< (const T &) |
Output file which creation/opening is delayed until the first output.
A datafile
object represents an output file. It may be casted to std::ostream&
and has an <<
operator for formatted outputs. The main difference with std::ofstream
is the file is not opened until the corresponding stream is effectively solicited. Thus, if the file does not exist on the filesystem and no operation is performed on it, no file will be created.
Unlike std::ostream
, datafile
is copy-constructible.