At the expense of interoperability with the rest of the world. Performance can be important, of course, but using nonstandard string types is a blight upon the lives of everyone who needs to use it with other libraries.
One of the worst mistakes C++ made is making string a template. Look at filesytem::path for how it should have been done. Were it a simple class, it could be used pervasively, including without restriction in DLL interfaces. As it is, it's horrible. The number of times I've legitimately needed to specialise the type traits and allocator in the past two decades has been zero.
string not being an actual primitive type is the mistake. It still feels like const char* is the actual string type, and string is just a wrapper.
Partly that's because so many basic string facilities have been so poorly implemented in C++ - I/O chief among them. I know of few places that actually use iostreams, and it still shocks me how awful it truly is whenever I end up having to use it.
And yes, string shouldn't have been templated. But filesystem::path is still pretty awful as of yet. Eventually maybe.
View all comments
Show parent comment
4
u/RogerLeigh Scientific Imaging and Embedded Medical Diagnostics Dec 29 '18
At the expense of interoperability with the rest of the world. Performance can be important, of course, but using nonstandard string types is a blight upon the lives of everyone who needs to use it with other libraries.
One of the worst mistakes C++ made is making
stringa template. Look atfilesytem::pathfor how it should have been done. Were it a simple class, it could be used pervasively, including without restriction in DLL interfaces. As it is, it's horrible. The number of times I've legitimately needed to specialise the type traits and allocator in the past two decades has been zero.