[PATCH] D52697: Bug 39129: Speeding up partition_point/lower_bound/upper_bound by using unsigned difference_type when possible.

Denis Yaroshevskiy via Phabricator reviews at reviews.llvm.org
Sat Sep 29 16:28:06 PDT 2018


dyaroshev added a comment.

Thanks for the quick review! I will address you comments tomorrow.

- In general, this is the kind of optimization that I would rather see the compiler do (everywhere, automatically) than libc++ (here and there, manually).

I don't think it can, can it? The optimization comes from knowing the last - first will never be < 0. How would the compiler know that?



================
Comment at: include/algorithm:4162
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    bool operator()(_Reference __u)
----------------
mclow.lists wrote:
> Why constexpr after C++11?
Mostly to be constexpr in c++17. Do I say 17 instead? Can be contstexpr in 11 no problem


Repository:
  rCXX libc++

https://reviews.llvm.org/D52697





More information about the libcxx-commits mailing list