[PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

Duncan P. N. Exon Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 16:17:45 PST 2016


Ah, so the cost isn't necessarily the same.  I don't think this
is worth it then.  (Although, paradoxically, it opens up an avenue
for testing, via a custom allocator which counts </!= comparisons.)

Any other ideas for improving the failure mode?

> On 2016-Feb-09, at 16:14, Marshall Clow <mclow.lists at gmail.com> wrote:
> 
> mclow.lists added a comment.
> 
>> Since `__new_last` and `__end_` are raw pointers, < should be the same cost as !=.
> 
> 
> `pointer` is an alias for `allocator_traits<_Alloc>::pointer`, which might not be a raw pointer.
> 
> 
> http://reviews.llvm.org/D17053
> 
> 
> 



More information about the cfe-commits mailing list