Possible Duplicate:
Design of std::ifstream class
Why does (i|o)fstream take a const char* parameter for a file name?
Looking at std::ifstream’s constructors, I find two:
ifstream ( );
explicit ifstream ( const char * filename, ios_base::openmode mode = ios_base::in );
Why does the second one take a const char * and not a const std::string &?
Is this some kind of avoidance of circularity or forward reference?
It was a simple omission. Nobody thought about it in time. This has been corrected in C++11, where
std::stringis also accepted. From 27.9.1.7/3: