44 Commits

Author SHA1 Message Date
Drishti Tripathi
b368f2cc55 PR #2057: doc: clarify moved-from state for hash containers
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2057

Adds documentation to flat_hash_map, flat_hash_set, node_hash_map, and
node_hash_set clarifying the moved-from contract for Swiss table containers.

After a move, only destruction, assignment, and clear() are guaranteed
safe. Any other operation (e.g. size(), empty(), iteration) results in
undefined behavior.

Fixes #1928
Merge 64990acd7a into c7269872a5

Merging this change closes #2057

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/2057 from DrishtiTripathi2230:oc/moved-from-hash-container-state 64990acd7a
PiperOrigin-RevId: 919140795
Change-Id: Ie755387c46907b0e5a78d4e21577173616c10f9f
2026-05-21 10:52:18 -07:00
Peter Collingbourne
8fb4507d10 Fix strict aliasing violation in node_hash_map
node_hash_map uses the function TypeErasedDerefAndApplyToSlotFn to hash a
slot's key. This function accesses a slot pointer as if it were of type
Key* when in fact it is of type value_type* (aka std::pair<const Key,
Value> *). This is technically a strict aliasing violation because the
types of the pointer objects are different.  Fix it by defining a new
type erased function TypeErasedDerefAndApplyToSlotFirstFn that uses the
correct type for the pointer.

PiperOrigin-RevId: 918067685
Change-Id: I5d65e0e077f84a0f869be0e24fee094b4b09fbfb
2026-05-19 15:45:30 -07:00
Abseil Team
852fc61f31 Remove more lingering C++17 type traits polyfill usages
This will let us deprecate the declarations without triggering warnings in Abseil itself.

PiperOrigin-RevId: 906360966
Change-Id: Iee362ac0eac647909ef38003280f1179813f764d
2026-04-27 08:03:53 -07:00
Abseil Team
95619d531e Remove more lingering C++17 type traits polyfill usages
This will let us deprecate the declarations without triggering warnings in Abseil itself.

PiperOrigin-RevId: 895480358
Change-Id: I2e15877c15ed83f48ddb68cc73344c14b533bc68
2026-04-06 13:44:35 -07:00
Abseil Team
af4f27f00a Construct {flat,node}_hash_{set,map} w/ from_range
Adds constructors accepting std::from_range if building with C++23. See https://en.cppreference.com/w/cpp/ranges/from_range.html for context.

PiperOrigin-RevId: 867742476
Change-Id: I9ab07e772477bcc29fff438903b90945b89c5a1f
2026-02-09 13:15:24 -08:00
Samuel Benzaquen
4ab5394975 Refactor the declaration of raw_hash_set/btree to omit default template parameters from the subclasses.
This reduces binary bloat by making mangled names smaller and by reducing strings like `__PRETTY_FUNCTION__.`
The default types can be inferred and do not provide extra information.

PiperOrigin-RevId: 844837029
Change-Id: I67f3c9445bd018ea829fa584784095e2e84cb739
2025-12-15 10:50:08 -08:00
Abseil Team
e12330f35b Automated rollback of commit cad60580db.
PiperOrigin-RevId: 819254219
Change-Id: I6bd21984f71d9ef76ed71974f9422b05df363724
2025-10-14 09:16:07 -07:00
Abseil Team
cad60580db Clarify the post-condition of reserve() in Abseil hash containers.
The comments for `reserve()` in `flat_hash_map`, `flat_hash_set`, `node_hash_map`, and `node_hash_set` are updated to explicitly state that after calling `reserve(count)`, at least `count - size()` additional elements can be inserted without triggering a rehash.

PiperOrigin-RevId: 818932349
Change-Id: I76b014eace2367ca7aac8f5ba5cf6e5d9cbc50f1
2025-10-13 18:59:02 -07:00
Shahriar Rouf
f2678d2f9d Clarify the post-condition of reserve() in Abseil hash containers.
The comments for `reserve()` in `flat_hash_map`, `flat_hash_set`, `node_hash_map`, and `node_hash_set` are updated to explicitly state that after calling `reserve(count)`, at least `count - size()` additional elements can be inserted without triggering a rehash.

PiperOrigin-RevId: 818745339
Change-Id: I3acfa18f95ca3867969826c8b596045fa8da9159
2025-10-13 11:08:42 -07:00
Evan Brown
52227846bb Pass swisstable seed as seed to absl::Hash so we can save an XOR in H1.
This reverts the optimization in Copy() of not hashing keys for single-group tables because we can no longer depend on H2 being constant for different tables of the same type.

Note that I also tried a version in which we don't change PerTableSeed to use sign-extended loads, but that version had worse performance on loadtests - presumably because the high bits of the seed are all 0. The intuition here is that if the high bits of the seed are all 0, then the high bits of the 128-bit product of the first Mix can also be all 0, which degrades the quality of the state after the first Mix.

PiperOrigin-RevId: 772077751
Change-Id: I5193d90209f4a0c7b41e36a484adb989311aed65
2025-06-16 10:19:27 -07:00
Abseil Team
2fe3c4b14e Indent absl container examples consistently
PiperOrigin-RevId: 759023113
Change-Id: I84d18d16abddf70a00160e2bc3c25d5a90f52e79
2025-05-15 00:46:16 -07:00
Abseil Team
b12a6f75f6 Add note about sparse containers to (flat|node)_hash_(set|map).
PiperOrigin-RevId: 741066736
Change-Id: I217685dcd208dcdf58628811db868aaea64ad3c0
2025-03-27 01:57:35 -07:00
Abseil Team
e3cf5b3de9 Add comment on how to get next element after using erase.
PiperOrigin-RevId: 696930388
Change-Id: I7bd45c8a80458a84826a85392106d18833901154
2024-11-15 10:30:42 -08:00
Abseil Team
2abe94a3b0 Migrate ABSL_INTERNAL_ATTRIBUTE_OWNER and ABSL_INTERNAL_ATTRIBUTE_VIEW to ABSL_ATTRIBUTE_OWNER and ABSL_ATTRIBUTE_VIEW
PiperOrigin-RevId: 666390885
Change-Id: I85457d39cf5ecb1c6622c6d59cb1876b154d64c3
2024-08-22 09:59:40 -07:00
Abseil Team
13ec8d5d29 Add absl::swap functions for *_hash_* to avoid calling std::swap
We already have `swap(raw_hash_set&, raw_hash_set&)` thus we may expect argument dependent lookup will use that function in following code snippet:
```
absl::flat_hash_map<...> x, y;
using std::swap;
swap(x, y);
```
But in practice `std::swap` will be called because `swap(raw_hash_set&, raw_hash_set&)` requires derived-to-base conversion while `std::swap` doesn't (it is a function template), thus `std::swap` is picked by compiler.

To avoid this, we need a `swap` implementations which accept the exact `*_hash_*` types which is more preferred over `std::swap`.

Note that this will fix issues#1571.

PiperOrigin-RevId: 657419420
Change-Id: Id003b2129187ce2d4583029789ff96247d1490de
2024-07-29 20:04:12 -07:00
Evan Brown
e696f9f83d Update swisstable swap API comments to no longer guarantee that we don't move/swap individual elements.
These comments have been wrong since the launch of swisstable SOO.

PiperOrigin-RevId: 655916107
Change-Id: I18af13ccb19702266551b43251370a95f6c8bc90
2024-07-25 05:13:05 -07:00
Vitaly Goldshteyn
10ac811f7c Create absl::container_internal::c_for_each_fast for SwissTable.
This function is aimed to achieve faster iteration through the entire hash table.
It is not ready to be used by the public and stays in `container_internal` namespace.

Differences with `absl::c_for_each`:
1. No guarantees on order of iteration. Although for the hash table it is partially not guaranteed already. But we do not even guarantee that it is the same order as in the for loop range. De facto, the order is the same at the moment.
2. No mutating reentrance is allowed. Most notably erasing from the hash_table is not allowed.

Based on microbenchmarks, there are following conclusions:
1. c_for_each_fast is clearly faster on big tables with 20-60% speedup.
2. Microbenchmarks show regression on a full small table without any empty slots.
   We should avoid recommending that for small tables.
3. It seems reasonable to use `c_for_each_fast` in places, where `skip_empty_or_deleted` has significant GCU usage. `skip_empty_or_deleted` usage signals that there are "gaps" between elements, so `c_for_each_fast` should be an improvement.

PiperOrigin-RevId: 645142512
Change-Id: I279886b8c8b2545504c2bf7e037d27b2545e044d
2024-06-20 13:45:02 -07:00
Evan Brown
e181410198 Document that swisstable and b-tree containers are not exception-safe.
For performance reasons, these containers are optimized for the case in which allocations/deallocations/comparisons/hashers can't throw exceptions.

PiperOrigin-RevId: 645054627
Change-Id: I99be651b26f5bbb87da6ef246b92b20a375224d7
2024-06-20 09:11:33 -07:00
Abseil Team
567ebd0540 Add ABSL_INTERNAL_ATTRIBUTE_VIEW and ABSL_INTERNAL_ATTRIBUTE_OWNER attributes to types in Abseil
PiperOrigin-RevId: 642619703
Change-Id: I8d2e423a3c7f40709d0e8c82cac0395c75d601cf
2024-06-12 08:14:45 -07:00
Dennis Kormalev
08b21bd037 Add public aliases for default hash/eq types in hash-based containers
Generic user code sometimes wants to provide more flexibility for its
own users and provide type arguments that are used as Hash/Eq in
underlying containers.

However, there is no sensible publicly available default value for it
yet.

This CL fixes this issue and provides publicly visible aliases that such
user code can use.

PiperOrigin-RevId: 627844757
Change-Id: I4c393007244ad8d998da02883c623eae1715c0df
2024-04-24 14:06:05 -07:00
Evan Brown
c6ed744ea5 Roll back extern template instatiations in swisstable due to binary size increases in shared libraries.
PiperOrigin-RevId: 615497725
Change-Id: Ic29db8923ea4ea7cd0b01b396896fa9fff8c74b0
2024-03-13 12:00:20 -07:00
Evan Brown
0385612966 Add extern templates for common swisstable types.
Motivation: mitigate linker input size increase from swisstable optimizations.

Note: the changes in raw_hash_set.h are fixing build errors that happened when adding the explicit instantiations. The change in unchecked_deref is because set iterators have const reference access whereas map iterators have mutable reference access and the function is never actually called for sets (it's used in raw_hash_map) so it wasn't needed before. I'm not sure why the soo_slot/soo_iterator problems didn't cause compile errors earlier.
PiperOrigin-RevId: 615174043
Change-Id: Iac5eb2332a76e9b70021156fbb2b8def47a5391d
2024-03-12 14:31:30 -07:00
Dennis Kormalev
643b48a3b4 Add absl_container_hash-based HashEq specialization
SwissTable provides support for heterogeneous lookup in associative
containers through transparent Hash and Eq types. However, it is not
possible for user types to provide additional specializations to allow
their types to use this functionality.

This CL brings ability for user types to specify their own transparent
absl_container_hash and (optionally) absl_container_eq inner types to
achieve the same functionality.

PiperOrigin-RevId: 604994859
Change-Id: I302486d292c9a18b7d4c77033227008f5539e354
2024-02-07 08:40:46 -08:00
Abseil Team
4c7e7c7d94 Type erased hash_slot_fn that depends only on key types (and hash function).
PiperOrigin-RevId: 603148301
Change-Id: Ie2e5702995c9e1ef4d5aaab23bc89a1eb5007a86
2024-01-31 13:46:58 -08:00
Evan Brown
7fc3c7fe72 Change the API constraints of erase(const_iterator, const_iterator) so that calling erase(begin(), end()) resets reserved growth.
PiperOrigin-RevId: 551248712
Change-Id: I34755c63e3ee40da4ba7047e0d24eec567d28173
2023-07-26 10:34:46 -07:00
Vertexwahn
d60c3ac625 Fix spelling mistakes 2023-05-02 20:24:15 +02:00
Abseil Team
d29393ceb9 Fixed typo in try_emplace comment.
PiperOrigin-RevId: 446010475
Change-Id: I28020510f3888a11f35b1960e9af441145ebf39b
2022-05-02 13:08:39 -07:00
Abseil Team
c27ab06897 Export of internal Abseil changes
--
3d018c03a34bf273a4b24b3584ed77f0a6d21686 by Abseil Team <absl-team@google.com>:

Fix a spelling typo (s/boundries/boundaries).

PiperOrigin-RevId: 442041877
Change-Id: I608020697d37b85316bb9a0838e4b457659c926c

--
518b8119e51db24ce7fb0fd2fe537ec43825c3e6 by Dino Radakovic <dinor@google.com>:

absl/types/internal/variant: Make include guard uppercase

https://google.github.io/styleguide/cppguide.html#The__define_Guard

PiperOrigin-RevId: 441911692
Change-Id: I9837dd07f20204d8253f20627b0917a34dc21825

--
b91696c38310a7cae8c1ea9e2d479495f5dc3f69 by Greg Falcon <gfalcon@google.com>:

Add an internal-only API to wrap __builtin_prefetch() if available.

This private API is intended for future use by the Abseil implementation.  Like any internal-namespaced function, it may be changed or removed at any time.

PiperOrigin-RevId: 441894616
Change-Id: Iaa48bd4680b373f4a0d5afab0cb35e2a1908595f

--
0f01e8b0551a662e02dff60840c54320f987315f by Derek Mauro <dmauro@google.com>:

C++20: Use the standard `constinit` keyword for `ABSL_CONST_INIT` when available

PiperOrigin-RevId: 441778874
Change-Id: I70c616469752ff23b326b1c615437599f42cc6aa
GitOrigin-RevId: 3d018c03a34bf273a4b24b3584ed77f0a6d21686
2022-04-18 15:51:27 -04:00
Abseil Team
231c393a17 Export of internal Abseil changes
--
5dc885f2b62993bccf33a3f3b99f7e460c819c89 by Derek Mauro <dmauro@google.com>:

Remove the internal-only ABSL_INTERNAL_ASSUME now that ABSL_ASSUME
is available and ABSL_INTERNAL_ASSUME has no more users.

Improve the documentation to ABSL_ASSUME somewhat.

PiperOrigin-RevId: 434803125
Change-Id: I7c27418463ffc1c7e10ecd50e2d17f348f686af7

--
4aea19a0ef596228c9136a4c2446e6f25085f23c by Derek Mauro <dmauro@google.com>:

Update documentation to warn against using absl::Hash across
dynamically loaded libraries

Fixes #1128

PiperOrigin-RevId: 434723247
Change-Id: Ib0c7ba03b2cab98b42e19e85be6833192d4b4067
GitOrigin-RevId: 5dc885f2b62993bccf33a3f3b99f7e460c819c89
2022-03-15 20:21:30 -04:00
Abseil Team
9336be04a2 Export of internal Abseil changes
--
e7f53dfbf809812e84770217777f81b6308a3084 by Abseil Team <absl-team@google.com>:

Add a parameter pack to absl profile to allow profiles to separate
dynamic data from static data that is available at constructor-time.

Background: `inline_element_size` is effectively constant, but there
is a data race between its initialization and its access. We had fixed that race by making
inline_element_size atomic.  This CL changes `inline_element_size`
back to a non-atomic integer, and provides a way for all profiles to
provide Register()-time values.
PiperOrigin-RevId: 413960559

--
70234c5943f8e37e17c1d9c54d8ed61d39880abf by Chris Kennelly <ckennelly@google.com>:

Document that absl::FunctionRef does not allocate.

PiperOrigin-RevId: 413946831

--
3308ae571412c4be3cc32d088c6edac98ff2d1ed by Samuel Benzaquen <sbenza@google.com>:

Internal change

PiperOrigin-RevId: 413933619

--
1617093a730d055edcf7bc04fdd6509783f5f75d by Martijn Vels <mvels@google.com>:

Internal Change

PiperOrigin-RevId: 413778735

--
03ad683f059c806a6c8b04f5b79b2662c3df8c73 by Evan Brown <ezb@google.com>:

Unify btree erase_if definitions and optimize them so that we only do rebalancing once per leaf node.

PiperOrigin-RevId: 413757280

--
5ba402f70801938178e486617063f01c7862525d by Martijn Vels <mvels@google.com>:

Cleanup up cord sampling internals

PiperOrigin-RevId: 413755011

--
522da8f9d3e0f11630d89fb41952004742bc335a by Evan Brown <ezb@google.com>:

Add b-tree benchmark for erase_if.

Since this benchmark doesn't work for std:: containers before C++20, disable it for them.

PiperOrigin-RevId: 413740844

--
a690ea42de8ed4a761d00235d8b2fb7548ba9732 by Andy Getzendanner <durandal@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 413735737
GitOrigin-RevId: e7f53dfbf809812e84770217777f81b6308a3084
Change-Id: I4f9f9039ba92831bc48971964aa063244c9fed72
2021-12-03 13:15:13 -05:00
Abseil Team
cad715dbf3 Export of internal Abseil changes
--
e2a571b818faaec4185426a8cf71fd2970674423 by Matt Kulukundis <kfm@google.com>:

Fix missed use of old RTTI macro

PiperOrigin-RevId: 413239579

--
e3c15a3fe0a4e44d6e08d69ad912b2245a403bd6 by Derek Mauro <dmauro@google.com>:

Makes erase_if return the number of erased elements for compatibility
with C++20

https://en.cppreference.com/w/cpp/container/unordered_map/erase_if

This may technically be an API break, but no actual breaks were found
in Google code. Fixes to open source code should be trivial.

Closes #1065

PiperOrigin-RevId: 413204392

--
c1fb1ddbc2def3f3d177e5b80b9934bdbb7b16fc by Matt Kulukundis <kfm@google.com>:

Consolidate to a single HAS_RTTI macro

PiperOrigin-RevId: 413169336
GitOrigin-RevId: e2a571b818faaec4185426a8cf71fd2970674423
Change-Id: I74b78ebd5fc172e3f5fcbd13a58cf53f7b250ae9
2021-12-01 13:14:03 -05:00
Abseil Team
299f59cadd Export of internal Abseil changes
--
2130ba98c8359b08d97fb16d84dfd05687005dcf by Abseil Team <absl-team@google.com>:

Tweaking the documentation of c_all_of to state the effect more directly.

PiperOrigin-RevId: 410557900

--
4732289bf4b56123fed113e36be4710b55c6a6c7 by Greg Falcon <gfalcon@google.com>:

Improve the quality of absl::Hash<std::vector<bool>>.

This previously dispatched to std::hash<vector<bool>>, which suffers from trivial collisions on many platforms.  (They often hash the internal words but no size info, so that, e.g., {1, 1} and {1, 1, 0} collide.)

Also extended the unit test to exercise this.

PiperOrigin-RevId: 410329943

--
1c5f3934230a7669f74c96b305251786a265e235 by Greg Falcon <gfalcon@google.com>:

Add broader testing of absl hash contracts in the hash unit test.

In particular, test that the hash erasure mechanism works.

PiperOrigin-RevId: 410312738

--
5e1923f527ed3d02f6752a5b38d5e1c17a4a146f by Derek Mauro <dmauro@google.com>:

Internal change

PiperOrigin-RevId: 410290663

--
8c74bc962b3b98a5908017c345efc592393048ea by Martijn Vels <mvels@google.com>:

Add Cord::CreateFlat() function

PiperOrigin-RevId: 410260776

--
bd0de4e94c85620d3b8dd60fae367b730fc4cb34 by Evan Brown <ezb@google.com>:

Rename node_hash_policy to node_slot_policy.

Motivation: we can potentially reuse this code for node_btree_*.
PiperOrigin-RevId: 410082271
GitOrigin-RevId: 2130ba98c8359b08d97fb16d84dfd05687005dcf
Change-Id: Ie052084cf992dee250d8b2f388d39c4de0dcff40
2021-11-17 22:50:31 -05:00
Abseil Team
c1ae0a4975 Export of internal Abseil changes
--
14d42e9d0b8aed0c0f00900cd6fd790908930de5 by Gennadiy Rozental <rogeeff@google.com>:

Fix gcc ci build command for LTS

PiperOrigin-RevId: 331543198

--
f1655ec91a4ad656dd1100cf2e134d08941278ca by Abseil Team <absl-team@google.com>:

Consistently document size_type return value of all map/set types.

PiperOrigin-RevId: 331528359
GitOrigin-RevId: 14d42e9d0b8aed0c0f00900cd6fd790908930de5
Change-Id: I33ebba4acb3e5918e4e112f03c81aba529dcd0b4
2020-09-16 06:16:20 -04:00
Abseil Team
c6b3f2cf58 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
2020-08-14 03:35:22 -04:00
Abseil Team
ca9856cabc Export of internal Abseil changes
--
53550735f5a943dfb99225e7c53f211c2d6e7951 by Gennadiy Rozental <rogeeff@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 309333648

--
847bbf8a1d9cd322ec058c6f932d1f687fd3d331 by Gennadiy Rozental <rogeeff@google.com>:

Make Validation interfaces private in CommandLineFlag.

Calls are rewired via private interface access struct.

PiperOrigin-RevId: 309323013

--
a600fc5051e0a0af50a7850450fd3ed1aef3f316 by Matthew Brown <matthewbr@google.com>:

Internal Change.

PiperOrigin-RevId: 309292207

--
937d00ce3cf62c5f23f59b5377471fd01d6bfbc7 by Gennadiy Rozental <rogeeff@google.com>:

Make TypeId interface private in CommandLineFlag.

We also rewire the SaveState via the new PrivateHandleInterface trampoline class. This class will be the only way to access private methods of class CommandLineFlag.

PiperOrigin-RevId: 309282547

--
796c4bd35073b6a8337762bdb13603dae12a4df1 by Derek Mauro <dmauro@google.com>:

Cleanup uses of kLinkerInitialized

PiperOrigin-RevId: 309274734

--
c831446c52d9ef4bdcb1ea369840904620abc4b9 by Gennadiy Rozental <rogeeff@google.com>:

Eliminate the interface IsModified of CommndLineFlag.

PiperOrigin-RevId: 309256248

--
a1db59d7f7aa39cb0a37dbf80f8c04e371da8465 by Gennadiy Rozental <rogeeff@google.com>:

Avoid default value generator if default value expression is constexpr.

If possible, we detect constexpr-ness of default value expression and avoid storing default value generator in side of flag and instead set the flag's value to the value of that expression at const initialization time of flag objects.

At the moment we only do this for flags of (all) integral, float and double value types

PiperOrigin-RevId: 309110630

--
ae3b4a139aacd8fc165c9acd2a3cbae1f9e26af4 by Gennadiy Rozental <rogeeff@google.com>:

Make SaveState a private method of the CommandLineFlag and make it only accessible from FlagSaverImpl. There is no other call sites for this call.

PiperOrigin-RevId: 309073989

--
cbc24b4dcc166dd6b0208e9d7620484eaaaa7ee0 by Abseil Team <absl-team@google.com>:

Eliminate the interface IsModified of CommndLineFlag.

PiperOrigin-RevId: 309064639

--
08e79645a89d71785c5381cea9c413357db9824a by Gennadiy Rozental <rogeeff@google.com>:

Eliminate the interface IsModified of CommndLineFlag.

PiperOrigin-RevId: 309054430

--
4a6c70233c60dc8c39b7fa9beb5fa687c215261f by Gennadiy Rozental <rogeeff@google.com>:

Internal change

PiperOrigin-RevId: 308900784

--
13160efdf7710f142778d5a1e4c85aa309f019b6 by Abseil Team <absl-team@google.com>:

Provide definitions of static member variables -- improved C++11 support.

PiperOrigin-RevId: 308900290

--
0343b8228657b9b313afdfe88c4a7b2137d56db4 by Gennadiy Rozental <rogeeff@google.com>:

Rename method Get<T> to TryGet<T> per approved spec before making interface public.

PiperOrigin-RevId: 308889113

--
7b84e27fb857fc1296a05504970f506d47d2f2c1 by Derek Mauro <dmauro@google.com>:

Remove node_hash_* methods that were deprecated on release

PiperOrigin-RevId: 308837933

--
599d44ee72c02b6bb6e1c1a1db72873841441416 by Gennadiy Rozental <rogeeff@google.com>:

Eliminate CommandLineFlag::Typename interface per approved spec before making CommandLineFlag public.

PiperOrigin-RevId: 308814376
GitOrigin-RevId: 53550735f5a943dfb99225e7c53f211c2d6e7951
Change-Id: Iae52c65b7322152c7e58f222d60eb5a21699a2cb
2020-04-30 22:45:41 -04:00
Abseil Team
1de0166368 Export of internal Abseil changes
--
330051e00cd57ee516b4eaf656965656ffbcd0bc by Abseil Team <absl-team@google.com>:

Fix indentation in comment.

PiperOrigin-RevId: 287997504

--
35fb1a893e708031ba4fc0db460875eb0d31820e by Abseil Team <absl-team@google.com>:

Enable compile-time enforcement that absl::Substitute patterns to not contain unescaped $ symbols.

absl::Substitute already considers unescaped $ symbols undefined behavior and crashes when it's passed them in debug builds.  Some code isn't ever built in debug mode, though, and inadvertently used some unescaped $ symbols, which led to surprising results.  This change will prevent that problem from happening in the future.
PiperOrigin-RevId: 287906643

--
c5762833ebde6d7110bf68041a823b571c238e9e by Gennadiy Rozental <rogeeff@google.com>:

Move all the flag data into a single place instead of being split between handle and flag object.

After this change CommandLineFlag will not hold any data anymore. And we also do not need to pass the CommandLineFlag around in Abseil Flag implementation to report flag name and location.

PiperOrigin-RevId: 287899076

--
8b5fb644f1e3d9267b7a75106fe9a72c886db786 by Derek Mauro <dmauro@google.com>:

Upgrade CI testing to Bazel 2.0.0 and Clang 407ac2eb5f13

-fno-sanitize-blacklist is to workaround
https://github.com/bazelbuild/bazel/issues/10510

PiperOrigin-RevId: 287875363

--
a20cc1d58895de2babc3748a6c79d1d6813734ef by Abseil Team <absl-team@google.com>:

Make ABSL_RETIRED_FLAG behave consistently with ABSL_FLAG.

Before the change:
ABSL_RETIRED_FLAG does not compile when there are competing ctors in the type, even when ABSL_FLAG does.

After the change:
ABSL_RETIRED_FLAG compiles when ABSL_FLAG does.

PiperOrigin-RevId: 286483183

--
1cff7e67329d2be9e50bee1f2e76ef9ffd2edde5 by Abseil Team <absl-team@google.com>:

Support C++20 erase_if API in unordered associative containers

See [unord.set.erasure]: https://eel.is/c++draft/unord.set.erasure
See [unord.map.erasure]: https://eel.is/c++draft/unord.map.erasure

PiperOrigin-RevId: 286461140
GitOrigin-RevId: 330051e00cd57ee516b4eaf656965656ffbcd0bc
Change-Id: I5513110b41c2af08a44da54612cff341ac5c6607
2020-01-03 13:41:32 -05:00
Abseil Team
12bc53e031 Export of internal Abseil changes
--
c99f979ad34f155fbeeea69b88bdc7458d89a21c by Derek Mauro <dmauro@google.com>:

Remove a floating point division by zero test.

This isn't testing behavior related to the library, and MSVC warns
about it in opt mode.

PiperOrigin-RevId: 285220804

--
68b015491f0dbf1ab547994673281abd1f34cd4b by Gennadiy Rozental <rogeeff@google.com>:

This CL introduces following changes to the class FlagImpl:
* We eliminate the CommandLineFlagLocks struct. Instead callback guard and callback function are combined into a single CallbackData struct, while primary data lock is stored separately.
* CallbackData member of class FlagImpl is initially set to be nullptr and is only allocated and initialized when a flag's callback is being set. For most flags we do not pay for the extra space and extra absl::Mutex now.
* Primary data guard is stored in data_guard_ data member. This is a properly aligned character buffer of necessary size. During initialization of the flag we construct absl::Mutex in this space using placement new call.
* We now avoid extra value copy after successful attempt to parse value out of string. Instead we swap flag's current value with tentative value we just produced.

PiperOrigin-RevId: 285132636

--
ed45d118fb818969eb13094cf7827c885dfc562c by Tom Manshreck <shreck@google.com>:

Change null-term* (and nul-term*) to NUL-term* in comments

PiperOrigin-RevId: 285036610

--
729619017944db895ce8d6d29c1995aa2e5628a5 by Derek Mauro <dmauro@google.com>:

Use the Posix implementation of thread identity on MinGW.
Some versions of MinGW suffer from thread_local bugs.

PiperOrigin-RevId: 285022920

--
39a25493503c76885bc3254c28f66a251c5b5bb0 by Greg Falcon <gfalcon@google.com>:

Implementation detail change.

Add further ABSL_NAMESPACE_BEGIN and _END annotation macros to files in Abseil.

PiperOrigin-RevId: 285012012
GitOrigin-RevId: c99f979ad34f155fbeeea69b88bdc7458d89a21c
Change-Id: I4c85d3704e45d11a9ac50d562f39640a6adbedc1
2019-12-12 15:37:13 -05:00
Abseil Team
f0afae0d49 Export of internal Abseil changes
--
0f6565955231dc74ebad62ef32a18c457afa2dc7 by Abseil Team <absl-team@google.com>:

Document guarantee that we do not move from rvalue arguments if no insertion happens with absl::raw_hash_map::try_emplace, as done with std::unordered_map::try_emplace.

PiperOrigin-RevId: 264430409

--
292e6b9e08fa689e8400d7f2db94cbcab29d5889 by CJ Johnson <johnsoncj@google.com>:

Removes use of aligned_storage in FixedArray and InlinedVector in favor of aligned char buffers.

PiperOrigin-RevId: 264385559

--
aa0b19ad11ae5702022feee0e2e6434cfb28c9e9 by Derek Mauro <dmauro@google.com>:

Make the unit tests for absl::any, absl::optional, and absl::variant
no-ops when these types are just aliases for the corresponding std::
types. We have no way to fix standard library implementation bugs, so
don't bother working around them.

Also disable the corresponding exception-safety tests as well when
exceptions are not enabled.

Fixes https://github.com/abseil/abseil-cpp/pull/360

PiperOrigin-RevId: 264382050

--
65896a911f36481b89b4712c83b91c90a76b64e8 by Abseil Team <absl-team@google.com>:

Improve documentation on erase

PiperOrigin-RevId: 264381266
GitOrigin-RevId: 0f6565955231dc74ebad62ef32a18c457afa2dc7
Change-Id: I74b9bd2ddf84526014104f17e87de70bd3fe65fa
2019-08-20 15:59:49 -04:00
nik7273
38b704384c Changed HTTP URLs to HTTPS where possible (#270) 2019-03-08 10:27:53 -05:00
Abseil Team
926bfeb9ff Export of internal Abseil changes.
--
008301e65c323ea0b78e4a92221bf43f7f01e358 by Abseil Team <absl-team@google.com>:

Add k...Pad17 through 20 PadSpec enum values.

PiperOrigin-RevId: 223371590

--
ad0580b0a215257044e090181630793b7e5e9ab0 by Jon Cohen <cohenjon@google.com>:

Make the table in the prefetch check not fit in L2 cache.  This should help deflake the test.

PiperOrigin-RevId: 223224646

--
77c76690626b89944946d01da5e3428b763103e8 by Abseil Team <absl-team@google.com>:

Fixed typo in container by replacing asbl::Hash with absl::Hash.

PiperOrigin-RevId: 223083789
GitOrigin-RevId: 008301e65c323ea0b78e4a92221bf43f7f01e358
Change-Id: I81399f09cd82fbb27bcfec4c1517bb5d2fd07f3b
2018-11-29 15:52:29 -05:00
Abseil Team
7b46e1d31a Export of internal Abseil changes.
--
07575526242a8e1275ac4223a3d2822795f46569 by CJ Johnson <johnsoncj@google.com>:

Comment cleanup on InlinedVector

PiperOrigin-RevId: 221322176

--
49a5e643f85e34d53c41f5e6cc33357c55c9115d by Matt Kulukundis <kfm@google.com>:

Internal cleanup

PiperOrigin-RevId: 221309185

--
bb35be87ec9c74244b7d902e7e7d2d33ab139d76 by Abseil Team <absl-team@google.com>:

Fix typo in comment.

PiperOrigin-RevId: 221145354

--
afd4d7c106919708004e06aeea068a57c28aec44 by Derek Mauro <dmauro@google.com>:

Update the debugging log message in CallOnceImpl()

PiperOrigin-RevId: 221103254

--
0b9dace8b88113777bf26a6d38f9bc0bcaf053a1 by Abseil Team <absl-team@google.com>:

Workaround an MSVC 2015 bug in compile-time initialization.

PiperOrigin-RevId: 220871483

--
ea0a3854511ed26beab827e5a5113766b334db86 by Marek Gilbert <mcg@google.com>:

Fix ABSL_HAVE_THREAD_LOCAL when compiling for iOS 8 with Xcode 10.

Xcode 10 has moved the check for thread_local to a link time, so
clang reports __has_feature(cxx_thread_local) but then linking fails
with messages like this:

ld: targeted OS version does not support use of thread local variables
PiperOrigin-RevId: 220815885

--
485b6876c158c3dcf37eb32d7e512242d5d4ecc6 by Greg Falcon <gfalcon@google.com>:

Make the absl::c_set_xxxx() algorithms refuse to compile when passed an unordered collection from std:: or absl::.

These algorithms operate on sorted sequences; passing an unordered container to them is nearly certainly a bug.  This change is technically an API break, but it only breaks incorrect code.

We could try to be more clever and detect unordered collections from other libraries, but false positives will break legal code, and this would constitute an API break Abseil cannot afford.

PiperOrigin-RevId: 220794190

--
c47cff7f9cc70a4c1604eee0131af552f40e46d6 by Jon Cohen <cohenjon@google.com>:

MSVC 2017's STL throws a Structured Exception (not a C++ exception, essentially equivalent to SIGSEGV) when variant::emplace calls a throwing constructor when using the debug multithreaded MSVC runtime DLL.  This manifests in dbg mode in Bazel builds.  Disable tests which trigger this bug.

It's impossible to specifically pull out MSVC 2017 -dbg modes because there's no way for Bazel to know when version of MSVC is being used -- you tell Bazel the directory where the MSVC tools live, not which version of MSVC tools to use.  Thus the best we can do is switch on _DEBUG, which is set whenever the debug runtime is selected with the /MDd build flag, as in Bazel -dbg modes.  See https://msdn.microsoft.com/en-us/library/b0084kay.aspx ctrl-f "_DEBUG"

PiperOrigin-RevId: 220706161

--
43993d4af309d92f4ebff38391dcc245f154ecc7 by Shaindel Schwartz <shaindel@google.com>:

Internal change

PiperOrigin-RevId: 220688429

--
2448802972dcc261af153af464f2b022ef54a2a9 by Abseil Team <absl-team@google.com>:

Speed up operator* for uint128 in WIN64.

PiperOrigin-RevId: 220678790

--
7b376403dd05ba10152fb52e40b29d8af79b58bb by Abseil Team <absl-team@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 220654834

--
ae08af58111c3f838b8d4de25f501c3559c86002 by Abseil Team <absl-team@google.com>:

CMake: Add absl_cc_test function

PiperOrigin-RevId: 220603940
GitOrigin-RevId: 07575526242a8e1275ac4223a3d2822795f46569
Change-Id: Iba7f53eb394c8a9de564582a976793f9bb0596d9
2018-11-13 17:56:57 -05:00
Abseil Team
7990fd459e Export of internal Abseil changes.
--
ee19e203eca970ff88e8f25ce4e19c32e143b988 by Jon Cohen <cohenjon@google.com>:

Exception safety testing no longer uses absl::optional

PiperOrigin-RevId: 220336204

--
460666eb0b316a8b4aeedc589644d53b05251bd1 by Derek Mauro <dmauro@google.com>:

Rework SwissTable SSE2 support
  - Use SSE2 on MSVC when available
    https://github.com/abseil/abseil-cpp/issues/210
  - Emulate _mm_cmpgt_epi8 with other SSE2 instructions when using
    -funsigned-char under GCC
    https://github.com/abseil/abseil-cpp/issues/209

PiperOrigin-RevId: 220312351

--
1f4318ecedf8d539b7b698eb803d613ad6b69278 by Abseil Team <absl-team@google.com>:

Change CollectPerfectRatios to use 10 trials to smooth out the outliers in the
sample.

PiperOrigin-RevId: 220286579

--
6755abc2673553a7f578bb29c6e9ca8d991bc9c8 by Abseil Team <absl-team@google.com>:

Internal change

PiperOrigin-RevId: 220274307

--
8645b6187329ebf0aaf3c2de2888ba44466cd879 by Abseil Team <absl-team@google.com>:

* #endif for a header guard should reference the guard macro in a comment

PiperOrigin-RevId: 220206868

--
3987a7ad11319230910931cd2468b60b3fd1b85c by Gennadiy Civil <misterg@google.com>:

Internal Change

PiperOrigin-RevId: 220136674

--
cc908c1db2ee0d4523dc813e33f600583bb986c5 by Abseil Team <absl-team@google.com>:

absl: fix backoff logic in SpinLockWait

There are 3 bugs in loop variable handling:
1. It starts with 0, but AbslInternalSpinLockDelay ignores loop == 0.
So it does not actually wait when it should.
2. loop is incremented after successful state changes,
but it should not (why would be increase backoff delay after that?).
3. loop is incremented after CAS failures,
but it should not (why would be increase backoff delay after that?).

Use the same handling of loop as used in SpinLock.

PiperOrigin-RevId: 220136079

--
a0a1c6ef5910ebd28e07215d7df03cc0da0b3eed by Abseil Team <absl-team@google.com>:

absl: relax unnecessarily strong memory ordering in SpinLock::SlowLock

We don't need to acquire visibility over anything when setting kSpinLockSleeper.
Replace the confusing and unnecessarily strong memory order with relaxed.

PiperOrigin-RevId: 220023380

--
c50858b51af28b9fca1a62616324f85f3e84ea74 by Tom Manshreck <shreck@google.com>:

Update comments in flat_hash_map, node_hash_{set, map} and the containers developer guide

PiperOrigin-RevId: 219938692

--
e87b7d1a5f61e165b1c44d3b16d8d967197cdfce by CJ Johnson <johnsoncj@google.com>:

Rearranges the public methods of InlinedVector and cleans up the comments

PiperOrigin-RevId: 219896257

--
f3234c466f792e0fc4bfd21fc7919dba5e679375 by CJ Johnson <johnsoncj@google.com>:

Adds branch prediction to exceptional early exit cases of inlined vector's API

PiperOrigin-RevId: 219887173

--
4dfccf1a81ca0425912d3da25a8470f78c532ce4 by CJ Johnson <johnsoncj@google.com>:

Fixes the InlinedVector public interface to use the allocator type references instead of assuming the type
Also cleans up some cruft in formatting and comments

PiperOrigin-RevId: 219878876

--
4bb6a2b892abb10bd6a424db7e94ed8640802470 by Tom Manshreck <shreck@google.com>:

Add comments on constructor and assignment operator support to flat_hash_set

PiperOrigin-RevId: 219825338

--
c23f973e2f7f4feea0da36bf8a9c3f8a8954bb74 by Abseil Team <absl-team@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 219823847
GitOrigin-RevId: ee19e203eca970ff88e8f25ce4e19c32e143b988
Change-Id: I288c927ca481dc57340420dbb4c278a05cf15e83
2018-11-06 16:06:39 -05:00
Abseil Team
f21d187b80 Export of internal Abseil changes.
--
1c1d6e2404dfc6caa022b335df5acdac6da50fe1 by Derek Mauro <dmauro@google.com>:

Fix the internal namespacing in unaligned_access.h

PiperOrigin-RevId: 215434506

--
17d4400aebf025a230690fc1c7a968ef8d85bbba by Eric Fiselier <ericwf@google.com>:

gtest depends on the GCC extension allowing variadic macros
to be passed a empty parameter pack for ..., but LLVM diagnoses
this as a GNU extension.

This patch suppresses the warning when building the absl tests.

PiperOrigin-RevId: 215426161

--
f2c49dde23a9f445b9de963f1bbe840ebb568b30 by Eric Fiselier <ericwf@google.com>:

Use EXPECT_DEATH_IF_SUPPORTED instead of EXPECT_DEATH.

This avoids breaking the test when gtest doesn't support
death tests.

PiperOrigin-RevId: 215423849

--
cd687c1e121709603f4fc3726b534f6a9c52cc89 by Eric Fiselier <ericwf@google.com>:

Disable LLVM's -Wmissing-variable-declarations in tests.

GCC's configuration already disables this via -Wno-missing-declarations,
this change makes LLVM do the same.

The warning would otherwise flag most tests which use ABSL_FLAG.

PiperOrigin-RevId: 215407429

--
d14098824c84e3a8c8f6fb920e0335fb48fe2010 by Eric Fiselier <ericwf@google.com>:

Fix local variable shadowing in city hash implementation.

PiperOrigin-RevId: 215407249

--
4b5e140ba743f0d231790a26c49083abb4329e2c by Abseil Team <absl-team@google.com>:

Make raw_hash_set::reserve 2X fast when reserve doesn't do any allocation.
Make raw_hash_set::reserve ~1% faster when reserve does some (128~4k) allocation.

PiperOrigin-RevId: 215348727

--
461161e65e04b801480aa117af2534c594654ccf by Eric Fiselier <ericwf@google.com>:

Internal change

PiperOrigin-RevId: 215272283

--
50413ae31ad3d3a177257416acd8ede47a17bff2 by Eric Fiselier <ericwf@google.com>:

Internal Change

PiperOrigin-RevId: 215233183

--
477be54c43d61019a8fe4e190e340eb52737d383 by Abseil Team <absl-team@google.com>:

Clarify misleading comment on ABSL_ATTRIBUTE_UNUSED

PiperOrigin-RevId: 215185496

--
2cafa2b5287507d3a946682aee9ab13af6d471c9 by Matt Kulukundis <kfm@google.com>:

Add support for absl::Hash to various absl in types.

PiperOrigin-RevId: 215039569

--
082248901991aa3d29be0ea3689c7f213cf0fd83 by Derek Mauro <dmauro@google.com>:

Remove an instance of HAS_GLOBAL_STRING from hash_function_defaults.h

PiperOrigin-RevId: 214989094

--
b929f61907f0786a6133e3a9d7287e339c0a0acb by Derek Mauro <dmauro@google.com>:

Internal import of Github #174
Fix code snippet in comment
https://github.com/abseil/abseil-cpp/pull/174

PiperOrigin-RevId: 214958849

--
f2c5e829eca11c352e121f56eefbf87083305023 by Derek Mauro <dmauro@google.com>:

Internal import of GitHub #173
Fix CMake build for absl::container.
https://github.com/abseil/abseil-cpp/pull/173

PiperOrigin-RevId: 214957796

--
d704f860f9fddafb99e34e6c5032e49f73874e10 by Abseil Team <absl-team@google.com>:

Internal change

PiperOrigin-RevId: 214828181
GitOrigin-RevId: 1c1d6e2404dfc6caa022b335df5acdac6da50fe1
Change-Id: I551de2b1ba0cbaf6856cd5959358cf6651179dea
2018-10-03 09:19:28 -04:00
Abseil Team
48cd2c3f35 Export of internal Abseil changes.
--
4eacae3ff1b14b1d309e8092185bc10e8a6203cf by Derek Mauro <dmauro@google.com>:

Release SwissTable - a fast, efficient, cache-friendly hash table.

https://www.youtube.com/watch?v=ncHmEUmJZf4

PiperOrigin-RevId: 214816527

--
df8c3dfab3cfb2f4365909a84d0683b193cfbb11 by Derek Mauro <dmauro@google.com>:

Internal change

PiperOrigin-RevId: 214785288

--
1eabd5266bbcebc33eecc91e5309b751856a75c8 by Abseil Team <absl-team@google.com>:

Internal change

PiperOrigin-RevId: 214722931

--
2ebbfac950f83146b46253038e7dd7dcde9f2951 by Derek Mauro <dmauro@google.com>:

Internal change

PiperOrigin-RevId: 214701684
GitOrigin-RevId: 4eacae3ff1b14b1d309e8092185bc10e8a6203cf
Change-Id: I9ba64e395b22ad7863213d157b8019b082adc19d
2018-09-27 15:28:12 -04:00