Reuzel – A tiny C++ thread pool
github.com
github.com
using std::string;
It's not cool to impose that decision on clients of the library.
This should almost always be ok since no sane programmer should ever name their class string in the namespace of std.
As a developer, I wouldn't feel too bad about causing namespace conflicts in this manner because hopefully it will suggest to the maintainer that their class name is a poor choice.
He really shouldn't do that in a header, but if he at least moved it down a couple of lines so it's inside his private namespace, it at least wouldn't affect anyone else. There is no good reason to do it globally.
As to why a program would have two classes called string... well, there's a funny thing there, because it didn't, at least not until it started using this library that does "using std::string" in its header...
(Anyway, why is it the library author's concern? They're writing a library! Not only is this the tail wagging the dog, but they're actually making it harder to use, and easier to say no to. Exactly the wrong thing.)
If its my library and I don't want other maintainers adding additional string classes internally, I can at the very least force them to use fully qualified names for their alternative string classes to avoid ambiguity. I hate working on code that has 5 different versions of the same freaking thing because each developer decided to implement their own version when the standard way would have sufficed. That was the point I was trying to make. Just like putting const and override on functions, it's a way to help maintainers avoid doing dumb things.
Beyond that I'm not sure what to suggest. The problem is that even if you have a Really Good Reason for what might otherwise appear to be a bit of gratuitous incompatibility, it's rather unlikely that others will figure out what that reason is without some explanation. IME anyway.
Nevertheless, I'll concede that its not the best way to go about things. But it is something you can do and I wanted to highlight a case of why a "Never do This" feature is even allowed in the first place.
Talks in-depth about the thread library and also other C++11 features that made it possible. Highly recommended.