<div dir="rtl"><div dir="ltr">Hi Alp,</div><div dir="ltr"><br></div><div dir="ltr">Would you like me to continue with this count() patch for SmallSet and the other bool count() functions in ADT?</div><div dir="ltr"><br></div>

<div dir="ltr">Yaron</div><div dir="ltr"><br></div></div><div class="gmail_extra"><div dir="ltr"><br><br><div class="gmail_quote">2013/11/24 Yaron Keren <span dir="ltr"><<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@gmail.com</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 .8ex;border-left:1px #ccc solid;border-right:1px #ccc solid;padding-left:1ex;padding-right:1ex"><div dir="rtl"><div dir="ltr">Hi,</div><div dir="ltr"><br></div><div dir="ltr">

std::set count() indeed returns unsigned 0 or 1 only, so it makes sense for SmallSet to do the same.</div><div dir="ltr"><br></div><div dir="ltr">
Regarding the patch,  the original code </div><div dir="ltr"><br></div><div dir="ltr"><font face="courier new, monospace"> return Set.count(V); </font></div><div dir="ltr"><br></div><div dir="ltr">should work without the ternary operator as it returns the std::set count() unsigned 0/1 result which is exactly what we want.</div>


<div dir="ltr"><br></div><div dir="ltr">Looking around in ADT,  some other count( are already patched like MapVector and StringMap while others are still "bool count(" :</div><div dir="ltr"><br></div><div dir="ltr">


  DenseMap, DenseSet, ScopedHashTable, SmallPtrSet, SparseSet, ValueMap</div><div dir="ltr"><br></div><div dir="ltr">To be consistent with STL and the already-patched ADT, shouldn't we patch all of them?</div><div dir="ltr">


<br></div><div dir="ltr">Diagnostics - the more the better, at least for me.</div><span class="HOEnZb"><font color="#888888"><div dir="ltr"><br></div><div dir="ltr">Yaron</div><div dir="ltr"><br></div></font></span></div>

<div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">
<div dir="ltr">2013/11/24 Alp Toker <span dir="ltr"><<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a>></span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><br>
On 01/10/2013 19:25, Yaron Keren wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In SemaLookup.cpp, line 4102 the test is somewhat wrong, as count (surprisingly given its name) return a boolean and not an integer.<br>
<br>
locs->second.count(TypoName.<u></u>getLoc()) > 0)<br>
<br>
A patch is attached.<br>
</blockquote>
<br></div>
Aaron fixed this in r192043.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I think this count function should be renamed to exists to better reflect its function.<br>
</blockquote>
<br></div>
For better or worse count() is what STL templates expect, so best not to change that.<br>
<br>
It could however return an unsigned integral type, and I've attached a patch to do that, using unsigned rather than size_t to match SmallSet::size(). LGTY?<br>
<br>
Also, MSVC diags on inequality comparison with bool, wonder if that would be nice to have in clang (in fact I thought this kind of comparison range check already existed, weird.)<br>
<br>
Alp.<br>
<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Yaron<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-commits</a><span><font color="#888888"><br>
</font></span></blockquote><span><font color="#888888">
<br>
-- <br>
<a href="http://www.nuanti.com" target="_blank">http://www.nuanti.com</a><br>
the browser experts<br>
<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div></div></div>