diff options
author | Abseil Team <absl-team@google.com> | 2020-02-11T18·47-0800 |
---|---|---|
committer | Mark Barolak <mbar@google.com> | 2020-02-11T18·50-0500 |
commit | 98eb410c93ad059f9bba1bf43f5bb916fc92a5ea (patch) | |
tree | 4dffc4639ac9100f754b9db7ba8895322435b8ea /absl/container/internal/btree.h | |
parent | bf78e977309c4cb946914b456404141ddac1c302 (diff) |
Export of internal Abseil changes
-- daa829a331a2316713681b5fe7630d1951e0fdec by Gennadiy Rozental <rogeeff@google.com>: Eliminate Flag's destroy method. The Abseil Flags are never destroyed. The only place where Destroy method was invoked was in some obscure place during flag registration, where we faces with duplicate retired flag registration. Regired Flag destruction is empty anyway. so we can just delete the duplicate object. The FLagImpl::Destroy is never invoked. PiperOrigin-RevId: 294472413 -- 3c159499ccde8ccdd6907b3a1ddb26be7d3f016f by Abseil Team <absl-team@google.com>: Internal change. PiperOrigin-RevId: 294401573 -- 25910db425c50d9b9a8f8275af5a67c2935934fd by Shahriar Rouf <nafi@google.com>: Optimize absl::string_view::compare. Motivation: https://godbolt.org/z/Uz8DWV PiperOrigin-RevId: 294286196 GitOrigin-RevId: daa829a331a2316713681b5fe7630d1951e0fdec Change-Id: I818dad27ac5eb61bb7632e01224953cd882803bf
Diffstat (limited to 'absl/container/internal/btree.h')
-rw-r--r-- | absl/container/internal/btree.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/absl/container/internal/btree.h b/absl/container/internal/btree.h index 8644255c0330..fd5c0e7aba9c 100644 --- a/absl/container/internal/btree.h +++ b/absl/container/internal/btree.h @@ -1906,8 +1906,7 @@ inline auto btree<P>::insert_hint_unique(iterator position, const key_type &key, -> std::pair<iterator, bool> { if (!empty()) { if (position == end() || compare_keys(key, position.key())) { - iterator prev = position; - if (position == begin() || compare_keys((--prev).key(), key)) { + if (position == begin() || compare_keys(std::prev(position).key(), key)) { // prev.key() < key < position.key() return {internal_emplace(position, std::forward<Args>(args)...), true}; } @@ -1953,17 +1952,16 @@ auto btree<P>::insert_hint_multi(iterator position, ValueType &&v) -> iterator { if (!empty()) { const key_type &key = params_type::key(v); if (position == end() || !compare_keys(position.key(), key)) { - iterator prev = position; - if (position == begin() || !compare_keys(key, (--prev).key())) { + if (position == begin() || + !compare_keys(key, std::prev(position).key())) { // prev.key() <= key <= position.key() return internal_emplace(position, std::forward<ValueType>(v)); } } else { - iterator next = position; - ++next; - if (next == end() || !compare_keys(next.key(), key)) { - // position.key() < key <= next.key() - return internal_emplace(next, std::forward<ValueType>(v)); + ++position; + if (position == end() || !compare_keys(position.key(), key)) { + // {original `position`}.key() < key < {current `position`}.key() + return internal_emplace(position, std::forward<ValueType>(v)); } } } |