Using ofstream* wrapper class with overloaded << operator on endl
问题 C++ This is an attempt to make a class that mimics the output behavior of using the << operator of an ofstream , as far as being able to use std::endl and write string s is concerned. The class has a single data member, the ofstream pointer. The class has two overloaded << operators, one that takes an std::string and another that takes a pointer to a function, whose argument is an ostream reference and returns an ostream reference. That is the signature of std::endl , according to this.