diff options
author | Abseil Team <absl-team@google.com> | 2020-08-13 14:05:00 -0700 |
---|---|---|
committer | Gennadiy Rozental <rogeeff@google.com> | 2020-08-14 03:35:22 -0400 |
commit | c6b3f2cf583d8fec124f9d70a172b513363506fe (patch) | |
tree | 25125e2b94f758297a9919288cbd95eda1bbc9e1 /absl/container/btree_map.h | |
parent | 1beb3191c20ea315186dc761540d25c4939f1892 (diff) |
Export of internal Abseil changes
--
0c8282d75798c77733eee6167870bcc6acc0bfc1 by Evan Brown <ezb@google.com>:
Provide mutable access to the key in node handles using std::launder when compiled with C++17 or later.
Also, document why we can't provide mutable access to the key without C++17.
Note: we use Policy::mutable_key() because btree already uses Policy::key() internally to get const key access, and we want to avoid calling std::launder unless we need mutable access to the key.
PiperOrigin-RevId: 326519000
--
8018d0c3044400f0a731b0d2d00b606742c98818 by Xiaoyi Zhang <zhangxy@google.com>:
Move `Status` internal symbols from the public header into an internal header file.
PiperOrigin-RevId: 326471847
--
87a7644864ba7c003b0611898aaba1b71c840376 by Abseil Team <absl-team@google.com>:
Avoid a costly divide (the division accounts for 10% of the time spent in the function).
When the division is signed, the compiler has to generate a div. When it is unsigned, it can generate a shift: https://godbolt.org/z/vGfTv4. As per the test above the div, we know that the value is unsigned.
PiperOrigin-RevId: 326453275
GitOrigin-RevId: 0c8282d75798c77733eee6167870bcc6acc0bfc1
Change-Id: I0a953558358055ab3dc6a533d8930698509b1195
Diffstat (limited to 'absl/container/btree_map.h')
-rw-r--r-- | absl/container/btree_map.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/absl/container/btree_map.h b/absl/container/btree_map.h index bb450ead..448ac48a 100644 --- a/absl/container/btree_map.h +++ b/absl/container/btree_map.h @@ -325,6 +325,11 @@ class btree_map // does not contain an element with a matching key, this function returns an // empty node handle. // + // NOTE: when compiled in an earlier version of C++ than C++17, + // `node_type::key()` returns a const reference to the key instead of a + // mutable reference. We cannot safely return a mutable reference without + // std::launder (which is not available before C++17). + // // NOTE: In this context, `node_type` refers to the C++17 concept of a // move-only type that owns and provides access to the elements in associative // containers (https://en.cppreference.com/w/cpp/container/node_handle). @@ -652,6 +657,11 @@ class btree_multimap // does not contain an element with a matching key, this function returns an // empty node handle. // + // NOTE: when compiled in an earlier version of C++ than C++17, + // `node_type::key()` returns a const reference to the key instead of a + // mutable reference. We cannot safely return a mutable reference without + // std::launder (which is not available before C++17). + // // NOTE: In this context, `node_type` refers to the C++17 concept of a // move-only type that owns and provides access to the elements in associative // containers (https://en.cppreference.com/w/cpp/container/node_handle). |