Export of internal Abseil changes.
-- fcf9d3facb12451964ad1850073cbfb6f9739379 by CJ Johnson <johnsoncj@google.com>: Makes it obvious to readers that the comparison operators do not branch more than needed PiperOrigin-RevId: 240811527 -- 680c586f81f805be68e96caffb28d5f46b6a6511 by Jon Cohen <cohenjon@google.com>: Consistently use "if(" instead of "if (" in CMake files PiperOrigin-RevId: 240621819 -- c4acc506648622389f33f564fd94f8dda08cb61a by Tom Manshreck <shreck@google.com>: Internal change PiperOrigin-RevId: 240619556 -- ddbc1894944aae96767c876a1ae8696ddaba42a2 by Jon Cohen <cohenjon@google.com>: Remove the warning about install prefixes when we aren't installing abseil PiperOrigin-RevId: 240614750 -- 086c4fad213d99e875038bc8a1c7268e28a7ebf3 by Abseil Team <absl-team@google.com>: Adjust some tests and test cases which fail on WebAssembly PiperOrigin-RevId: 240592367 -- 46c2c09723a37ef4911ae3c64aab92e3f0fdba79 by Abseil Team <absl-team@google.com>: CMake install target update - Add prefix absl_ to each target when install rule are disabled. - Disable all install commands when absl is used as subdirectory (Fix #287) PiperOrigin-RevId: 240575083 -- 8d88063ed5b16f982a91950693d37ca18fdd46d8 by Jon Cohen <cohenjon@google.com>: Correctly link to Threads::Threads for a few cmake targets which were missing it. PiperOrigin-RevId: 240574513 GitOrigin-RevId: fcf9d3facb12451964ad1850073cbfb6f9739379 Change-Id: I031c57de8cd88554348eb8bd1371d01d15ff1fc7
This commit is contained in:
parent
5b65c4af51
commit
2c8421e1c6
14 changed files with 235 additions and 149 deletions
|
@ -847,7 +847,7 @@ class InlinedVector {
|
|||
|
||||
private:
|
||||
template <typename H, typename TheT, size_t TheN, typename TheA>
|
||||
friend auto AbslHashValue(H h, const InlinedVector<TheT, TheN, TheA>& v) -> H;
|
||||
friend H AbslHashValue(H h, const absl::InlinedVector<TheT, TheN, TheA>& a);
|
||||
|
||||
const Tag& tag() const { return storage_.allocator_and_tag_.tag(); }
|
||||
|
||||
|
@ -1231,8 +1231,8 @@ class InlinedVector {
|
|||
// Swaps the contents of two inlined vectors. This convenience function
|
||||
// simply calls `InlinedVector::swap()`.
|
||||
template <typename T, size_t N, typename A>
|
||||
auto swap(InlinedVector<T, N, A>& a,
|
||||
InlinedVector<T, N, A>& b) noexcept(noexcept(a.swap(b))) -> void {
|
||||
void swap(absl::InlinedVector<T, N, A>& a,
|
||||
absl::InlinedVector<T, N, A>& b) noexcept(noexcept(a.swap(b))) {
|
||||
a.swap(b);
|
||||
}
|
||||
|
||||
|
@ -1240,17 +1240,21 @@ auto swap(InlinedVector<T, N, A>& a,
|
|||
//
|
||||
// Tests the equivalency of the contents of two inlined vectors.
|
||||
template <typename T, size_t N, typename A>
|
||||
auto operator==(const InlinedVector<T, N, A>& a,
|
||||
const InlinedVector<T, N, A>& b) -> bool {
|
||||
return absl::equal(a.begin(), a.end(), b.begin(), b.end());
|
||||
bool operator==(const absl::InlinedVector<T, N, A>& a,
|
||||
const absl::InlinedVector<T, N, A>& b) {
|
||||
auto a_data = a.data();
|
||||
auto a_size = a.size();
|
||||
auto b_data = b.data();
|
||||
auto b_size = b.size();
|
||||
return absl::equal(a_data, a_data + a_size, b_data, b_data + b_size);
|
||||
}
|
||||
|
||||
// `operator!=()`
|
||||
//
|
||||
// Tests the inequality of the contents of two inlined vectors.
|
||||
template <typename T, size_t N, typename A>
|
||||
auto operator!=(const InlinedVector<T, N, A>& a,
|
||||
const InlinedVector<T, N, A>& b) -> bool {
|
||||
bool operator!=(const absl::InlinedVector<T, N, A>& a,
|
||||
const absl::InlinedVector<T, N, A>& b) {
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
|
@ -1259,9 +1263,14 @@ auto operator!=(const InlinedVector<T, N, A>& a,
|
|||
// Tests whether the contents of one inlined vector are less than the contents
|
||||
// of another through a lexicographical comparison operation.
|
||||
template <typename T, size_t N, typename A>
|
||||
auto operator<(const InlinedVector<T, N, A>& a, const InlinedVector<T, N, A>& b)
|
||||
-> bool {
|
||||
return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end());
|
||||
bool operator<(const absl::InlinedVector<T, N, A>& a,
|
||||
const absl::InlinedVector<T, N, A>& b) {
|
||||
auto a_data = a.data();
|
||||
auto a_size = a.size();
|
||||
auto b_data = b.data();
|
||||
auto b_size = b.size();
|
||||
return std::lexicographical_compare(a_data, a_data + a_size, b_data,
|
||||
b_data + b_size);
|
||||
}
|
||||
|
||||
// `operator>()`
|
||||
|
@ -1269,8 +1278,8 @@ auto operator<(const InlinedVector<T, N, A>& a, const InlinedVector<T, N, A>& b)
|
|||
// Tests whether the contents of one inlined vector are greater than the
|
||||
// contents of another through a lexicographical comparison operation.
|
||||
template <typename T, size_t N, typename A>
|
||||
auto operator>(const InlinedVector<T, N, A>& a, const InlinedVector<T, N, A>& b)
|
||||
-> bool {
|
||||
bool operator>(const absl::InlinedVector<T, N, A>& a,
|
||||
const absl::InlinedVector<T, N, A>& b) {
|
||||
return b < a;
|
||||
}
|
||||
|
||||
|
@ -1279,8 +1288,8 @@ auto operator>(const InlinedVector<T, N, A>& a, const InlinedVector<T, N, A>& b)
|
|||
// Tests whether the contents of one inlined vector are less than or equal to
|
||||
// the contents of another through a lexicographical comparison operation.
|
||||
template <typename T, size_t N, typename A>
|
||||
auto operator<=(const InlinedVector<T, N, A>& a,
|
||||
const InlinedVector<T, N, A>& b) -> bool {
|
||||
bool operator<=(const absl::InlinedVector<T, N, A>& a,
|
||||
const absl::InlinedVector<T, N, A>& b) {
|
||||
return !(b < a);
|
||||
}
|
||||
|
||||
|
@ -1289,8 +1298,8 @@ auto operator<=(const InlinedVector<T, N, A>& a,
|
|||
// Tests whether the contents of one inlined vector are greater than or equal to
|
||||
// the contents of another through a lexicographical comparison operation.
|
||||
template <typename T, size_t N, typename A>
|
||||
auto operator>=(const InlinedVector<T, N, A>& a,
|
||||
const InlinedVector<T, N, A>& b) -> bool {
|
||||
bool operator>=(const absl::InlinedVector<T, N, A>& a,
|
||||
const absl::InlinedVector<T, N, A>& b) {
|
||||
return !(a < b);
|
||||
}
|
||||
|
||||
|
@ -1299,11 +1308,13 @@ auto operator>=(const InlinedVector<T, N, A>& a,
|
|||
// Provides `absl::Hash` support for inlined vectors. You do not normally call
|
||||
// this function directly.
|
||||
template <typename H, typename TheT, size_t TheN, typename TheA>
|
||||
auto AbslHashValue(H h, const InlinedVector<TheT, TheN, TheA>& v) -> H {
|
||||
auto p = v.data();
|
||||
auto n = v.size();
|
||||
return H::combine(H::combine_contiguous(std::move(h), p, n), n);
|
||||
H AbslHashValue(H h, const absl::InlinedVector<TheT, TheN, TheA>& a) {
|
||||
auto a_data = a.data();
|
||||
auto a_size = a.size();
|
||||
return H::combine(H::combine_contiguous(std::move(h), a_data, a_size),
|
||||
a_size);
|
||||
}
|
||||
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_CONTAINER_INLINED_VECTOR_H_
|
||||
|
|
|
@ -414,10 +414,10 @@ TEST(Table, Prefetch) {
|
|||
t.prefetch(2);
|
||||
|
||||
// Do not run in debug mode, when prefetch is not implemented, or when
|
||||
// sanitizers are enabled.
|
||||
// sanitizers are enabled, or on WebAssembly.
|
||||
#if defined(NDEBUG) && defined(__GNUC__) && !defined(ADDRESS_SANITIZER) && \
|
||||
!defined(MEMORY_SANITIZER) && !defined(THREAD_SANITIZER) && \
|
||||
!defined(UNDEFINED_BEHAVIOR_SANITIZER)
|
||||
!defined(UNDEFINED_BEHAVIOR_SANITIZER) && !defined(__EMSCRIPTEN__)
|
||||
const auto now = [] { return absl::base_internal::CycleClock::Now(); };
|
||||
|
||||
// Make size enough to not fit in L2 cache (16.7 Mb)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue