[clang] [llvm] DO NOT MERGE: Identify places that need reserve. (PR #136543)

Jakub Kuderski via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 24 09:09:38 PDT 2025


================
@@ -2113,12 +2113,63 @@ void erase(Container &C, ValueType V) {
   C.erase(std::remove(C.begin(), C.end(), V), C.end());
 }
 
+namespace detail {
+template <typename Range>
+using check_has_member_iterator_category_t =
+    typename decltype(std::declval<Range &>().begin())::iterator_category;
+
+template <typename Range>
+static constexpr bool HasMemberIteratorCategory =
+    is_detected<check_has_member_iterator_category_t, Range>::value;
----------------
kuhar wrote:

iterator_traits should already handle plain pointers, so I think we'd want to use that instead of looking for `iterator_category`?

https://github.com/llvm/llvm-project/pull/136543


More information about the cfe-commits mailing list