3 ms·
Recently discovered this behaviour, I think I had just always assumed that e.g. operator<< was declared linked to the class, rather than just in a randomly sear
by misnome 2y ago
Recently discovered this behaviour, I think I had just always assumed that e.g. operator<< was declared linked to the class, rather than just in a randomly searched namespace.
We were using the fmt library, and had `using namespace fmt` so that we could just call print(), format() directly. Suddenly, some of our calls (all that used std::strings as arguments) started failing as "ambiguous". We traced it to an updated dependency that... now included <chrono>. chrono includes format as part of it's formatting capabilities, so the compiler knows that the namespace object exists.
I find it crazy that it's impossible to bypass and say "no, I really do want this name". This seems to entirely defeat the point of namespaces. Now we have to have fmt:: sprinkled everywhere.
Fuck'n language.
- lostmsu 2y agoIn C# you can do `using XXX = qualified.XXX`. Is there nothing like that in C++?