Export of internal Abseil changes.
-- fa894a667a3bebbe479539c8d5e829beebf36c27 by Abseil Team <absl-team@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 216855907 -- 59e0a42fa9045eb164573b82ce625248bd9999f3 by Jon Cohen <cohenjon@google.com>: Some edits to the documentation for absl::Hash as I was reading through it. Itemized changes: * implement -> implements for grammar * Fix an incomplete sentence * specify *any* type T as opposed to *a* type T ? this is just the language I tend to see for these sorts of concepts in math and makes it more clear that we?re talking about a set of all types T satisfying these constraints * add arguments to comine() and combine_contiguous() ? this was mostly because for hash_continuous there was a reference to `size` elements without any mention of what `size` was. PiperOrigin-RevId: 216766923 -- c2a744d0f70ec5a079c22502b7a7ca72805a29dc by Shaindel Schwartz <shaindel@google.com>: Remove unneeded include. PiperOrigin-RevId: 216703710 -- ad22fc4e3d236f7bd354b61e0fa37ea524a7cf5e by Shaindel Schwartz <shaindel@google.com>: Fix typos. PiperOrigin-RevId: 216699071 GitOrigin-RevId: fa894a667a3bebbe479539c8d5e829beebf36c27 Change-Id: I35c8d8be66043aad9f17bbb867e69acb770bd1b0
This commit is contained in:
		
							parent
							
								
									f340f773ed
								
							
						
					
					
						commit
						a00bdd176d
					
				
					 8 changed files with 20 additions and 11 deletions
				
			
		|  | @ -94,7 +94,7 @@ TEST(FlatHashMap, IteratesMsan) { | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Demonstration of the "Lazy Key" pattern.  This uses heterogenous insert to
 | // Demonstration of the "Lazy Key" pattern.  This uses heterogeneous insert to
 | ||||||
| // avoid creating expensive key elements when the item is already present in the
 | // avoid creating expensive key elements when the item is already present in the
 | ||||||
| // map.
 | // map.
 | ||||||
| struct LazyInt { | struct LazyInt { | ||||||
|  |  | ||||||
|  | @ -84,7 +84,7 @@ struct hash_policy_traits { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // Transfers the `old_slot` to `new_slot`. Any memory allocated by the
 |   // Transfers the `old_slot` to `new_slot`. Any memory allocated by the
 | ||||||
|   // allocator inside `old_slot` to `new_slot` can be transfered.
 |   // allocator inside `old_slot` to `new_slot` can be transferred.
 | ||||||
|   //
 |   //
 | ||||||
|   // OPTIONAL: defaults to:
 |   // OPTIONAL: defaults to:
 | ||||||
|   //
 |   //
 | ||||||
|  |  | ||||||
|  | @ -662,7 +662,7 @@ class raw_hash_set { | ||||||
|       allocator_type>::template rebind_traits<value_type>::const_pointer; |       allocator_type>::template rebind_traits<value_type>::const_pointer; | ||||||
| 
 | 
 | ||||||
|   // Alias used for heterogeneous lookup functions.
 |   // Alias used for heterogeneous lookup functions.
 | ||||||
|   // `key_arg<K>` evaluates to `K` when the functors are tranparent and to
 |   // `key_arg<K>` evaluates to `K` when the functors are transparent and to
 | ||||||
|   // `key_type` otherwise. It permits template argument deduction on `K` for the
 |   // `key_type` otherwise. It permits template argument deduction on `K` for the
 | ||||||
|   // transparent case.
 |   // transparent case.
 | ||||||
|   template <class K> |   template <class K> | ||||||
|  |  | ||||||
|  | @ -687,7 +687,7 @@ TEST(Table, RehashWithNoResize) { | ||||||
|   Modulo1000HashTable t; |   Modulo1000HashTable t; | ||||||
|   // Adding the same length (and the same hash) strings
 |   // Adding the same length (and the same hash) strings
 | ||||||
|   // to have at least kMinFullGroups groups
 |   // to have at least kMinFullGroups groups
 | ||||||
|   // with Group::kWidth collisions. Then feel upto MaxDensitySize;
 |   // with Group::kWidth collisions. Then fill up to MaxDensitySize;
 | ||||||
|   const size_t kMinFullGroups = 7; |   const size_t kMinFullGroups = 7; | ||||||
|   std::vector<int> keys; |   std::vector<int> keys; | ||||||
|   for (size_t i = 0; i < MaxDensitySize(Group::kWidth * kMinFullGroups); ++i) { |   for (size_t i = 0; i < MaxDensitySize(Group::kWidth * kMinFullGroups); ++i) { | ||||||
|  |  | ||||||
|  | @ -25,8 +25,8 @@ | ||||||
| //   * `AbslHashValue`, an extension point that allows you to extend types to
 | //   * `AbslHashValue`, an extension point that allows you to extend types to
 | ||||||
| //     support Abseil hashing without requiring you to define a hashing
 | //     support Abseil hashing without requiring you to define a hashing
 | ||||||
| //     algorithm.
 | //     algorithm.
 | ||||||
| //   * `HashState`, a type-erased class which implement the manipulation of the
 | //   * `HashState`, a type-erased class which implements the manipulation of the
 | ||||||
| //     hash state (H) itself. containing member functions `combine()` and
 | //     hash state (H) itself, contains member functions `combine()` and
 | ||||||
| //     `combine_contiguous()`, which you can use to contribute to an existing
 | //     `combine_contiguous()`, which you can use to contribute to an existing
 | ||||||
| //     hash state when hashing your types.
 | //     hash state when hashing your types.
 | ||||||
| //
 | //
 | ||||||
|  | @ -69,7 +69,7 @@ namespace absl { | ||||||
| // `absl::Hash`
 | // `absl::Hash`
 | ||||||
| // -----------------------------------------------------------------------------
 | // -----------------------------------------------------------------------------
 | ||||||
| //
 | //
 | ||||||
| // `absl::Hash<T>` is a convenient general-purpose hash functor for a type `T`
 | // `absl::Hash<T>` is a convenient general-purpose hash functor for any type `T`
 | ||||||
| // satisfying any of the following conditions (in order):
 | // satisfying any of the following conditions (in order):
 | ||||||
| //
 | //
 | ||||||
| //  * T is an arithmetic or pointer type
 | //  * T is an arithmetic or pointer type
 | ||||||
|  | @ -142,7 +142,7 @@ namespace absl { | ||||||
| //
 | //
 | ||||||
| // The "hash state" concept contains two member functions for mixing hash state:
 | // The "hash state" concept contains two member functions for mixing hash state:
 | ||||||
| //
 | //
 | ||||||
| // * `H::combine()`
 | // * `H::combine(state, values...)`
 | ||||||
| //
 | //
 | ||||||
| //   Combines an arbitrary number of values into a hash state, returning the
 | //   Combines an arbitrary number of values into a hash state, returning the
 | ||||||
| //   updated state. Note that the existing hash state is move-only and must be
 | //   updated state. Note that the existing hash state is move-only and must be
 | ||||||
|  | @ -160,7 +160,7 @@ namespace absl { | ||||||
| //     state = H::combine(std::move(state), value2);
 | //     state = H::combine(std::move(state), value2);
 | ||||||
| //     state = H::combine(std::move(state), value3);
 | //     state = H::combine(std::move(state), value3);
 | ||||||
| //
 | //
 | ||||||
| // * `H::combine_contiguous()`
 | // * `H::combine_contiguous(state, data, size)`
 | ||||||
| //
 | //
 | ||||||
| //    Combines a contiguous array of `size` elements into a hash state,
 | //    Combines a contiguous array of `size` elements into a hash state,
 | ||||||
| //    returning the updated state. Note that the existing hash state is
 | //    returning the updated state. Note that the existing hash state is
 | ||||||
|  |  | ||||||
|  | @ -73,7 +73,6 @@ | ||||||
| 
 | 
 | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| #include "absl/base/port.h"  // Needed for string vs std::string |  | ||||||
| #include "absl/strings/string_view.h" | #include "absl/strings/string_view.h" | ||||||
| #include "absl/time/internal/cctz/include/cctz/civil_time.h" | #include "absl/time/internal/cctz/include/cctz/civil_time.h" | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -111,7 +111,7 @@ time_zone::absolute_lookup TimeZoneLibC::BreakTime( | ||||||
|     al.offset = 0; |     al.offset = 0; | ||||||
|     al.abbr = "UTC"; |     al.abbr = "UTC"; | ||||||
|   } |   } | ||||||
|   al.cs = civil_second(tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, |   al.cs = civil_second(tm.tm_year + year_t{1900}, tm.tm_mon + 1, tm.tm_mday, | ||||||
|                        tm.tm_hour, tm.tm_min, tm.tm_sec); |                        tm.tm_hour, tm.tm_min, tm.tm_sec); | ||||||
|   al.is_dst = tm.tm_isdst > 0; |   al.is_dst = tm.tm_isdst > 0; | ||||||
|   return al; |   return al; | ||||||
|  |  | ||||||
|  | @ -990,6 +990,16 @@ TEST(MakeTime, SysSecondsLimits) { | ||||||
|   EXPECT_EQ(time_point<absl::time_internal::cctz::seconds>::min(), tp); |   EXPECT_EQ(time_point<absl::time_internal::cctz::seconds>::min(), tp); | ||||||
|   tp = convert(civil_second::min(), west); |   tp = convert(civil_second::min(), west); | ||||||
|   EXPECT_EQ(time_point<absl::time_internal::cctz::seconds>::min(), tp); |   EXPECT_EQ(time_point<absl::time_internal::cctz::seconds>::min(), tp); | ||||||
|  | 
 | ||||||
|  |   // Checks that "tm_year + 1900", as used by the "libc" implementation,
 | ||||||
|  |   // can produce year values beyond the range on an int without overflow.
 | ||||||
|  | #if defined(_WIN32) || defined(_WIN64) | ||||||
|  |   // localtime_s() and gmtime_s() don't believe in years past 3000.
 | ||||||
|  | #else | ||||||
|  |   const time_zone libc_utc = LoadZone("libc:UTC"); | ||||||
|  |   tp = convert(civil_year(year_t{2147483648}), libc_utc); | ||||||
|  |   EXPECT_EQ("2147483648-01-01T00:00:00+00:00", format(RFC3339, tp, libc_utc)); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| TEST(NextTransition, UTC) { | TEST(NextTransition, UTC) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue