TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Investigating an argument-dependent lookup issue and working around it

46 pointsby luu2 months ago

2 comments

ch33zer2 months ago
ADL hits the sweet spot of absolutely critical feature for C++ to be even remotely workable and a horrible anti feature that causes surprising behavior at a distance. So, critical and horrible at the same time. I think things like this are why C++ will lose over time
misnome2 months ago
Recently discovered this behaviour, I think I had just always assumed that e.g. operator&lt;&lt; was declared linked to the class, rather than just in a randomly searched namespace.<p>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 &quot;ambiguous&quot;. We traced it to an updated dependency that... now included &lt;chrono&gt;. chrono includes format as part of it&#x27;s formatting capabilities, so the compiler knows that the namespace object exists.<p>I find it crazy that it&#x27;s impossible to bypass and say &quot;no, I really do want this name&quot;. This seems to entirely defeat the point of namespaces. Now we have to have fmt:: sprinkled everywhere.<p>Fuck&#x27;n language.
评论 #43332927 未加载