From 2c8421e1c6cef0da9e8a20b01c15256ec9ec116d Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 28 Mar 2019 11:12:19 -0700 Subject: Export of internal Abseil changes. -- fcf9d3facb12451964ad1850073cbfb6f9739379 by CJ Johnson : Makes it obvious to readers that the comparison operators do not branch more than needed PiperOrigin-RevId: 240811527 -- 680c586f81f805be68e96caffb28d5f46b6a6511 by Jon Cohen : Consistently use "if(" instead of "if (" in CMake files PiperOrigin-RevId: 240621819 -- c4acc506648622389f33f564fd94f8dda08cb61a by Tom Manshreck : Internal change PiperOrigin-RevId: 240619556 -- ddbc1894944aae96767c876a1ae8696ddaba42a2 by Jon Cohen : Remove the warning about install prefixes when we aren't installing abseil PiperOrigin-RevId: 240614750 -- 086c4fad213d99e875038bc8a1c7268e28a7ebf3 by Abseil Team : Adjust some tests and test cases which fail on WebAssembly PiperOrigin-RevId: 240592367 -- 46c2c09723a37ef4911ae3c64aab92e3f0fdba79 by Abseil Team : 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 : Correctly link to Threads::Threads for a few cmake targets which were missing it. PiperOrigin-RevId: 240574513 GitOrigin-RevId: fcf9d3facb12451964ad1850073cbfb6f9739379 Change-Id: I031c57de8cd88554348eb8bd1371d01d15ff1fc7 --- absl/container/inlined_vector.h | 53 +++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 21 deletions(-) (limited to 'absl/container/inlined_vector.h') diff --git a/absl/container/inlined_vector.h b/absl/container/inlined_vector.h index bd4ed66..0f06686 100644 --- a/absl/container/inlined_vector.h +++ b/absl/container/inlined_vector.h @@ -847,7 +847,7 @@ class InlinedVector { private: template - friend auto AbslHashValue(H h, const InlinedVector& v) -> H; + friend H AbslHashValue(H h, const absl::InlinedVector& 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 -auto swap(InlinedVector& a, - InlinedVector& b) noexcept(noexcept(a.swap(b))) -> void { +void swap(absl::InlinedVector& a, + absl::InlinedVector& b) noexcept(noexcept(a.swap(b))) { a.swap(b); } @@ -1240,17 +1240,21 @@ auto swap(InlinedVector& a, // // Tests the equivalency of the contents of two inlined vectors. template -auto operator==(const InlinedVector& a, - const InlinedVector& b) -> bool { - return absl::equal(a.begin(), a.end(), b.begin(), b.end()); +bool operator==(const absl::InlinedVector& a, + const absl::InlinedVector& 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 -auto operator!=(const InlinedVector& a, - const InlinedVector& b) -> bool { +bool operator!=(const absl::InlinedVector& a, + const absl::InlinedVector& b) { return !(a == b); } @@ -1259,9 +1263,14 @@ auto operator!=(const InlinedVector& a, // Tests whether the contents of one inlined vector are less than the contents // of another through a lexicographical comparison operation. template -auto operator<(const InlinedVector& a, const InlinedVector& b) - -> bool { - return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end()); +bool operator<(const absl::InlinedVector& a, + const absl::InlinedVector& 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& a, const InlinedVector& b) // Tests whether the contents of one inlined vector are greater than the // contents of another through a lexicographical comparison operation. template -auto operator>(const InlinedVector& a, const InlinedVector& b) - -> bool { +bool operator>(const absl::InlinedVector& a, + const absl::InlinedVector& b) { return b < a; } @@ -1279,8 +1288,8 @@ auto operator>(const InlinedVector& a, const InlinedVector& 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 -auto operator<=(const InlinedVector& a, - const InlinedVector& b) -> bool { +bool operator<=(const absl::InlinedVector& a, + const absl::InlinedVector& b) { return !(b < a); } @@ -1289,8 +1298,8 @@ auto operator<=(const InlinedVector& 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 -auto operator>=(const InlinedVector& a, - const InlinedVector& b) -> bool { +bool operator>=(const absl::InlinedVector& a, + const absl::InlinedVector& b) { return !(a < b); } @@ -1299,11 +1308,13 @@ auto operator>=(const InlinedVector& a, // Provides `absl::Hash` support for inlined vectors. You do not normally call // this function directly. template -auto AbslHashValue(H h, const InlinedVector& 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& 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_ -- cgit v1.2.3