re2 1.23.0 → 1.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/README.md +2 -0
  2. package/binding.gyp +3 -2
  3. package/package.json +5 -5
  4. package/vendor/abseil-cpp/CMake/AbseilDll.cmake +25 -4
  5. package/vendor/abseil-cpp/CMake/AbseilHelpers.cmake +6 -1
  6. package/vendor/abseil-cpp/CMakeLists.txt +2 -2
  7. package/vendor/abseil-cpp/MODULE.bazel +2 -2
  8. package/vendor/abseil-cpp/absl/algorithm/BUILD.bazel +0 -1
  9. package/vendor/abseil-cpp/absl/algorithm/CMakeLists.txt +0 -2
  10. package/vendor/abseil-cpp/absl/algorithm/container.h +191 -140
  11. package/vendor/abseil-cpp/absl/algorithm/container_test.cc +818 -0
  12. package/vendor/abseil-cpp/absl/base/BUILD.bazel +44 -5
  13. package/vendor/abseil-cpp/absl/base/CMakeLists.txt +42 -3
  14. package/vendor/abseil-cpp/absl/base/attributes.h +5 -1
  15. package/vendor/abseil-cpp/absl/base/call_once_test.cc +10 -10
  16. package/vendor/abseil-cpp/absl/base/casts.cc +61 -0
  17. package/vendor/abseil-cpp/absl/base/casts.h +128 -2
  18. package/vendor/abseil-cpp/absl/base/casts_test.cc +151 -0
  19. package/vendor/abseil-cpp/absl/base/config.h +13 -37
  20. package/vendor/abseil-cpp/absl/base/internal/dynamic_annotations.h +1 -1
  21. package/vendor/abseil-cpp/absl/base/internal/iterator_traits.h +4 -0
  22. package/vendor/abseil-cpp/absl/base/internal/nullability_traits.h +71 -0
  23. package/vendor/abseil-cpp/absl/base/internal/nullability_traits_test.cc +98 -0
  24. package/vendor/abseil-cpp/absl/base/internal/raw_logging.cc +3 -4
  25. package/vendor/abseil-cpp/absl/base/internal/spinlock.cc +13 -7
  26. package/vendor/abseil-cpp/absl/base/internal/spinlock.h +16 -11
  27. package/vendor/abseil-cpp/absl/base/internal/strerror_test.cc +2 -1
  28. package/vendor/abseil-cpp/absl/base/internal/sysinfo.cc +0 -9
  29. package/vendor/abseil-cpp/absl/base/internal/sysinfo_test.cc +0 -6
  30. package/vendor/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +1 -1
  31. package/vendor/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h +1 -1
  32. package/vendor/abseil-cpp/absl/base/macros.h +40 -17
  33. package/vendor/abseil-cpp/absl/base/nullability.h +1 -1
  34. package/vendor/abseil-cpp/absl/base/optimization.h +1 -3
  35. package/vendor/abseil-cpp/absl/base/options.h +1 -27
  36. package/vendor/abseil-cpp/absl/base/spinlock_test_common.cc +5 -8
  37. package/vendor/abseil-cpp/absl/cleanup/cleanup.h +4 -0
  38. package/vendor/abseil-cpp/absl/container/BUILD.bazel +195 -2
  39. package/vendor/abseil-cpp/absl/container/CMakeLists.txt +136 -2
  40. package/vendor/abseil-cpp/absl/container/btree_map.h +56 -6
  41. package/vendor/abseil-cpp/absl/container/btree_set.h +52 -6
  42. package/vendor/abseil-cpp/absl/container/btree_test.cc +107 -1
  43. package/vendor/abseil-cpp/absl/container/chunked_queue.h +755 -0
  44. package/vendor/abseil-cpp/absl/container/chunked_queue_benchmark.cc +386 -0
  45. package/vendor/abseil-cpp/absl/container/chunked_queue_test.cc +768 -0
  46. package/vendor/abseil-cpp/absl/container/fixed_array.h +4 -6
  47. package/vendor/abseil-cpp/absl/container/flat_hash_map.h +16 -6
  48. package/vendor/abseil-cpp/absl/container/flat_hash_map_test.cc +1 -2
  49. package/vendor/abseil-cpp/absl/container/flat_hash_set.h +16 -6
  50. package/vendor/abseil-cpp/absl/container/flat_hash_set_test.cc +0 -2
  51. package/vendor/abseil-cpp/absl/container/inlined_vector.h +12 -4
  52. package/vendor/abseil-cpp/absl/container/inlined_vector_test.cc +21 -0
  53. package/vendor/abseil-cpp/absl/container/internal/btree_container.h +14 -5
  54. package/vendor/abseil-cpp/absl/container/internal/chunked_queue.h +173 -0
  55. package/vendor/abseil-cpp/absl/container/internal/common.h +51 -0
  56. package/vendor/abseil-cpp/absl/container/internal/container_memory.h +7 -1
  57. package/vendor/abseil-cpp/absl/container/internal/container_memory_test.cc +11 -0
  58. package/vendor/abseil-cpp/absl/container/internal/hash_generator_testing.cc +0 -2
  59. package/vendor/abseil-cpp/absl/container/internal/hash_generator_testing.h +1 -2
  60. package/vendor/abseil-cpp/absl/container/internal/hash_policy_testing.h +0 -14
  61. package/vendor/abseil-cpp/absl/container/internal/hashtable_control_bytes.h +11 -8
  62. package/vendor/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +3 -4
  63. package/vendor/abseil-cpp/absl/container/internal/hashtablez_sampler.h +23 -6
  64. package/vendor/abseil-cpp/absl/container/internal/hashtablez_sampler_test.cc +31 -15
  65. package/vendor/abseil-cpp/absl/container/internal/heterogeneous_lookup_testing.h +80 -0
  66. package/vendor/abseil-cpp/absl/container/internal/inlined_vector.h +4 -12
  67. package/vendor/abseil-cpp/absl/container/internal/raw_hash_map.h +35 -10
  68. package/vendor/abseil-cpp/absl/container/internal/raw_hash_set.cc +149 -23
  69. package/vendor/abseil-cpp/absl/container/internal/raw_hash_set.h +120 -126
  70. package/vendor/abseil-cpp/absl/container/internal/raw_hash_set_allocator_test.cc +4 -0
  71. package/vendor/abseil-cpp/absl/container/internal/raw_hash_set_benchmark.cc +8 -0
  72. package/vendor/abseil-cpp/absl/container/internal/raw_hash_set_probe_benchmark.cc +14 -59
  73. package/vendor/abseil-cpp/absl/container/internal/raw_hash_set_test.cc +111 -22
  74. package/vendor/abseil-cpp/absl/container/internal/unordered_map_constructor_test.h +53 -112
  75. package/vendor/abseil-cpp/absl/container/internal/unordered_map_lookup_test.h +10 -15
  76. package/vendor/abseil-cpp/absl/container/internal/unordered_map_members_test.h +3 -3
  77. package/vendor/abseil-cpp/absl/container/internal/unordered_map_modifiers_test.h +45 -61
  78. package/vendor/abseil-cpp/absl/container/internal/unordered_set_constructor_test.h +53 -112
  79. package/vendor/abseil-cpp/absl/container/internal/unordered_set_lookup_test.h +6 -9
  80. package/vendor/abseil-cpp/absl/container/internal/unordered_set_members_test.h +3 -3
  81. package/vendor/abseil-cpp/absl/container/internal/unordered_set_modifiers_test.h +25 -31
  82. package/vendor/abseil-cpp/absl/container/linked_hash_map.h +666 -0
  83. package/vendor/abseil-cpp/absl/container/linked_hash_map_benchmark.cc +140 -0
  84. package/vendor/abseil-cpp/absl/container/linked_hash_map_test.cc +987 -0
  85. package/vendor/abseil-cpp/absl/container/linked_hash_set.h +527 -0
  86. package/vendor/abseil-cpp/absl/container/linked_hash_set_benchmark.cc +84 -0
  87. package/vendor/abseil-cpp/absl/container/linked_hash_set_test.cc +947 -0
  88. package/vendor/abseil-cpp/absl/container/node_hash_map.h +17 -6
  89. package/vendor/abseil-cpp/absl/container/node_hash_set.h +16 -5
  90. package/vendor/abseil-cpp/absl/container/node_hash_set_test.cc +1 -2
  91. package/vendor/abseil-cpp/absl/copts/GENERATED_AbseilCopts.cmake +79 -0
  92. package/vendor/abseil-cpp/absl/copts/GENERATED_copts.bzl +79 -0
  93. package/vendor/abseil-cpp/absl/copts/copts.py +17 -4
  94. package/vendor/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +67 -13
  95. package/vendor/abseil-cpp/absl/crc/internal/non_temporal_arm_intrinsics.h +4 -2
  96. package/vendor/abseil-cpp/absl/debugging/BUILD.bazel +31 -0
  97. package/vendor/abseil-cpp/absl/debugging/CMakeLists.txt +34 -0
  98. package/vendor/abseil-cpp/absl/debugging/failure_signal_handler.cc +2 -2
  99. package/vendor/abseil-cpp/absl/debugging/internal/borrowed_fixup_buffer.cc +118 -0
  100. package/vendor/abseil-cpp/absl/debugging/internal/borrowed_fixup_buffer.h +71 -0
  101. package/vendor/abseil-cpp/absl/debugging/internal/borrowed_fixup_buffer_test.cc +97 -0
  102. package/vendor/abseil-cpp/absl/debugging/internal/demangle.cc +2 -2
  103. package/vendor/abseil-cpp/absl/debugging/internal/elf_mem_image.h +4 -4
  104. package/vendor/abseil-cpp/absl/debugging/internal/examine_stack.cc +4 -0
  105. package/vendor/abseil-cpp/absl/debugging/internal/examine_stack.h +7 -0
  106. package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +1 -1
  107. package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_emscripten-inl.inc +0 -7
  108. package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +3 -2
  109. package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +2 -1
  110. package/vendor/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +8 -3
  111. package/vendor/abseil-cpp/absl/debugging/internal/symbolize.h +2 -2
  112. package/vendor/abseil-cpp/absl/debugging/stacktrace.cc +35 -67
  113. package/vendor/abseil-cpp/absl/debugging/stacktrace.h +3 -0
  114. package/vendor/abseil-cpp/absl/debugging/stacktrace_benchmark.cc +24 -1
  115. package/vendor/abseil-cpp/absl/debugging/stacktrace_test.cc +39 -15
  116. package/vendor/abseil-cpp/absl/debugging/symbolize_emscripten.inc +4 -17
  117. package/vendor/abseil-cpp/absl/debugging/symbolize_test.cc +25 -40
  118. package/vendor/abseil-cpp/absl/debugging/symbolize_win32.inc +2 -4
  119. package/vendor/abseil-cpp/absl/flags/BUILD.bazel +1 -0
  120. package/vendor/abseil-cpp/absl/flags/declare.h +9 -0
  121. package/vendor/abseil-cpp/absl/flags/flag.h +2 -1
  122. package/vendor/abseil-cpp/absl/flags/internal/commandlineflag.h +1 -1
  123. package/vendor/abseil-cpp/absl/flags/internal/flag.cc +3 -2
  124. package/vendor/abseil-cpp/absl/flags/marshalling.cc +1 -16
  125. package/vendor/abseil-cpp/absl/flags/parse.cc +4 -2
  126. package/vendor/abseil-cpp/absl/flags/parse_test.cc +1 -1
  127. package/vendor/abseil-cpp/absl/flags/reflection.cc +4 -3
  128. package/vendor/abseil-cpp/absl/functional/BUILD.bazel +4 -0
  129. package/vendor/abseil-cpp/absl/functional/CMakeLists.txt +4 -0
  130. package/vendor/abseil-cpp/absl/functional/any_invocable.h +3 -1
  131. package/vendor/abseil-cpp/absl/functional/function_ref.h +125 -20
  132. package/vendor/abseil-cpp/absl/functional/function_ref_test.cc +122 -9
  133. package/vendor/abseil-cpp/absl/functional/internal/any_invocable.h +13 -2
  134. package/vendor/abseil-cpp/absl/functional/internal/function_ref.h +42 -4
  135. package/vendor/abseil-cpp/absl/hash/hash_benchmark.cc +11 -0
  136. package/vendor/abseil-cpp/absl/hash/hash_test.cc +5 -2
  137. package/vendor/abseil-cpp/absl/hash/internal/hash.cc +184 -53
  138. package/vendor/abseil-cpp/absl/hash/internal/hash.h +116 -10
  139. package/vendor/abseil-cpp/absl/hash/internal/low_level_hash_test.cc +43 -4
  140. package/vendor/abseil-cpp/absl/log/BUILD.bazel +2 -0
  141. package/vendor/abseil-cpp/absl/log/CMakeLists.txt +35 -1
  142. package/vendor/abseil-cpp/absl/log/check_test_impl.inc +59 -4
  143. package/vendor/abseil-cpp/absl/log/die_if_null.cc +3 -1
  144. package/vendor/abseil-cpp/absl/log/die_if_null.h +24 -3
  145. package/vendor/abseil-cpp/absl/log/internal/BUILD.bazel +31 -1
  146. package/vendor/abseil-cpp/absl/log/internal/check_impl.h +2 -1
  147. package/vendor/abseil-cpp/absl/log/internal/check_op.cc +3 -1
  148. package/vendor/abseil-cpp/absl/log/internal/check_op.h +44 -18
  149. package/vendor/abseil-cpp/absl/log/internal/conditions.h +38 -35
  150. package/vendor/abseil-cpp/absl/log/internal/container.h +312 -0
  151. package/vendor/abseil-cpp/absl/log/internal/container_test.cc +254 -0
  152. package/vendor/abseil-cpp/absl/log/internal/log_impl.h +108 -110
  153. package/vendor/abseil-cpp/absl/log/internal/log_message.cc +5 -2
  154. package/vendor/abseil-cpp/absl/log/internal/log_message.h +5 -1
  155. package/vendor/abseil-cpp/absl/log/internal/strip.h +30 -31
  156. package/vendor/abseil-cpp/absl/log/internal/vlog_config.cc +19 -19
  157. package/vendor/abseil-cpp/absl/log/internal/vlog_config.h +0 -1
  158. package/vendor/abseil-cpp/absl/log/log.h +2 -2
  159. package/vendor/abseil-cpp/absl/meta/BUILD.bazel +51 -0
  160. package/vendor/abseil-cpp/absl/meta/CMakeLists.txt +46 -0
  161. package/vendor/abseil-cpp/absl/meta/internal/constexpr_testing.h +73 -0
  162. package/vendor/abseil-cpp/absl/meta/internal/constexpr_testing_test.cc +40 -0
  163. package/vendor/abseil-cpp/absl/meta/internal/requires.h +67 -0
  164. package/vendor/abseil-cpp/absl/meta/internal/requires_test.cc +66 -0
  165. package/vendor/abseil-cpp/absl/meta/type_traits.h +42 -1
  166. package/vendor/abseil-cpp/absl/meta/type_traits_test.cc +14 -0
  167. package/vendor/abseil-cpp/absl/numeric/int128.h +41 -21
  168. package/vendor/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +16 -22
  169. package/vendor/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +5 -7
  170. package/vendor/abseil-cpp/absl/numeric/int128_test.cc +52 -5
  171. package/vendor/abseil-cpp/absl/profiling/BUILD.bazel +1 -0
  172. package/vendor/abseil-cpp/absl/profiling/CMakeLists.txt +1 -0
  173. package/vendor/abseil-cpp/absl/profiling/hashtable.cc +18 -7
  174. package/vendor/abseil-cpp/absl/profiling/internal/profile_builder.cc +1 -0
  175. package/vendor/abseil-cpp/absl/random/internal/fastmath_test.cc +3 -5
  176. package/vendor/abseil-cpp/absl/random/internal/platform.h +0 -13
  177. package/vendor/abseil-cpp/absl/random/internal/randen_engine_test.cc +0 -1
  178. package/vendor/abseil-cpp/absl/random/internal/seed_material.cc +1 -27
  179. package/vendor/abseil-cpp/absl/status/BUILD.bazel +17 -0
  180. package/vendor/abseil-cpp/absl/status/CMakeLists.txt +16 -0
  181. package/vendor/abseil-cpp/absl/status/internal/status_internal.h +4 -2
  182. package/vendor/abseil-cpp/absl/status/internal/status_matchers.h +2 -2
  183. package/vendor/abseil-cpp/absl/status/internal/statusor_internal.h +2 -1
  184. package/vendor/abseil-cpp/absl/status/status.cc +4 -0
  185. package/vendor/abseil-cpp/absl/status/status.h +5 -0
  186. package/vendor/abseil-cpp/absl/status/status_matchers.h +48 -0
  187. package/vendor/abseil-cpp/absl/status/status_matchers_test.cc +27 -0
  188. package/vendor/abseil-cpp/absl/status/status_test.cc +1 -0
  189. package/vendor/abseil-cpp/absl/status/statusor.h +1 -1
  190. package/vendor/abseil-cpp/absl/strings/BUILD.bazel +101 -21
  191. package/vendor/abseil-cpp/absl/strings/CMakeLists.txt +99 -5
  192. package/vendor/abseil-cpp/absl/strings/ascii.h +9 -4
  193. package/vendor/abseil-cpp/absl/strings/cord.cc +15 -10
  194. package/vendor/abseil-cpp/absl/strings/cord.h +1 -1
  195. package/vendor/abseil-cpp/absl/strings/escaping.cc +126 -94
  196. package/vendor/abseil-cpp/absl/strings/internal/append_and_overwrite.h +93 -0
  197. package/vendor/abseil-cpp/absl/strings/internal/append_and_overwrite_test.cc +95 -0
  198. package/vendor/abseil-cpp/absl/strings/internal/cord_internal.h +2 -0
  199. package/vendor/abseil-cpp/absl/strings/internal/cord_rep_btree_test.cc +8 -8
  200. package/vendor/abseil-cpp/absl/strings/internal/cordz_info.cc +24 -18
  201. package/vendor/abseil-cpp/absl/strings/internal/cordz_info.h +10 -16
  202. package/vendor/abseil-cpp/absl/strings/internal/escaping.h +9 -7
  203. package/vendor/abseil-cpp/absl/strings/internal/generic_printer.cc +107 -0
  204. package/vendor/abseil-cpp/absl/strings/internal/generic_printer.h +115 -0
  205. package/vendor/abseil-cpp/absl/strings/internal/generic_printer_internal.h +423 -0
  206. package/vendor/abseil-cpp/absl/strings/internal/generic_printer_test.cc +685 -0
  207. package/vendor/abseil-cpp/absl/strings/internal/resize_uninitialized.h +0 -12
  208. package/vendor/abseil-cpp/absl/strings/internal/str_format/checker.h +2 -4
  209. package/vendor/abseil-cpp/absl/strings/internal/str_format/convert_test.cc +21 -7
  210. package/vendor/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +495 -8
  211. package/vendor/abseil-cpp/absl/strings/internal/str_join_internal.h +18 -15
  212. package/vendor/abseil-cpp/absl/strings/numbers.cc +71 -8
  213. package/vendor/abseil-cpp/absl/strings/numbers.h +25 -12
  214. package/vendor/abseil-cpp/absl/strings/numbers_test.cc +70 -0
  215. package/vendor/abseil-cpp/absl/strings/resize_and_overwrite.h +194 -0
  216. package/vendor/abseil-cpp/absl/strings/resize_and_overwrite_test.cc +154 -0
  217. package/vendor/abseil-cpp/absl/strings/str_cat.cc +96 -91
  218. package/vendor/abseil-cpp/absl/strings/str_cat.h +17 -12
  219. package/vendor/abseil-cpp/absl/strings/str_format_test.cc +4 -4
  220. package/vendor/abseil-cpp/absl/strings/str_split.h +1 -1
  221. package/vendor/abseil-cpp/absl/strings/str_split_test.cc +1 -1
  222. package/vendor/abseil-cpp/absl/strings/string_view.h +8 -718
  223. package/vendor/abseil-cpp/absl/strings/string_view_test.cc +1 -1265
  224. package/vendor/abseil-cpp/absl/strings/substitute.cc +24 -24
  225. package/vendor/abseil-cpp/absl/synchronization/BUILD.bazel +2 -3
  226. package/vendor/abseil-cpp/absl/synchronization/CMakeLists.txt +1 -0
  227. package/vendor/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +2 -2
  228. package/vendor/abseil-cpp/absl/synchronization/internal/kernel_timeout_test.cc +15 -5
  229. package/vendor/abseil-cpp/absl/synchronization/mutex.cc +2 -1
  230. package/vendor/abseil-cpp/absl/synchronization/mutex.h +47 -23
  231. package/vendor/abseil-cpp/absl/synchronization/notification.h +1 -1
  232. package/vendor/abseil-cpp/absl/time/CMakeLists.txt +2 -0
  233. package/vendor/abseil-cpp/absl/time/civil_time_benchmark.cc +1 -2
  234. package/vendor/abseil-cpp/absl/time/civil_time_test.cc +58 -103
  235. package/vendor/abseil-cpp/absl/time/clock.cc +18 -16
  236. package/vendor/abseil-cpp/absl/time/clock_test.cc +2 -2
  237. package/vendor/abseil-cpp/absl/time/duration_benchmark.cc +144 -0
  238. package/vendor/abseil-cpp/absl/time/duration_test.cc +26 -29
  239. package/vendor/abseil-cpp/absl/time/internal/cctz/BUILD.bazel +7 -1
  240. package/vendor/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +4 -2
  241. package/vendor/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +6 -103
  242. package/vendor/abseil-cpp/absl/time/internal/cctz/src/time_zone_name_win.cc +186 -0
  243. package/vendor/abseil-cpp/absl/time/internal/cctz/src/time_zone_name_win.h +37 -0
  244. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/version +1 -1
  245. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/America/Ensenada +0 -0
  246. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/America/Santa_Isabel +0 -0
  247. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/America/Tijuana +0 -0
  248. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Mexico/BajaNorte +0 -0
  249. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/iso3166.tab +9 -9
  250. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/zone1970.tab +12 -12
  251. package/vendor/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/zonenow.tab +47 -47
  252. package/vendor/abseil-cpp/absl/time/time.cc +4 -4
  253. package/vendor/abseil-cpp/absl/time/time.h +10 -10
  254. package/vendor/abseil-cpp/absl/time/time_test.cc +1 -0
  255. package/vendor/abseil-cpp/absl/types/compare.h +62 -61
  256. package/vendor/abseil-cpp/absl/types/compare_test.cc +3 -3
  257. package/vendor/abseil-cpp/absl/types/internal/span.h +1 -0
  258. package/vendor/abseil-cpp/absl/types/optional.h +2 -2
  259. package/vendor/abseil-cpp/absl/types/span.h +10 -2
  260. package/vendor/abseil-cpp/absl/utility/utility.h +13 -0
  261. package/vendor/abseil-cpp/ci/absl_alternate_options.h +0 -1
  262. package/vendor/abseil-cpp/ci/cmake_common.sh +1 -1
  263. package/vendor/abseil-cpp/ci/cmake_install_test.sh +6 -0
  264. package/vendor/abseil-cpp/ci/linux_arm_clang-latest_libcxx_bazel.sh +1 -0
  265. package/vendor/abseil-cpp/ci/linux_clang-latest_libcxx_asan_bazel.sh +2 -0
  266. package/vendor/abseil-cpp/ci/linux_clang-latest_libcxx_bazel.sh +1 -0
  267. package/vendor/abseil-cpp/ci/linux_clang-latest_libcxx_tsan_bazel.sh +1 -0
  268. package/vendor/abseil-cpp/ci/linux_clang-latest_libstdcxx_bazel.sh +1 -0
  269. package/vendor/abseil-cpp/ci/linux_gcc-floor_libstdcxx_bazel.sh +1 -0
  270. package/vendor/abseil-cpp/ci/linux_gcc-latest_libstdcxx_bazel.sh +1 -0
  271. package/vendor/abseil-cpp/ci/linux_gcc-latest_libstdcxx_cmake.sh +6 -0
  272. package/vendor/abseil-cpp/ci/linux_gcc_alpine_cmake.sh +6 -0
  273. package/vendor/abseil-cpp/ci/macos_xcode_bazel.sh +3 -2
  274. package/vendor/abseil-cpp/ci/macos_xcode_cmake.sh +5 -0
  275. package/vendor/abseil-cpp/ci/windows_clangcl_bazel.bat +1 -0
  276. package/vendor/abseil-cpp/ci/windows_msvc_bazel.bat +1 -0
  277. package/vendor/abseil-cpp/ci/windows_msvc_cmake.bat +6 -1
  278. package/vendor/abseil-cpp/absl/base/internal/identity.h +0 -39
  279. package/vendor/abseil-cpp/absl/strings/string_view.cc +0 -257
  280. package/vendor/abseil-cpp/absl/strings/string_view_benchmark.cc +0 -380
@@ -0,0 +1,755 @@
1
+ // Copyright 2025 The Abseil Authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // https://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ //
15
+ // -----------------------------------------------------------------------------
16
+ // File: chunked_queue.h
17
+ // -----------------------------------------------------------------------------
18
+ //
19
+ // `std::deque` provides random access and fast push/pop back/front. It is
20
+ // implemented as an array of fixed blocks. It provides no control of block size
21
+ // and implementations differ; libstdc++ tries to allocate blocks of ~512 bytes
22
+ // and libc++ tries for blocks of ~4k bytes.
23
+ //
24
+ // `absl::chunked_queue` provides the same minus random access. It is
25
+ // implemented as a double-linked list of fixed or variable sized blocks.
26
+ //
27
+ // `absl::chunked_queue` is useful when memory usage is paramount as it provides
28
+ // finegrained and configurable block sizing.
29
+ //
30
+ // The interface supported by this class is limited to:
31
+ //
32
+ // empty()
33
+ // size()
34
+ // max_size()
35
+ // shrink_to_fit()
36
+ // resize()
37
+ // assign()
38
+ // push_back()
39
+ // emplace_back()
40
+ // pop_front()
41
+ // front()
42
+ // back()
43
+ // swap()
44
+ // clear()
45
+ // begin(), end()
46
+ // cbegin(), cend()
47
+ //
48
+ // === ADVANCED USAGE
49
+ //
50
+ // == clear()
51
+ //
52
+ // As an optimization clear() leaves the first block of the chunked_queue
53
+ // allocated (but empty). So clear will not delete all memory of the container.
54
+ // In order to do so, call shrink_to_fit() or swap the container with an empty
55
+ // one.
56
+ //
57
+ // absl::chunked_queue<int64> q = {1, 2, 3};
58
+ // q.clear();
59
+ // q.shrink_to_fit();
60
+ //
61
+ // == block size customization
62
+ //
63
+ // chunked_queue allows customization of the block size for each block. By
64
+ // default the block size is set to 1 element and the size doubles for the next
65
+ // block until it reaches the default max block size, which is 128 elements.
66
+ //
67
+ // = fixed size
68
+ //
69
+ // When only the first block size parameter is specified, it sets a fixed block
70
+ // size for all blocks:
71
+ //
72
+ // chunked_queue<T, 32>: 32 elements per block
73
+ //
74
+ // The smaller the block size, the less the memory usage for small queues at the
75
+ // cost of performance. Caveat: For large queues, a smaller block size will
76
+ // increase memory usage, and reduce performance.
77
+ //
78
+ // = variable size
79
+ //
80
+ // When both block size parameters are specified, they set the min and max block
81
+ // sizes for the blocks. Initially the queue starts with the min block size and
82
+ // as it grows, the size of each block grows until it reaches the max block
83
+ // size.
84
+ // New blocks are double the size of the tail block (so they at least
85
+ // double the size of the queue).
86
+ //
87
+ // chunked_queue<T, 4, 64>: first block 4 elements, second block 8 elements,
88
+ // third block 16 elements, fourth block 32 elements,
89
+ // all other blocks 64 elements
90
+ //
91
+ // One can specify a min and max such that small queues will not waste memory
92
+ // and large queues will not have too many blocks.
93
+
94
+ #ifndef ABSL_CONTAINER_CHUNKED_QUEUE_H_
95
+ #define ABSL_CONTAINER_CHUNKED_QUEUE_H_
96
+
97
+ #include <algorithm>
98
+ #include <cstddef>
99
+ #include <cstdint>
100
+ #include <initializer_list>
101
+ #include <iterator>
102
+ #include <memory>
103
+ #include <new>
104
+ #include <tuple>
105
+ #include <type_traits>
106
+ #include <utility>
107
+
108
+ #include "absl/base/attributes.h"
109
+ #include "absl/base/config.h"
110
+ #include "absl/base/internal/iterator_traits.h"
111
+ #include "absl/base/macros.h"
112
+ #include "absl/container/internal/chunked_queue.h"
113
+ #include "absl/container/internal/layout.h"
114
+
115
+ namespace absl {
116
+ ABSL_NAMESPACE_BEGIN
117
+
118
+ template <typename T, size_t BLo = 0, size_t BHi = BLo,
119
+ typename Allocator = std::allocator<T>>
120
+ class chunked_queue {
121
+ public:
122
+ static constexpr size_t kBlockSizeMin = (BLo == 0 && BHi == 0) ? 1 : BLo;
123
+ static constexpr size_t kBlockSizeMax = (BLo == 0 && BHi == 0) ? 128 : BHi;
124
+
125
+ private:
126
+ static_assert(kBlockSizeMin > 0, "Min block size cannot be zero");
127
+ static_assert(kBlockSizeMin <= kBlockSizeMax, "Invalid block size bounds");
128
+
129
+ using Block = container_internal::ChunkedQueueBlock<T, Allocator>;
130
+ using AllocatorTraits = std::allocator_traits<Allocator>;
131
+
132
+ class iterator_common {
133
+ public:
134
+ friend bool operator==(const iterator_common& a, const iterator_common& b) {
135
+ return a.ptr == b.ptr;
136
+ }
137
+
138
+ friend bool operator!=(const iterator_common& a, const iterator_common& b) {
139
+ return !(a == b);
140
+ }
141
+
142
+ protected:
143
+ iterator_common() = default;
144
+ explicit iterator_common(Block* b)
145
+ : block(b), ptr(b->start()), limit(b->limit()) {}
146
+
147
+ void Incr() {
148
+ // If we do not have a next block, make ptr point one past the end of this
149
+ // block. If we do have a next block, make ptr point to the first element
150
+ // of the next block.
151
+ ++ptr;
152
+ if (ptr == limit && block->next()) *this = iterator_common(block->next());
153
+ }
154
+
155
+ void IncrBy(size_t n) {
156
+ while (ptr + n > limit) {
157
+ n -= limit - ptr;
158
+ *this = iterator_common(block->next());
159
+ }
160
+ ptr += n;
161
+ }
162
+
163
+ Block* block = nullptr;
164
+ T* ptr = nullptr;
165
+ T* limit = nullptr;
166
+ };
167
+
168
+ // CT can be either T or const T.
169
+ template <typename CT>
170
+ class basic_iterator : public iterator_common {
171
+ public:
172
+ using iterator_category = std::forward_iterator_tag;
173
+ using value_type = typename AllocatorTraits::value_type;
174
+ using difference_type = typename AllocatorTraits::difference_type;
175
+ using pointer =
176
+ typename std::conditional<std::is_const<CT>::value,
177
+ typename AllocatorTraits::const_pointer,
178
+ typename AllocatorTraits::pointer>::type;
179
+ using reference = CT&;
180
+
181
+ basic_iterator() = default;
182
+
183
+ // Copy ctor if CT is T.
184
+ // Otherwise it's a conversion of iterator to const_iterator.
185
+ basic_iterator(const basic_iterator<T>& it) // NOLINT(runtime/explicit)
186
+ : iterator_common(it) {}
187
+
188
+ basic_iterator& operator=(const basic_iterator& other) = default;
189
+
190
+ reference operator*() const { return *this->ptr; }
191
+ pointer operator->() const { return this->ptr; }
192
+ basic_iterator& operator++() {
193
+ this->Incr();
194
+ return *this;
195
+ }
196
+ basic_iterator operator++(int) {
197
+ basic_iterator t = *this;
198
+ ++*this;
199
+ return t;
200
+ }
201
+
202
+ private:
203
+ explicit basic_iterator(Block* b) : iterator_common(b) {}
204
+
205
+ friend chunked_queue;
206
+ };
207
+
208
+ public:
209
+ using allocator_type = typename AllocatorTraits::allocator_type;
210
+ using value_type = typename AllocatorTraits::value_type;
211
+ using size_type = typename AllocatorTraits::size_type;
212
+ using difference_type = typename AllocatorTraits::difference_type;
213
+ using reference = value_type&;
214
+ using const_reference = const value_type&;
215
+ using iterator = basic_iterator<T>;
216
+ using const_iterator = basic_iterator<const T>;
217
+
218
+ // Constructs an empty queue.
219
+ chunked_queue() : chunked_queue(allocator_type()) {}
220
+
221
+ // Constructs an empty queue with a custom allocator.
222
+ explicit chunked_queue(const allocator_type& alloc)
223
+ : alloc_and_size_(alloc) {}
224
+
225
+ // Constructs a queue with `count` default-inserted elements.
226
+ explicit chunked_queue(size_type count,
227
+ const allocator_type& alloc = allocator_type())
228
+ : alloc_and_size_(alloc) {
229
+ resize(count);
230
+ }
231
+
232
+ // Constructs a queue with `count` copies of `value`.
233
+ chunked_queue(size_type count, const T& value,
234
+ const allocator_type& alloc = allocator_type())
235
+ : alloc_and_size_(alloc) {
236
+ assign(count, value);
237
+ }
238
+
239
+ // Constructs a queue with the contents of the range [first, last).
240
+ template <typename Iter,
241
+ typename = std::enable_if_t<
242
+ base_internal::IsAtLeastInputIterator<Iter>::value>>
243
+ chunked_queue(Iter first, Iter last,
244
+ const allocator_type& alloc = allocator_type())
245
+ : alloc_and_size_(alloc) {
246
+ using Tag = typename std::iterator_traits<Iter>::iterator_category;
247
+ RangeInit(first, last, Tag());
248
+ }
249
+
250
+ // Constructs a queue with the contents of the initializer list `list`.
251
+ chunked_queue(std::initializer_list<T> list,
252
+ const allocator_type& alloc = allocator_type())
253
+ : chunked_queue(list.begin(), list.end(), alloc) {}
254
+
255
+ ~chunked_queue();
256
+
257
+ // Copy constructor.
258
+ chunked_queue(const chunked_queue& other)
259
+ : chunked_queue(other,
260
+ AllocatorTraits::select_on_container_copy_construction(
261
+ other.alloc_and_size_.allocator())) {}
262
+
263
+ // Copy constructor with specific allocator.
264
+ chunked_queue(const chunked_queue& other, const allocator_type& alloc)
265
+ : alloc_and_size_(alloc) {
266
+ for (const_reference item : other) {
267
+ push_back(item);
268
+ }
269
+ }
270
+
271
+ // Move constructor.
272
+ chunked_queue(chunked_queue&& other) noexcept
273
+ : head_(other.head_),
274
+ tail_(other.tail_),
275
+ alloc_and_size_(std::move(other.alloc_and_size_)) {
276
+ other.head_ = {};
277
+ other.tail_ = {};
278
+ other.alloc_and_size_.size = 0;
279
+ }
280
+
281
+ // Replaces contents with those from initializer list `il`.
282
+ chunked_queue& operator=(std::initializer_list<T> il) {
283
+ assign(il.begin(), il.end());
284
+ return *this;
285
+ }
286
+
287
+ // Copy assignment operator.
288
+ chunked_queue& operator=(const chunked_queue& other) {
289
+ if (this == &other) {
290
+ return *this;
291
+ }
292
+ if (AllocatorTraits::propagate_on_container_copy_assignment::value &&
293
+ (alloc_and_size_.allocator() != other.alloc_and_size_.allocator())) {
294
+ // Destroy all current elements and blocks with the current allocator,
295
+ // before switching this to use the allocator propagated from "other".
296
+ DestroyAndDeallocateAll();
297
+ alloc_and_size_ = AllocatorAndSize(other.alloc_and_size_.allocator());
298
+ }
299
+ assign(other.begin(), other.end());
300
+ return *this;
301
+ }
302
+
303
+ // Move assignment operator.
304
+ chunked_queue& operator=(chunked_queue&& other) noexcept;
305
+
306
+ // Returns true if the queue contains no elements.
307
+ bool empty() const { return alloc_and_size_.size == 0; }
308
+
309
+ // Returns the number of elements in the queue.
310
+ size_t size() const { return alloc_and_size_.size; }
311
+
312
+ // Returns the maximum number of elements the queue is able to hold.
313
+ size_type max_size() const noexcept {
314
+ return AllocatorTraits::max_size(alloc_and_size_.allocator());
315
+ }
316
+
317
+ // Resizes the container to contain `new_size` elements.
318
+ // If `new_size > size()`, additional default-inserted elements are appended.
319
+ // If `new_size < size()`, elements are removed from the end.
320
+ void resize(size_t new_size);
321
+
322
+ // Resizes the container to contain `new_size` elements.
323
+ // If `new_size > size()`, additional copies of `value` are appended.
324
+ // If `new_size < size()`, elements are removed from the end.
325
+ void resize(size_type new_size, const T& value) {
326
+ if (new_size > size()) {
327
+ size_t to_add = new_size - size();
328
+ for (size_t i = 0; i < to_add; ++i) {
329
+ push_back(value);
330
+ }
331
+ } else {
332
+ resize(new_size);
333
+ }
334
+ }
335
+
336
+ // Requests the removal of unused capacity.
337
+ void shrink_to_fit() {
338
+ // As an optimization clear() leaves the first block of the chunked_queue
339
+ // allocated (but empty). When empty, shrink_to_fit() deallocates the first
340
+ // block by swapping it a newly constructed container that has no first
341
+ // block.
342
+ if (empty()) {
343
+ chunked_queue(alloc_and_size_.allocator()).swap(*this);
344
+ }
345
+ }
346
+
347
+ // Replaces the contents with copies of those in the range [first, last).
348
+ template <typename Iter,
349
+ typename = std::enable_if_t<
350
+ base_internal::IsAtLeastInputIterator<Iter>::value>>
351
+ void assign(Iter first, Iter last) {
352
+ auto out = begin();
353
+ Block* prev_block = nullptr;
354
+
355
+ // Overwrite existing elements.
356
+ for (; out != end() && first != last; ++first) {
357
+ // Track the previous block so we can correctly update tail_ if we stop
358
+ // exactly at a block boundary.
359
+ if (out.ptr + 1 == out.block->limit()) {
360
+ prev_block = out.block;
361
+ }
362
+ *out = *first;
363
+ ++out;
364
+ }
365
+
366
+ // If we stopped exactly at the start of a block (meaning the previous block
367
+ // was full), we must ensure tail_ points to the end of the previous block,
368
+ // not the start of the current (now empty and to be deleted) block.
369
+ // This maintains the invariant required by back() which assumes tail_
370
+ // never points to the start of a block (unless it's the only block).
371
+ if (!empty() && out.block != nullptr && out.ptr == out.block->start() &&
372
+ prev_block != nullptr) {
373
+ // Delete the current block and all subsequent blocks.
374
+ //
375
+ // NOTE: Calling EraseAllFrom on an iterator that points to the limit of
376
+ // the previous block will not delete any element from the previous block.
377
+ iterator prev_block_end(prev_block);
378
+ prev_block_end.ptr = prev_block->limit();
379
+ EraseAllFrom(prev_block_end);
380
+
381
+ // Update tail_ to point to the end of the previous block.
382
+ tail_ = prev_block_end;
383
+ prev_block->set_next(nullptr);
384
+ } else {
385
+ // Standard erase from the current position to the end.
386
+ EraseAllFrom(out);
387
+ }
388
+
389
+ // Append any remaining new elements.
390
+ for (; first != last; ++first) {
391
+ push_back(*first);
392
+ }
393
+ }
394
+
395
+ // Replaces the contents with `count` copies of `value`.
396
+ void assign(size_type count, const T& value) {
397
+ clear();
398
+ for (size_type i = 0; i < count; ++i) {
399
+ push_back(value);
400
+ }
401
+ }
402
+
403
+ // Replaces the contents with the elements from the initializer list `il`.
404
+ void assign(std::initializer_list<T> il) { assign(il.begin(), il.end()); }
405
+
406
+ // Appends the given element value to the end of the container.
407
+ // Invalidates `end()` iterator. References to other elements remain valid.
408
+ void push_back(const T& val) { emplace_back(val); }
409
+ void push_back(T&& val) { emplace_back(std::move(val)); }
410
+
411
+ // Appends a new element to the end of the container.
412
+ // The element is constructed in-place with `args`.
413
+ // Returns a reference to the new element.
414
+ // Invalidates `end()` iterator. References to other elements remain valid.
415
+ template <typename... A>
416
+ T& emplace_back(A&&... args) {
417
+ T* storage = AllocateBack();
418
+ AllocatorTraits::construct(alloc_and_size_.allocator(), storage,
419
+ std::forward<A>(args)...);
420
+ return *storage;
421
+ }
422
+
423
+ // Removes the first element of the container.
424
+ // Invalidates iterators to the removed element.
425
+ // REQUIRES: !empty()
426
+ void pop_front();
427
+
428
+ // Returns a reference to the first element in the container.
429
+ // REQUIRES: !empty()
430
+ T& front() {
431
+ ABSL_HARDENING_ASSERT(!empty());
432
+ return *head_;
433
+ }
434
+ const T& front() const {
435
+ ABSL_HARDENING_ASSERT(!empty());
436
+ return *head_;
437
+ }
438
+
439
+ // Returns a reference to the last element in the container.
440
+ // REQUIRES: !empty()
441
+ T& back() {
442
+ ABSL_HARDENING_ASSERT(!empty());
443
+ return *(&*tail_ - 1);
444
+ }
445
+ const T& back() const {
446
+ ABSL_HARDENING_ASSERT(!empty());
447
+ return *(&*tail_ - 1);
448
+ }
449
+
450
+ // Swaps the contents of this queue with `other`.
451
+ void swap(chunked_queue& other) noexcept {
452
+ using std::swap;
453
+ swap(head_, other.head_);
454
+ swap(tail_, other.tail_);
455
+ if (AllocatorTraits::propagate_on_container_swap::value) {
456
+ swap(alloc_and_size_, other.alloc_and_size_);
457
+ } else {
458
+ // Swap only the sizes; each object keeps its allocator.
459
+ //
460
+ // (It is undefined behavior to swap between two containers with unequal
461
+ // allocators if propagate_on_container_swap is false, so we don't have to
462
+ // handle that here like we do in the move-assignment operator.)
463
+ ABSL_HARDENING_ASSERT(get_allocator() == other.get_allocator());
464
+ swap(alloc_and_size_.size, other.alloc_and_size_.size);
465
+ }
466
+ }
467
+
468
+ // Erases all elements from the container.
469
+ // Note: Leaves one empty block allocated as an optimization.
470
+ // To free all memory, call shrink_to_fit() after calling clear().
471
+ void clear();
472
+
473
+ iterator begin() { return head_; }
474
+ iterator end() { return tail_; }
475
+
476
+ const_iterator begin() const { return head_; }
477
+ const_iterator end() const { return tail_; }
478
+
479
+ const_iterator cbegin() const { return head_; }
480
+ const_iterator cend() const { return tail_; }
481
+
482
+ // Returns the allocator associated with the container.
483
+ allocator_type get_allocator() const { return alloc_and_size_.allocator(); }
484
+
485
+ private:
486
+ // Empty base-class optimization: bundle storage for our allocator together
487
+ // with a field we had to store anyway (size), via inheriting from the
488
+ // allocator, so this allocator instance doesn't consume any storage
489
+ // when its type has no data members.
490
+ struct AllocatorAndSize : private allocator_type {
491
+ explicit AllocatorAndSize(const allocator_type& alloc)
492
+ : allocator_type(alloc) {}
493
+ const allocator_type& allocator() const { return *this; }
494
+ allocator_type& allocator() { return *this; }
495
+ size_t size = 0;
496
+ };
497
+
498
+ template <typename Iter>
499
+ void RangeInit(Iter first, Iter last, std::input_iterator_tag) {
500
+ while (first != last) {
501
+ AddTailBlock();
502
+ for (; first != last && tail_.ptr != tail_.limit;
503
+ ++alloc_and_size_.size, ++tail_.ptr, ++first) {
504
+ AllocatorTraits::construct(alloc_and_size_.allocator(), tail_.ptr,
505
+ *first);
506
+ }
507
+ }
508
+ }
509
+
510
+ void Construct(T* start, T* limit) {
511
+ ABSL_ASSERT(start <= limit);
512
+ for (; start != limit; ++start) {
513
+ AllocatorTraits::construct(alloc_and_size_.allocator(), start);
514
+ }
515
+ }
516
+
517
+ size_t Destroy(T* start, T* limit) {
518
+ ABSL_ASSERT(start <= limit);
519
+ const size_t n = limit - start;
520
+ for (; start != limit; ++start) {
521
+ AllocatorTraits::destroy(alloc_and_size_.allocator(), start);
522
+ }
523
+ return n;
524
+ }
525
+
526
+ T* block_begin(Block* b) const {
527
+ return b == head_.block ? head_.ptr : b->start();
528
+ }
529
+ T* block_end(Block* b) const {
530
+ // We have the choice of !b->next or b == tail_.block to determine if b is
531
+ // the tail or not. !b->next is usually faster because the caller of
532
+ // block_end() is most likely traversing the list of blocks so b->next is
533
+ // already fetched into some register.
534
+ return !b->next() ? tail_.ptr : b->limit();
535
+ }
536
+
537
+ void AddTailBlock();
538
+ size_t NewBlockSize() {
539
+ // Double the last block size and bound to [kBlockSizeMin, kBlockSizeMax].
540
+ if (!tail_.block) return kBlockSizeMin;
541
+ return (std::min)(kBlockSizeMax, 2 * tail_.block->size());
542
+ }
543
+
544
+ T* AllocateBack();
545
+ void EraseAllFrom(iterator i);
546
+
547
+ // Destroys any contained elements and destroys all allocated storage.
548
+ // (Like clear(), except this doesn't leave any empty blocks behind.)
549
+ void DestroyAndDeallocateAll();
550
+
551
+ // The set of elements in the queue is the following:
552
+ //
553
+ // (1) When we have just one block:
554
+ // [head_.ptr .. tail_.ptr-1]
555
+ // (2) When we have multiple blocks:
556
+ // [head_.ptr .. head_.limit-1]
557
+ // ... concatenation of all elements from interior blocks ...
558
+ // [tail_.ptr .. tail_.limit-1]
559
+ //
560
+ // Rep invariants:
561
+ // When have just one block:
562
+ // head_.limit == tail_.limit == &head_.block->element[kBlockSize]
563
+ // Always:
564
+ // head_.ptr <= head_.limit
565
+ // tail_.ptr <= tail_.limit
566
+
567
+ iterator head_;
568
+ iterator tail_;
569
+ AllocatorAndSize alloc_and_size_;
570
+ };
571
+
572
+ template <typename T, size_t BLo, size_t BHi, typename Allocator>
573
+ constexpr size_t chunked_queue<T, BLo, BHi, Allocator>::kBlockSizeMin;
574
+
575
+ template <typename T, size_t BLo, size_t BHi, typename Allocator>
576
+ constexpr size_t chunked_queue<T, BLo, BHi, Allocator>::kBlockSizeMax;
577
+
578
+ template <typename T, size_t BLo, size_t BHi, typename Allocator>
579
+ inline void swap(chunked_queue<T, BLo, BHi, Allocator>& a,
580
+ chunked_queue<T, BLo, BHi, Allocator>& b) noexcept {
581
+ a.swap(b);
582
+ }
583
+
584
+ template <typename T, size_t BLo, size_t BHi, typename Allocator>
585
+ chunked_queue<T, BLo, BHi, Allocator>&
586
+ chunked_queue<T, BLo, BHi, Allocator>::operator=(
587
+ chunked_queue&& other) noexcept {
588
+ if (this == &other) {
589
+ return *this;
590
+ }
591
+ DestroyAndDeallocateAll();
592
+
593
+ if constexpr (AllocatorTraits::propagate_on_container_move_assignment::
594
+ value) {
595
+ // Take over the storage of "other", along with its allocator.
596
+ head_ = other.head_;
597
+ tail_ = other.tail_;
598
+ alloc_and_size_ = std::move(other.alloc_and_size_);
599
+ other.head_ = {};
600
+ other.tail_ = {};
601
+ other.alloc_and_size_.size = 0;
602
+ } else if (get_allocator() == other.get_allocator()) {
603
+ // Take over the storage of "other", with which we share an allocator.
604
+ head_ = other.head_;
605
+ tail_ = other.tail_;
606
+ alloc_and_size_.size = other.alloc_and_size_.size;
607
+ other.head_ = {};
608
+ other.tail_ = {};
609
+ other.alloc_and_size_.size = 0;
610
+ } else {
611
+ // We cannot take over of the storage from "other", since it has a different
612
+ // allocator; we're stuck move-assigning elements individually.
613
+ for (auto& elem : other) {
614
+ push_back(std::move(elem));
615
+ }
616
+ }
617
+ return *this;
618
+ }
619
+
620
+ template <typename T, size_t BLo, size_t BHi, typename Allocator>
621
+ inline chunked_queue<T, BLo, BHi, Allocator>::~chunked_queue() {
622
+ Block* b = head_.block;
623
+ while (b) {
624
+ Block* next = b->next();
625
+ Destroy(block_begin(b), block_end(b));
626
+ Block::Delete(b, &alloc_and_size_.allocator());
627
+ b = next;
628
+ }
629
+ }
630
+
631
+ template <typename T, size_t BLo, size_t BHi, typename Allocator>
632
+ void chunked_queue<T, BLo, BHi, Allocator>::resize(size_t new_size) {
633
+ while (new_size > size()) {
634
+ ptrdiff_t to_add = new_size - size();
635
+ if (tail_.ptr == tail_.limit) {
636
+ AddTailBlock();
637
+ }
638
+ T* start = tail_.ptr;
639
+ T* limit = (std::min)(tail_.limit, start + to_add);
640
+ Construct(start, limit);
641
+ tail_.ptr = limit;
642
+ alloc_and_size_.size += limit - start;
643
+ }
644
+ if (size() == new_size) {
645
+ return;
646
+ }
647
+ ABSL_ASSERT(new_size < size());
648
+ auto new_end = begin();
649
+ new_end.IncrBy(new_size);
650
+ ABSL_ASSERT(new_end != end());
651
+ EraseAllFrom(new_end);
652
+ }
653
+
654
+ template <typename T, size_t BLo, size_t BHi, typename Allocator>
655
+ inline void chunked_queue<T, BLo, BHi, Allocator>::AddTailBlock() {
656
+ ABSL_ASSERT(tail_.ptr == tail_.limit);
657
+ auto* b = Block::New(NewBlockSize(), &alloc_and_size_.allocator());
658
+ if (!head_.block) {
659
+ ABSL_ASSERT(!tail_.block);
660
+ head_ = iterator(b);
661
+ } else {
662
+ ABSL_ASSERT(tail_.block);
663
+ tail_.block->set_next(b);
664
+ }
665
+ tail_ = iterator(b);
666
+ }
667
+
668
+ template <typename T, size_t BLo, size_t BHi, typename Allocator>
669
+ inline T* chunked_queue<T, BLo, BHi, Allocator>::AllocateBack() {
670
+ if (tail_.ptr == tail_.limit) {
671
+ AddTailBlock();
672
+ }
673
+ ++alloc_and_size_.size;
674
+ return tail_.ptr++;
675
+ }
676
+
677
+ template <typename T, size_t BLo, size_t BHi, typename Allocator>
678
+ inline void chunked_queue<T, BLo, BHi, Allocator>::EraseAllFrom(iterator i) {
679
+ if (!i.block) {
680
+ return;
681
+ }
682
+ ABSL_ASSERT(i.ptr);
683
+ ABSL_ASSERT(i.limit);
684
+ alloc_and_size_.size -= Destroy(i.ptr, block_end(i.block));
685
+ Block* b = i.block->next();
686
+ while (b) {
687
+ Block* next = b->next();
688
+ alloc_and_size_.size -= Destroy(b->start(), block_end(b));
689
+ Block::Delete(b, &alloc_and_size_.allocator());
690
+ b = next;
691
+ }
692
+ tail_ = i;
693
+ tail_.block->set_next(nullptr);
694
+ }
695
+
696
+ template <typename T, size_t BLo, size_t BHi, typename Allocator>
697
+ inline void chunked_queue<T, BLo, BHi, Allocator>::DestroyAndDeallocateAll() {
698
+ Block* b = head_.block;
699
+ while (b) {
700
+ Block* next = b->next();
701
+ Destroy(block_begin(b), block_end(b));
702
+ Block::Delete(b, &alloc_and_size_.allocator());
703
+ b = next;
704
+ }
705
+ head_ = iterator();
706
+ tail_ = iterator();
707
+ alloc_and_size_.size = 0;
708
+ }
709
+
710
+ template <typename T, size_t BLo, size_t BHi, typename Allocator>
711
+ inline void chunked_queue<T, BLo, BHi, Allocator>::pop_front() {
712
+ ABSL_HARDENING_ASSERT(!empty());
713
+ ABSL_ASSERT(head_.block);
714
+ AllocatorTraits::destroy(alloc_and_size_.allocator(), head_.ptr);
715
+ ++head_.ptr;
716
+ --alloc_and_size_.size;
717
+ if (empty()) {
718
+ // Reset head and tail to the start of the (only) block.
719
+ ABSL_ASSERT(head_.block == tail_.block);
720
+ head_.ptr = tail_.ptr = head_.block->start();
721
+ return;
722
+ }
723
+ if (head_.ptr == head_.limit) {
724
+ Block* n = head_.block->next();
725
+ Block::Delete(head_.block, &alloc_and_size_.allocator());
726
+ head_ = iterator(n);
727
+ }
728
+ }
729
+
730
+ template <typename T, size_t BLo, size_t BHi, typename Allocator>
731
+ void chunked_queue<T, BLo, BHi, Allocator>::clear() {
732
+ // NOTE: As an optimization we leave one block allocated.
733
+ Block* b = head_.block;
734
+ if (!b) {
735
+ ABSL_ASSERT(empty());
736
+ return;
737
+ }
738
+ while (b) {
739
+ Block* next = b->next();
740
+ Destroy(block_begin(b), block_end(b));
741
+ if (head_.block != b) {
742
+ Block::Delete(b, &alloc_and_size_.allocator());
743
+ }
744
+ b = next;
745
+ }
746
+ b = head_.block;
747
+ b->set_next(nullptr);
748
+ head_ = tail_ = iterator(b);
749
+ alloc_and_size_.size = 0;
750
+ }
751
+
752
+ ABSL_NAMESPACE_END
753
+ } // namespace absl
754
+
755
+ #endif // ABSL_CONTAINER_CHUNKED_QUEUE_H_