prior to C++17. `absl::string_view` is now an alias for `std::string_view`.
It is recommended that clients simply use `std::string_view`.
PiperOrigin-RevId: 845822478
Change-Id: I220530c84118e5b9ef110baa002c232ac8f2c5f2
Doing this opportunistically allows us to avoid performance overhead in the vast majority of calls (rare, non-reentrant ones) while simultaneously minimizing stack space usage.
PiperOrigin-RevId: 831560881
Change-Id: Idc6ba1dd0dcf1b4aaf3ee7cf468054bcfdcf90af
StringResizeAndOverwrite() but optimized for repeated appends, using
exponential growth to ensure amortized complexity of increasing
a string size by a small amount is O(1).
Use this function to replace STLStringResizeUninitializedAmortized()
PiperOrigin-RevId: 825100704
Change-Id: Ife64b13301bc4288d68154b7c496f57aaad4b6a4
StringResizeAndOverwrite has MSAN testing of the entire string.
This causes quadratic MSAN verification on small appends.
PiperOrigin-RevId: 824629932
Change-Id: Ibefff781f5923c8bd2c1dc364f5b63fcb1d0f5ab
StringResizeAndOverwrite() but optimized for repeated appends, using
exponential growth to ensure amortized complexity of increasing
a string size by a small amount is O(1).
Use this function to replace STLStringResizeUninitializedAmortized()
PiperOrigin-RevId: 824571998
Change-Id: I6fe4a9cadd469ceee6a3818d7b8709e2fa286b9c
This helps inform Nullability inference without needing any special casing.
Since ABSL_DIE_IF_NULL is allowed for pointers, smart pointers, or classes marked with ABSL_NULLABILITY_COMPATIBLE we introduce a trait to help add the annotation only when compatible. This trait is kept internal for now out of caution for what we are supporting, though people have asked about it before (see b/394789178).
Simple cases are tested by `-Wnonnull` in absl/base/nullability_nc_test.cc. However, it's unclear how to test the complex cases like templates with universal references with the simple compiler `-Wnonnull`. There is a followup nullability inference test (cl/808830606).
Since there is Wnullability-completeness, needed to annotate the rest of die_if_null.h
PiperOrigin-RevId: 810463021
Change-Id: Id5156996bf3a29a99e689974ac2af7b94b21c460
Also, add a GoogleTest debug `PrintTo` routine for `LogEntry`, so that unexpected calls to `ScopedMockLog::Send` print metadata legibly.
PiperOrigin-RevId: 790735226
Change-Id: If21821812a9b7ecfaefef9ea5085f161f9331cf4
C++ language standard prior to C++17.
Users encountering this error should set -DCMAKE_CXX_STANDARD=17 (or a
higher standard), or find an equivalent method of specifying the correct
C++ standard for the entire build.
The current behavior is to try to detect the standard being used and
upgrade it to C++17 if it defaults to or is set to a prior
version. However, CMake also generates options.h for installation, and
it does this without the automatic upgrade, which leads to an
inconsistency.
Another possible fix is to not do the automatic upgrade at all, but
then we fail the build at a later step, so better just to add an error
earlier in the process.
PiperOrigin-RevId: 772997895
Change-Id: I5ace8ecf5799cacf6010bbba4d880004e0bc9650
When a container or a string is mixed, size is only supplementary data.
We are still mixing size to avoid hash expansion to be a suffix of one another.
Mixing is done by addition `size + Seed()`. `+ Seed()` is needed to make an empty string to change the hash state. We assume that `Seed()` is already loaded to some register. Addition would modify low bits that will be spread with data mixing later.
We considered the following optimization. Mix the size at the beginning in order to improve the dependency graph. Mixing would happen in parallel with reading strings data. It's not feasible because absl::Hash API requires that hash expansions can't be suffixes of each other.
```
name old CYCLES/op new CYCLES/op delta
BM_latency_AbslHash_String3 27.2 ± 0% 21.5 ± 0% -21.08% (p=0.000 n=52+52)
BM_latency_AbslHash_String5 28.1 ± 8% 22.3 ±11% -20.70% (p=0.000 n=57+57)
BM_latency_AbslHash_String9 27.7 ± 9% 22.2 ±17% -19.77% (p=0.000 n=56+57)
BM_latency_AbslHash_String17 25.9 ± 5% 21.2 ±23% -18.02% (p=0.000 n=57+54)
BM_latency_AbslHash_String33 28.0 ± 5% 22.5 ± 4% -19.69% (p=0.000 n=54+54)
BM_latency_AbslHash_String65 37.9 ± 8% 32.2 ±10% -15.19% (p=0.000 n=52+53)
BM_latency_AbslHash_String257 57.1 ± 8% 52.0 ±10% -8.88% (p=0.000 n=52+54)
```
PiperOrigin-RevId: 750151406
Change-Id: I2245bad4906960d9236bea671738a218a85eb1af
Relocates them and their implementations to a header that can still be transitively included through absl/base/nullability.h but where they are less visible.
Prefer to use the macro nullability annotations instead (absl_nonnull, absl_nullable, and absl_nullability_unknown).
These will be removed after the next Long Term Support release.
PiperOrigin-RevId: 748689234
Change-Id: I33038678725f555b35b2f08dd0081e3cc11040db
"Classical" growth is type erased and may become slower than before. Such growth is only used for usecases reserve/rehash non empty tables.
PiperOrigin-RevId: 744049527
Change-Id: I13e89b324f3bdcfdbb7a433c45fbfc17ade7f8de
absl::FastTypeId<Type>() evaluates at compile-time to a unique id for the
passed-in type. These are meant to be good match for keys into maps or
straight up comparisons.
Previously this was an internal implemention detail used by a few libraries.
This is now a supported utility function.
PiperOrigin-RevId: 743194478
Change-Id: Ie01ed8a2850696ee661acb91726252adb4c20538
prior to C++17. `absl::variant` is now an alias for `std::variant`.
It is recommended that clients simply use `std::variant`.
PiperOrigin-RevId: 730940936
Change-Id: I7157612a62eec036abf61dd1ad42c5945afeac1d
prior to C++17. `absl::optional` is now an alias for `std::optional`.
It is recommended that clients simply use `std::optional`.
PiperOrigin-RevId: 729860560
Change-Id: I8f3a23ed46c451cb441771cc544df79e6c326b67
Motivations:
1) raw_hash_set is becoming too big and hard to work with.
2) I have an experiment to use Group::Bitmask in policy traits and need this code to be available as a smaller library to avoid circular dependency.
Additionally added BitMask and NonIterableBitmask aliases inside of the group in order to be able to use these types as function arguments (needed for an ongoing experiment).
PiperOrigin-RevId: 729748373
Change-Id: Ie0aef40aa3d8dc7fe8ae27cc7808eacfa1a37319
to C++17. `absl::any` is now an alias for `std::any`. It is
recommended that clients simply use `std::any`.
PiperOrigin-RevId: 729541787
Change-Id: I4a677704bca31d4c602b73ac2dc12cac1fe18793
Abseil doesn't use `invoke.h` anymore. It's an internal header, which means nobody outside of Abseil should either.
PiperOrigin-RevId: 726159434
Change-Id: I3b17a313ce95fbe25fae5b091c9df73752548684
There are a few different cases where we check iterator categorization, mostly for forward iterators for preallocating buffers of the correct size. Factoring this out makes it easier to make all of these cases support the C++20 iterator model.
PiperOrigin-RevId: 725791190
Change-Id: Icf9d687654618c7ceff98ec76ec59e83c682dd6b
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1738
Since #1707 and #1710, `-Xarch_` option groups are present as single elements in the libraries' COPTS, and a `SHELL:` prefix is added to each of them. While these addressed certain build issues, they broke the handling of `-Xarch_` option groups in pkgconfig files.
Fix that by taking care of the `SHELL:` prefix in COPTS when generating pkgconfig files. The skip-next-flag mechanism is also removed as the option groups are now present as single elements.
Merge fd1246acbf into 08850701d2
Merging this change closes#1738
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1738 from ZhongRuoyu:pkgconfig-xarch-handling fd1246acbf
PiperOrigin-RevId: 660055129
Change-Id: I57a1a51b2eb8983d076a3d5336acef12acae4560
warnings in headers". It should fall through to the "don't impose our
warnings on others" case. Do this by matching on "-Wno-*" instead of
"-Wno*".
Fixes#1737
PiperOrigin-RevId: 659548798
Change-Id: I49d7ba7ddcd7be30f946fca90ba9be467181e854
This breaks Chromium due to global constructor and incorrectly
assumes page size.
https://github.com/abseil/abseil-cpp/pull/1697
PiperOrigin-RevId: 648377066
Change-Id: I19f8b2655971a0c314091e26e62e10a5a9c46e94
The motivation is to make destroyed/moved-from objects cause crashes when they are accessed.
PiperOrigin-RevId: 646229564
Change-Id: I68d9c189b542df0933af08f5ad63dc1f5764d856
On Windows flags will likely never be compatible due to the typeid issues.
PiperOrigin-RevId: 638326696
Change-Id: If605d612af2efa4d60483ca4a03daf58511eda51