<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 5, 2014 at 11:21 PM, Yaron Keren <span dir="ltr"><<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr">Which types should be used in ADT?</div><div dir="ltr"><br></div><div dir="ltr">Currently it's a mix:</div>
<div dir="ltr"><br></div><div dir="ltr">* Most data types use unsigned.<br></div>

<div dir="ltr">* SetVector use size_type, locally typedef to vector_type::size_type size_type where vector_type is the template argument to SetVector.</div><div dir="ltr">* StringMap use size_type, locally typedef to the global size_t.</div>


<div dir="ltr">* SmallString and StringRef uses size_t.</div></div></blockquote><div><br></div><div>If we want our container-like types to be containers, count should return size_type. I suspect that size_type == size_t is probably the best choice (for performance and code size), but I really doubt this makes much difference. I don't think there are many cases where we'd want to support containers of more than 4Gi elements. (In short, I don't think this really matters, but each container should be internally consistent.)</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr">Yaron</div><div dir="ltr"><br></div><div dir="ltr"><br></div></div><div class="gmail_extra">
<div dir="ltr"><br><br><div class="gmail_quote">

2014-06-06 3:21 GMT+03:00 Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span>:<div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div class="gmail_extra"><div class="gmail_quote"><div>On Tue, Jun 3, 2014 at 2:11 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+  /// count -<br>
<br>
While at it, please drop the name from the comment.<br>
<br>
I think the patch is OK. Richard, do you know what is the reason the<br>
stl uses size_type?</blockquote><div><br></div></div><div>I don't know for sure, but probably for consistency and ease of specification of the interface.</div><div><br></div><div>[It's been like that since Stepanov and Lee's original implementation, where the red-black tree implementation shared by set,map,multiset,multimap did not distinguish between the unique and non-unique cases in its 'count' implementation.]</div>


<div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
On 23 December 2013 06:51, Yaron Keren <<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@gmail.com</a>> wrote:<br>
> The count() function for STL datatypes returns unsigned, even where it's<br>
> only 1/0 result like std::set. Some of the LLVM ADT already return unsigned<br>
> count(), while others still return bool count().<br>
><br>
> In continuation to r197879, this patch modifies DenseMap, DenseSet,<br>
> ScopedHashTable, ValueMap:: count() to return unsigned instead of bool, 1<br>
> instead of true and 0 instead of false.<br>
><br>
> Yaron<br>
><br>
><br>
</div></div>> _______________________________________________<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/mailman/listinfo/cfe-commits</a><br>
><br>
</blockquote></div></div><br></div></blockquote></div></div></div></div></div>
</blockquote></div><br></div></div>