TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Investigating an argument-dependent lookup issue and working around it

46 点作者 luu2 个月前

2 条评论

ch33zer2 个月前
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 个月前
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 未加载