[libcxx-commits] [PATCH] D61878: Use is_permutation when comparing containers

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 13 18:11:32 PDT 2019


zoecarver marked an inline comment as done.
zoecarver added a comment.

I can add a benchmark for this. I have a few other tests (using map, etc.). I will refer to this <https://libcxx.llvm.org/docs/TestingLibcxx.html#benchmarks>, but I might have a few questions :)



================
Comment at: include/unordered_map:1654
+        if (__found == __y.end() || !(*__found == *__i))
             return false;
     }
----------------
mclow.lists wrote:
> This seems odd to me. 
> 
> The old code cached both `__x.end()` and `__y.end()`.
> The new code caches only `__x.end()`.
> 
> Why?
> Either it's worth caching `end()` or it is not.
> 
The old code compares the found value to a stored variable whereas here I compare it to `__y.end()`. I don't think it makes a difference. I think it's just a thing I did when re-writing these. I am happy to use either. 


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61878/new/

https://reviews.llvm.org/D61878





More information about the libcxx-commits mailing list