Why don't the std::fstream classes take a std::string?

后端 未结 10 819
花落未央
花落未央 2020-11-28 07:25

This isn\'t a design question, really, though it may seem like it. (Well, okay, it\'s kind of a design question). What I\'m wondering is why the C++ std::fstream

10条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 07:29

    There are several places where the C++ standard committee did not really optimize the interaction between facilities in the standard library.

    std::string and its use in the library is one of these.

    One other example is std::swap. Many containers have a swap member function, but no overload of std::swap is supplied. The same goes for std::sort.

    I hope all these small things will be fixed in the upcoming standard.

提交回复
热议问题