clayborg added inline comments.
================ Comment at: include/lldb/Core/UniqueCStringMap.h:87 T Find(ConstString unique_cstr, T fail_value) const { - Entry search_entry(unique_cstr); - const_iterator end = m_map.end(); - const_iterator pos = std::lower_bound(m_map.begin(), end, search_entry); - if (pos != end) { - if (pos->cstring == unique_cstr) - return pos->value; - } + auto pos = llvm::lower_bound(m_map, unique_cstr, Compare()); + if (pos != m_map.end() && pos->cstring == unique_cstr) ---------------- What benefits does llvm::lower_bound offer here? With std::lower_bound and std::upper_bound you can write a comparison static functions that take a "const T &" on one side and a ConstString on the other. Lower bound will use one flavor ("static bool operator <(const T&, ConstString);") and upper_bound will use the other ("static bool operator <(ConstString, const T&);"). No need to specify a Compare() object. So the code would be: ``` T Find(ConstString unique_cstr, T fail_value) const { const_iterator end = m_map.end(); const_iterator pos = std::lower_bound(m_map.begin(), end, unique_cstr); if (pos != end && pos->cstring == unique_cstr) return pos->value; return fail_value; } ``` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63268/new/ https://reviews.llvm.org/D63268 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits