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.

How the STL Uses Explicit

67 pointsby jandeboevrie11 months ago

2 comments

metadat11 months ago
How can the C++ statement below even compile? Since &quot;1&quot; and &quot;2&quot; are strings (not even chars).<p><pre><code> std::vector&lt;int&gt; v = {&quot;1&quot;, &quot;2&quot;} &#x2F;&#x2F; UB </code></pre> Rather than undefined behavior I&#x27;d expect a type violation error. But my C++ has gotten a bit rusty.
评论 #40807551 未加载
评论 #40807556 未加载
评论 #40807491 未加载
评论 #40813631 未加载
jimbob4511 months ago
Was there ever a reason given as to why “explicit” was chosen over a hypothetical “implicit”?
评论 #40808290 未加载
评论 #40806363 未加载
评论 #40806782 未加载
评论 #40809290 未加载