couchbase 4.3.1 → 4.4.1-dev.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1104) hide show
  1. package/deps/couchbase-cxx-cache/mozilla-ca-bundle.crt +19 -32
  2. package/deps/couchbase-cxx-cache/mozilla-ca-bundle.sha256 +1 -1
  3. package/deps/couchbase-cxx-client/CMakeLists.txt +16 -9
  4. package/deps/couchbase-cxx-client/README.md +39 -44
  5. package/deps/couchbase-cxx-client/cmake/0001-fix-build-for-mingw-w64-ucrt-x86_64-toolchain.patch +3 -4
  6. package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +2 -1
  7. package/deps/couchbase-cxx-client/cmake/Packaging.cmake +41 -0
  8. package/deps/couchbase-cxx-client/cmake/Sanitizers.cmake +1 -0
  9. package/deps/couchbase-cxx-client/cmake/VersionInfo.cmake +5 -5
  10. package/deps/couchbase-cxx-client/cmake/build_version.hxx.in +1 -0
  11. package/deps/couchbase-cxx-client/cmake/couchbase-cxx-client.pc.in +10 -0
  12. package/deps/couchbase-cxx-client/cmake/test_boringssl.cxx +1 -1
  13. package/deps/couchbase-cxx-client/cmake/test_openssl.cxx +1 -1
  14. package/deps/couchbase-cxx-client/core/agent.cxx +353 -304
  15. package/deps/couchbase-cxx-client/core/agent.hxx +94 -76
  16. package/deps/couchbase-cxx-client/core/agent_config.cxx +9 -8
  17. package/deps/couchbase-cxx-client/core/agent_config.hxx +7 -7
  18. package/deps/couchbase-cxx-client/core/agent_group.cxx +132 -120
  19. package/deps/couchbase-cxx-client/core/agent_group.hxx +26 -22
  20. package/deps/couchbase-cxx-client/core/agent_group_config.cxx +8 -7
  21. package/deps/couchbase-cxx-client/core/agent_group_config.hxx +6 -6
  22. package/deps/couchbase-cxx-client/core/agent_unit_test_api.hxx +6 -6
  23. package/deps/couchbase-cxx-client/core/analytics_query_options.cxx +21 -21
  24. package/deps/couchbase-cxx-client/core/analytics_query_options.hxx +19 -18
  25. package/deps/couchbase-cxx-client/core/analytics_scan_consistency.hxx +2 -2
  26. package/deps/couchbase-cxx-client/core/bucket.cxx +848 -776
  27. package/deps/couchbase-cxx-client/core/bucket.hxx +151 -139
  28. package/deps/couchbase-cxx-client/core/capella_ca.hxx +20 -19
  29. package/deps/couchbase-cxx-client/core/cluster.cxx +1240 -927
  30. package/deps/couchbase-cxx-client/core/cluster.hxx +254 -167
  31. package/deps/couchbase-cxx-client/core/cluster_agent.cxx +7 -7
  32. package/deps/couchbase-cxx-client/core/cluster_agent.hxx +4 -4
  33. package/deps/couchbase-cxx-client/core/cluster_agent_config.cxx +8 -7
  34. package/deps/couchbase-cxx-client/core/cluster_agent_config.hxx +6 -6
  35. package/deps/couchbase-cxx-client/core/cluster_options.cxx +17 -17
  36. package/deps/couchbase-cxx-client/core/cluster_options.hxx +50 -47
  37. package/deps/couchbase-cxx-client/core/cluster_state.hxx +3 -3
  38. package/deps/couchbase-cxx-client/core/collection_id_cache_entry.hxx +5 -4
  39. package/deps/couchbase-cxx-client/core/collections_component.cxx +372 -329
  40. package/deps/couchbase-cxx-client/core/collections_component.hxx +17 -13
  41. package/deps/couchbase-cxx-client/core/collections_component_unit_test_api.hxx +6 -6
  42. package/deps/couchbase-cxx-client/core/collections_options.hxx +29 -27
  43. package/deps/couchbase-cxx-client/core/config_listener.hxx +3 -3
  44. package/deps/couchbase-cxx-client/core/config_profile.hxx +3 -3
  45. package/deps/couchbase-cxx-client/core/config_profiles.cxx +31 -31
  46. package/deps/couchbase-cxx-client/core/config_profiles.hxx +19 -19
  47. package/deps/couchbase-cxx-client/core/core_sdk_shim.cxx +2 -1
  48. package/deps/couchbase-cxx-client/core/core_sdk_shim.hxx +2 -2
  49. package/deps/couchbase-cxx-client/core/crud_component.cxx +310 -276
  50. package/deps/couchbase-cxx-client/core/crud_component.hxx +21 -15
  51. package/deps/couchbase-cxx-client/core/crud_options.hxx +361 -354
  52. package/deps/couchbase-cxx-client/core/crypto/cbcrypto.cc +732 -627
  53. package/deps/couchbase-cxx-client/core/crypto/cbcrypto.h +12 -3
  54. package/deps/couchbase-cxx-client/core/design_document_namespace.hxx +2 -2
  55. package/deps/couchbase-cxx-client/core/design_document_namespace_fmt.hxx +18 -18
  56. package/deps/couchbase-cxx-client/core/diagnostics.hxx +44 -44
  57. package/deps/couchbase-cxx-client/core/diagnostics_fmt.hxx +76 -76
  58. package/deps/couchbase-cxx-client/core/diagnostics_json.hxx +61 -60
  59. package/deps/couchbase-cxx-client/core/diagntostics_options.hxx +14 -14
  60. package/deps/couchbase-cxx-client/core/dispatcher.cxx +4 -3
  61. package/deps/couchbase-cxx-client/core/dispatcher.hxx +8 -7
  62. package/deps/couchbase-cxx-client/core/document_id.cxx +37 -34
  63. package/deps/couchbase-cxx-client/core/document_id.hxx +87 -86
  64. package/deps/couchbase-cxx-client/core/document_id_fmt.hxx +10 -10
  65. package/deps/couchbase-cxx-client/core/durability_options.hxx +50 -49
  66. package/deps/couchbase-cxx-client/core/error_context/analytics.hxx +18 -18
  67. package/deps/couchbase-cxx-client/core/error_context/analytics_json.hxx +115 -0
  68. package/deps/couchbase-cxx-client/core/error_context/base_error_context.hxx +184 -0
  69. package/deps/couchbase-cxx-client/core/error_context/http.hxx +14 -14
  70. package/deps/couchbase-cxx-client/core/error_context/http_json.hxx +90 -0
  71. package/deps/couchbase-cxx-client/core/error_context/internal_tof_metadata_json.hxx +36 -0
  72. package/deps/couchbase-cxx-client/core/error_context/key_value.cxx +27 -27
  73. package/deps/couchbase-cxx-client/core/error_context/key_value.hxx +41 -38
  74. package/deps/couchbase-cxx-client/core/error_context/key_value_error_context.hxx +235 -0
  75. package/deps/couchbase-cxx-client/core/error_context/key_value_error_map_attribute.hxx +142 -0
  76. package/deps/couchbase-cxx-client/core/error_context/key_value_error_map_info.hxx +139 -0
  77. package/deps/couchbase-cxx-client/core/error_context/key_value_extended_error_info.hxx +86 -0
  78. package/deps/couchbase-cxx-client/core/error_context/key_value_json.hxx +83 -0
  79. package/deps/couchbase-cxx-client/core/error_context/key_value_status_code.hxx +109 -0
  80. package/deps/couchbase-cxx-client/core/error_context/query.hxx +18 -18
  81. package/deps/couchbase-cxx-client/core/error_context/query_error_context.hxx +150 -0
  82. package/deps/couchbase-cxx-client/core/error_context/query_json.hxx +114 -0
  83. package/deps/couchbase-cxx-client/core/error_context/query_public_json.hxx +84 -0
  84. package/deps/couchbase-cxx-client/core/error_context/search.hxx +17 -17
  85. package/deps/couchbase-cxx-client/core/error_context/search_json.hxx +101 -0
  86. package/deps/couchbase-cxx-client/core/error_context/subdocument_error_context.hxx +147 -0
  87. package/deps/couchbase-cxx-client/core/error_context/subdocument_json.hxx +48 -0
  88. package/deps/couchbase-cxx-client/{couchbase → core/error_context}/transaction_error_context.hxx +22 -22
  89. package/deps/couchbase-cxx-client/core/error_context/transaction_op_error_context.hxx +79 -0
  90. package/deps/couchbase-cxx-client/core/error_context/view.hxx +17 -17
  91. package/deps/couchbase-cxx-client/core/fmt/key_value_error_map_attribute.hxx +100 -0
  92. package/deps/couchbase-cxx-client/{couchbase → core}/fmt/key_value_extended_error_info.hxx +20 -20
  93. package/deps/couchbase-cxx-client/core/fmt/key_value_status_code.hxx +269 -0
  94. package/deps/couchbase-cxx-client/core/free_form_http_request.cxx +26 -26
  95. package/deps/couchbase-cxx-client/core/free_form_http_request.hxx +34 -33
  96. package/deps/couchbase-cxx-client/core/impl/analytics.cxx +111 -131
  97. package/deps/couchbase-cxx-client/core/impl/analytics.hxx +5 -7
  98. package/deps/couchbase-cxx-client/core/impl/analytics_error_category.cxx +29 -28
  99. package/deps/couchbase-cxx-client/core/impl/analytics_index_manager.cxx +615 -516
  100. package/deps/couchbase-cxx-client/core/impl/best_effort_retry_strategy.cxx +53 -50
  101. package/deps/couchbase-cxx-client/core/impl/binary_collection.cxx +346 -285
  102. package/deps/couchbase-cxx-client/core/impl/boolean_field_query.cxx +10 -10
  103. package/deps/couchbase-cxx-client/core/impl/boolean_query.cxx +27 -27
  104. package/deps/couchbase-cxx-client/core/impl/bootstrap_state_listener.hxx +6 -6
  105. package/deps/couchbase-cxx-client/core/impl/bucket.cxx +39 -34
  106. package/deps/couchbase-cxx-client/core/impl/bucket_manager.cxx +354 -313
  107. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +430 -325
  108. package/deps/couchbase-cxx-client/core/impl/collection.cxx +1033 -1187
  109. package/deps/couchbase-cxx-client/core/impl/collection_manager.cxx +201 -170
  110. package/deps/couchbase-cxx-client/core/impl/common_error_category.cxx +58 -55
  111. package/deps/couchbase-cxx-client/core/impl/configuration_profiles_registry.cxx +46 -32
  112. package/deps/couchbase-cxx-client/core/impl/conjunction_query.cxx +17 -17
  113. package/deps/couchbase-cxx-client/core/impl/date_range.cxx +24 -20
  114. package/deps/couchbase-cxx-client/core/impl/date_range_facet.cxx +22 -22
  115. package/deps/couchbase-cxx-client/core/impl/date_range_facet_result.cxx +6 -6
  116. package/deps/couchbase-cxx-client/core/impl/date_range_query.cxx +50 -48
  117. package/deps/couchbase-cxx-client/core/impl/diagnostics.cxx +211 -198
  118. package/deps/couchbase-cxx-client/core/impl/diagnostics.hxx +7 -6
  119. package/deps/couchbase-cxx-client/core/impl/disjunction_query.cxx +18 -17
  120. package/deps/couchbase-cxx-client/core/impl/dns_srv_tracker.cxx +92 -75
  121. package/deps/couchbase-cxx-client/core/impl/dns_srv_tracker.hxx +24 -20
  122. package/deps/couchbase-cxx-client/core/impl/doc_id_query.cxx +9 -9
  123. package/deps/couchbase-cxx-client/core/impl/encoded_search_facet.hxx +2 -2
  124. package/deps/couchbase-cxx-client/core/impl/encoded_search_query.hxx +2 -2
  125. package/deps/couchbase-cxx-client/core/impl/encoded_search_sort.hxx +2 -2
  126. package/deps/couchbase-cxx-client/core/impl/error.cxx +171 -0
  127. package/deps/couchbase-cxx-client/core/impl/error.hxx +64 -0
  128. package/deps/couchbase-cxx-client/core/impl/error_context.cxx +56 -0
  129. package/deps/couchbase-cxx-client/core/impl/expiry.cxx +66 -53
  130. package/deps/couchbase-cxx-client/core/impl/fail_fast_retry_strategy.cxx +5 -4
  131. package/deps/couchbase-cxx-client/core/impl/field_level_encryption_error_category.cxx +30 -28
  132. package/deps/couchbase-cxx-client/core/impl/geo_bounding_box_query.cxx +17 -17
  133. package/deps/couchbase-cxx-client/core/impl/geo_distance_query.cxx +14 -14
  134. package/deps/couchbase-cxx-client/core/impl/geo_polygon_query.cxx +17 -17
  135. package/deps/couchbase-cxx-client/core/impl/get_all_replicas.hxx +26 -22
  136. package/deps/couchbase-cxx-client/core/impl/get_any_replica.hxx +25 -23
  137. package/deps/couchbase-cxx-client/core/impl/get_replica.cxx +18 -15
  138. package/deps/couchbase-cxx-client/core/impl/get_replica.hxx +23 -18
  139. package/deps/couchbase-cxx-client/core/impl/internal_date_range_facet_result.cxx +16 -14
  140. package/deps/couchbase-cxx-client/core/impl/internal_date_range_facet_result.hxx +16 -15
  141. package/deps/couchbase-cxx-client/core/impl/internal_error_context.cxx +79 -0
  142. package/deps/couchbase-cxx-client/core/impl/internal_error_context.hxx +52 -0
  143. package/deps/couchbase-cxx-client/core/impl/internal_numeric_range_facet_result.cxx +18 -15
  144. package/deps/couchbase-cxx-client/core/impl/internal_numeric_range_facet_result.hxx +16 -15
  145. package/deps/couchbase-cxx-client/core/impl/internal_scan_result.hxx +7 -7
  146. package/deps/couchbase-cxx-client/core/impl/internal_search_error_context.cxx +25 -22
  147. package/deps/couchbase-cxx-client/core/impl/internal_search_error_context.hxx +32 -31
  148. package/deps/couchbase-cxx-client/core/impl/internal_search_meta_data.cxx +15 -13
  149. package/deps/couchbase-cxx-client/core/impl/internal_search_meta_data.hxx +10 -9
  150. package/deps/couchbase-cxx-client/core/impl/internal_search_result.cxx +30 -22
  151. package/deps/couchbase-cxx-client/core/impl/internal_search_result.hxx +10 -9
  152. package/deps/couchbase-cxx-client/core/impl/internal_search_row.cxx +10 -10
  153. package/deps/couchbase-cxx-client/core/impl/internal_search_row.hxx +16 -16
  154. package/deps/couchbase-cxx-client/core/impl/internal_search_row_location.hxx +2 -2
  155. package/deps/couchbase-cxx-client/core/impl/internal_search_row_locations.cxx +68 -65
  156. package/deps/couchbase-cxx-client/core/impl/internal_search_row_locations.hxx +16 -13
  157. package/deps/couchbase-cxx-client/core/impl/internal_term_facet_result.cxx +16 -14
  158. package/deps/couchbase-cxx-client/core/impl/internal_term_facet_result.hxx +15 -15
  159. package/deps/couchbase-cxx-client/core/impl/key_value_error_category.cxx +73 -72
  160. package/deps/couchbase-cxx-client/core/impl/key_value_error_context.cxx +65 -65
  161. package/deps/couchbase-cxx-client/core/impl/logger.cxx +91 -0
  162. package/deps/couchbase-cxx-client/core/impl/lookup_in_all_replicas.hxx +32 -29
  163. package/deps/couchbase-cxx-client/core/impl/lookup_in_any_replica.hxx +33 -29
  164. package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.cxx +75 -68
  165. package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.hxx +30 -26
  166. package/deps/couchbase-cxx-client/core/impl/management_error_category.cxx +41 -40
  167. package/deps/couchbase-cxx-client/core/impl/match_all_query.cxx +6 -6
  168. package/deps/couchbase-cxx-client/core/impl/match_none_query.cxx +6 -6
  169. package/deps/couchbase-cxx-client/core/impl/match_phrase_query.cxx +13 -13
  170. package/deps/couchbase-cxx-client/core/impl/match_query.cxx +28 -28
  171. package/deps/couchbase-cxx-client/core/impl/network_error_category.cxx +39 -38
  172. package/deps/couchbase-cxx-client/core/impl/numeric_range.cxx +6 -6
  173. package/deps/couchbase-cxx-client/core/impl/numeric_range_facet.cxx +22 -22
  174. package/deps/couchbase-cxx-client/core/impl/numeric_range_facet_result.cxx +6 -6
  175. package/deps/couchbase-cxx-client/core/impl/numeric_range_query.cxx +22 -22
  176. package/deps/couchbase-cxx-client/core/impl/observe_poll.cxx +294 -277
  177. package/deps/couchbase-cxx-client/core/impl/observe_poll.hxx +1 -1
  178. package/deps/couchbase-cxx-client/core/impl/observe_seqno.cxx +21 -18
  179. package/deps/couchbase-cxx-client/core/impl/observe_seqno.hxx +31 -26
  180. package/deps/couchbase-cxx-client/core/impl/phrase_query.cxx +10 -10
  181. package/deps/couchbase-cxx-client/core/impl/prefix_query.cxx +10 -10
  182. package/deps/couchbase-cxx-client/core/impl/query.cxx +163 -154
  183. package/deps/couchbase-cxx-client/core/impl/query.hxx +6 -7
  184. package/deps/couchbase-cxx-client/core/impl/query_error_category.cxx +22 -21
  185. package/deps/couchbase-cxx-client/core/impl/query_error_context.cxx +45 -45
  186. package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +488 -408
  187. package/deps/couchbase-cxx-client/core/impl/query_string_query.cxx +7 -7
  188. package/deps/couchbase-cxx-client/core/impl/regexp_query.cxx +10 -10
  189. package/deps/couchbase-cxx-client/core/impl/replica_utils.cxx +66 -0
  190. package/deps/couchbase-cxx-client/core/impl/replica_utils.hxx +48 -0
  191. package/deps/couchbase-cxx-client/core/impl/retry_action.cxx +3 -3
  192. package/deps/couchbase-cxx-client/core/impl/retry_reason.cxx +129 -56
  193. package/deps/couchbase-cxx-client/core/impl/retry_reason.hxx +28 -0
  194. package/deps/couchbase-cxx-client/core/impl/scan_result.cxx +53 -49
  195. package/deps/couchbase-cxx-client/core/impl/scope.cxx +103 -94
  196. package/deps/couchbase-cxx-client/core/impl/search.cxx +139 -130
  197. package/deps/couchbase-cxx-client/core/impl/search.hxx +4 -4
  198. package/deps/couchbase-cxx-client/core/impl/search_error_category.cxx +18 -17
  199. package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +492 -390
  200. package/deps/couchbase-cxx-client/core/impl/search_meta_data.cxx +3 -3
  201. package/deps/couchbase-cxx-client/core/impl/search_request.cxx +78 -78
  202. package/deps/couchbase-cxx-client/core/impl/search_result.cxx +5 -5
  203. package/deps/couchbase-cxx-client/core/impl/search_row.cxx +7 -7
  204. package/deps/couchbase-cxx-client/core/impl/search_row_location.cxx +9 -8
  205. package/deps/couchbase-cxx-client/core/impl/search_row_locations.cxx +8 -7
  206. package/deps/couchbase-cxx-client/core/impl/search_sort_field.cxx +53 -53
  207. package/deps/couchbase-cxx-client/core/impl/search_sort_geo_distance.cxx +49 -48
  208. package/deps/couchbase-cxx-client/core/impl/search_sort_id.cxx +10 -10
  209. package/deps/couchbase-cxx-client/core/impl/search_sort_score.cxx +10 -10
  210. package/deps/couchbase-cxx-client/core/impl/streaming_json_lexer_error_category.cxx +70 -68
  211. package/deps/couchbase-cxx-client/core/impl/subdoc/array_add_unique.cxx +6 -6
  212. package/deps/couchbase-cxx-client/core/impl/subdoc/array_append.cxx +6 -6
  213. package/deps/couchbase-cxx-client/core/impl/subdoc/array_insert.cxx +6 -6
  214. package/deps/couchbase-cxx-client/core/impl/subdoc/array_prepend.cxx +6 -6
  215. package/deps/couchbase-cxx-client/core/impl/subdoc/command.hxx +5 -5
  216. package/deps/couchbase-cxx-client/core/impl/subdoc/command_bundle.hxx +11 -11
  217. package/deps/couchbase-cxx-client/core/impl/subdoc/count.cxx +6 -6
  218. package/deps/couchbase-cxx-client/core/impl/subdoc/counter.cxx +6 -6
  219. package/deps/couchbase-cxx-client/core/impl/subdoc/exists.cxx +6 -6
  220. package/deps/couchbase-cxx-client/core/impl/subdoc/get.cxx +6 -6
  221. package/deps/couchbase-cxx-client/core/impl/subdoc/insert.cxx +6 -6
  222. package/deps/couchbase-cxx-client/core/impl/subdoc/join_values.cxx +25 -25
  223. package/deps/couchbase-cxx-client/core/impl/subdoc/lookup_in_macro.cxx +61 -60
  224. package/deps/couchbase-cxx-client/core/impl/subdoc/lookup_in_specs.cxx +9 -9
  225. package/deps/couchbase-cxx-client/core/impl/subdoc/mutate_in_macro.cxx +48 -39
  226. package/deps/couchbase-cxx-client/core/impl/subdoc/mutate_in_specs.cxx +9 -9
  227. package/deps/couchbase-cxx-client/core/impl/subdoc/opcode.hxx +16 -16
  228. package/deps/couchbase-cxx-client/core/impl/subdoc/path_flags.hxx +40 -17
  229. package/deps/couchbase-cxx-client/core/impl/subdoc/remove.cxx +6 -6
  230. package/deps/couchbase-cxx-client/core/impl/subdoc/replace.cxx +6 -6
  231. package/deps/couchbase-cxx-client/core/impl/subdoc/upsert.cxx +6 -6
  232. package/deps/couchbase-cxx-client/core/impl/term_facet.cxx +8 -8
  233. package/deps/couchbase-cxx-client/core/impl/term_facet_result.cxx +6 -6
  234. package/deps/couchbase-cxx-client/core/impl/term_query.cxx +25 -25
  235. package/deps/couchbase-cxx-client/core/impl/term_range_query.cxx +22 -22
  236. package/deps/couchbase-cxx-client/core/impl/transaction_error_category.cxx +21 -20
  237. package/deps/couchbase-cxx-client/core/impl/transaction_get_result.cxx +41 -30
  238. package/deps/couchbase-cxx-client/core/impl/transaction_op_error_category.cxx +55 -56
  239. package/deps/couchbase-cxx-client/core/impl/vector_query.cxx +15 -10
  240. package/deps/couchbase-cxx-client/core/impl/vector_search.cxx +9 -9
  241. package/deps/couchbase-cxx-client/core/impl/view_error_category.cxx +17 -16
  242. package/deps/couchbase-cxx-client/core/impl/wildcard_query.cxx +10 -10
  243. package/deps/couchbase-cxx-client/core/impl/with_legacy_durability.hxx +30 -29
  244. package/deps/couchbase-cxx-client/core/io/dns_client.cxx +257 -232
  245. package/deps/couchbase-cxx-client/core/io/dns_client.hxx +19 -18
  246. package/deps/couchbase-cxx-client/core/io/dns_codec.hxx +156 -154
  247. package/deps/couchbase-cxx-client/core/io/dns_config.cxx +114 -109
  248. package/deps/couchbase-cxx-client/core/io/dns_config.hxx +15 -13
  249. package/deps/couchbase-cxx-client/core/io/dns_message.hxx +365 -342
  250. package/deps/couchbase-cxx-client/core/io/http_command.hxx +155 -134
  251. package/deps/couchbase-cxx-client/core/io/http_context.hxx +5 -5
  252. package/deps/couchbase-cxx-client/core/io/http_message.hxx +75 -71
  253. package/deps/couchbase-cxx-client/core/io/http_parser.cxx +70 -67
  254. package/deps/couchbase-cxx-client/core/io/http_parser.hxx +18 -18
  255. package/deps/couchbase-cxx-client/core/io/http_session.hxx +620 -520
  256. package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +406 -315
  257. package/deps/couchbase-cxx-client/core/io/http_traits.hxx +7 -0
  258. package/deps/couchbase-cxx-client/core/io/ip_protocol.hxx +3 -3
  259. package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +298 -278
  260. package/deps/couchbase-cxx-client/core/io/mcbp_context.hxx +7 -6
  261. package/deps/couchbase-cxx-client/core/io/mcbp_message.cxx +8 -8
  262. package/deps/couchbase-cxx-client/core/io/mcbp_message.hxx +19 -19
  263. package/deps/couchbase-cxx-client/core/io/mcbp_parser.cxx +60 -51
  264. package/deps/couchbase-cxx-client/core/io/mcbp_parser.hxx +21 -17
  265. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +1769 -1616
  266. package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +63 -57
  267. package/deps/couchbase-cxx-client/core/io/query_cache.hxx +34 -34
  268. package/deps/couchbase-cxx-client/core/io/retry_context.hxx +45 -45
  269. package/deps/couchbase-cxx-client/core/io/retry_orchestrator.hxx +52 -42
  270. package/deps/couchbase-cxx-client/core/io/streams.hxx +210 -193
  271. package/deps/couchbase-cxx-client/core/json_string.hxx +47 -47
  272. package/deps/couchbase-cxx-client/core/key_value_config.cxx +8 -8
  273. package/deps/couchbase-cxx-client/core/key_value_config.hxx +12 -11
  274. package/deps/couchbase-cxx-client/core/logger/configuration.hxx +35 -35
  275. package/deps/couchbase-cxx-client/core/logger/custom_rotating_file_sink.cxx +73 -72
  276. package/deps/couchbase-cxx-client/core/logger/custom_rotating_file_sink.hxx +20 -18
  277. package/deps/couchbase-cxx-client/core/logger/level.hxx +9 -1
  278. package/deps/couchbase-cxx-client/core/logger/logger.cxx +279 -252
  279. package/deps/couchbase-cxx-client/core/logger/logger.hxx +110 -58
  280. package/deps/couchbase-cxx-client/core/management/analytics_dataset.hxx +4 -4
  281. package/deps/couchbase-cxx-client/core/management/analytics_index.hxx +4 -4
  282. package/deps/couchbase-cxx-client/core/management/analytics_link_azure_blob_external.cxx +35 -33
  283. package/deps/couchbase-cxx-client/core/management/analytics_link_azure_blob_external.hxx +36 -35
  284. package/deps/couchbase-cxx-client/core/management/analytics_link_azure_blob_external_json.hxx +24 -20
  285. package/deps/couchbase-cxx-client/core/management/analytics_link_couchbase_remote.cxx +66 -65
  286. package/deps/couchbase-cxx-client/core/management/analytics_link_couchbase_remote.hxx +77 -70
  287. package/deps/couchbase-cxx-client/core/management/analytics_link_couchbase_remote_json.hxx +38 -32
  288. package/deps/couchbase-cxx-client/core/management/analytics_link_s3_external.cxx +26 -25
  289. package/deps/couchbase-cxx-client/core/management/analytics_link_s3_external.hxx +30 -30
  290. package/deps/couchbase-cxx-client/core/management/analytics_link_s3_external_json.hxx +18 -16
  291. package/deps/couchbase-cxx-client/core/management/bucket_settings.hxx +109 -91
  292. package/deps/couchbase-cxx-client/core/management/bucket_settings_json.hxx +112 -94
  293. package/deps/couchbase-cxx-client/core/management/design_document.hxx +9 -9
  294. package/deps/couchbase-cxx-client/core/management/eventing_function.hxx +124 -121
  295. package/deps/couchbase-cxx-client/core/management/eventing_function_json.hxx +228 -184
  296. package/deps/couchbase-cxx-client/core/management/eventing_status.hxx +41 -41
  297. package/deps/couchbase-cxx-client/core/management/eventing_status_json.hxx +53 -45
  298. package/deps/couchbase-cxx-client/core/management/rbac.hxx +33 -28
  299. package/deps/couchbase-cxx-client/core/management/rbac_fmt.hxx +21 -21
  300. package/deps/couchbase-cxx-client/core/management/rbac_json.hxx +132 -125
  301. package/deps/couchbase-cxx-client/core/management/search_index.cxx +79 -0
  302. package/deps/couchbase-cxx-client/core/management/search_index.hxx +11 -10
  303. package/deps/couchbase-cxx-client/core/management/search_index_json.hxx +27 -26
  304. package/deps/couchbase-cxx-client/core/mcbp/barrier_frame.hxx +4 -3
  305. package/deps/couchbase-cxx-client/core/mcbp/big_endian.cxx +22 -22
  306. package/deps/couchbase-cxx-client/core/mcbp/buffer_writer.cxx +22 -19
  307. package/deps/couchbase-cxx-client/core/mcbp/buffer_writer.hxx +9 -9
  308. package/deps/couchbase-cxx-client/core/mcbp/codec.cxx +419 -397
  309. package/deps/couchbase-cxx-client/core/mcbp/codec.hxx +14 -12
  310. package/deps/couchbase-cxx-client/core/mcbp/command_code.cxx +48 -48
  311. package/deps/couchbase-cxx-client/core/mcbp/completion_token.hxx +33 -33
  312. package/deps/couchbase-cxx-client/core/mcbp/datatype.hxx +3 -3
  313. package/deps/couchbase-cxx-client/core/mcbp/durability_level.hxx +8 -7
  314. package/deps/couchbase-cxx-client/core/mcbp/durability_level_frame.hxx +3 -2
  315. package/deps/couchbase-cxx-client/core/mcbp/durability_timeout_frame.hxx +4 -3
  316. package/deps/couchbase-cxx-client/core/mcbp/open_tracing_frame.hxx +3 -2
  317. package/deps/couchbase-cxx-client/core/mcbp/operation_consumer.cxx +3 -3
  318. package/deps/couchbase-cxx-client/core/mcbp/operation_consumer.hxx +9 -9
  319. package/deps/couchbase-cxx-client/core/mcbp/operation_queue.cxx +76 -70
  320. package/deps/couchbase-cxx-client/core/mcbp/operation_queue.hxx +18 -17
  321. package/deps/couchbase-cxx-client/core/mcbp/packet.cxx +65 -51
  322. package/deps/couchbase-cxx-client/core/mcbp/packet.hxx +25 -25
  323. package/deps/couchbase-cxx-client/core/mcbp/preserve_expiry_frame.hxx +4 -2
  324. package/deps/couchbase-cxx-client/core/mcbp/queue_callback.hxx +3 -2
  325. package/deps/couchbase-cxx-client/core/mcbp/queue_request.cxx +65 -62
  326. package/deps/couchbase-cxx-client/core/mcbp/queue_request.hxx +54 -52
  327. package/deps/couchbase-cxx-client/core/mcbp/queue_request_connection_info.hxx +3 -3
  328. package/deps/couchbase-cxx-client/core/mcbp/queue_response.hxx +7 -7
  329. package/deps/couchbase-cxx-client/core/mcbp/read_units_frame.hxx +3 -2
  330. package/deps/couchbase-cxx-client/core/mcbp/server_duration.cxx +7 -7
  331. package/deps/couchbase-cxx-client/core/mcbp/server_duration_frame.hxx +3 -2
  332. package/deps/couchbase-cxx-client/core/mcbp/stream_id_frame.hxx +3 -2
  333. package/deps/couchbase-cxx-client/core/mcbp/unsupported_frame.hxx +4 -3
  334. package/deps/couchbase-cxx-client/core/mcbp/user_impersonation_frame.hxx +1 -1
  335. package/deps/couchbase-cxx-client/core/mcbp/write_units_frame.hxx +3 -2
  336. package/deps/couchbase-cxx-client/core/meta/features.hxx +58 -0
  337. package/deps/couchbase-cxx-client/core/meta/version.cxx +255 -204
  338. package/deps/couchbase-cxx-client/core/meta/version.hxx +31 -20
  339. package/deps/couchbase-cxx-client/core/metrics/logging_meter.cxx +160 -154
  340. package/deps/couchbase-cxx-client/core/metrics/logging_meter.hxx +16 -15
  341. package/deps/couchbase-cxx-client/core/metrics/logging_meter_options.hxx +1 -1
  342. package/deps/couchbase-cxx-client/core/metrics/noop_meter.hxx +14 -13
  343. package/deps/couchbase-cxx-client/core/mozilla_ca_bundle.hxx +2 -2
  344. package/deps/couchbase-cxx-client/core/n1ql_query_options.cxx +31 -31
  345. package/deps/couchbase-cxx-client/core/n1ql_query_options.hxx +22 -21
  346. package/deps/couchbase-cxx-client/core/operation_map.hxx +3 -3
  347. package/deps/couchbase-cxx-client/core/operations/document_analytics.cxx +187 -176
  348. package/deps/couchbase-cxx-client/core/operations/document_analytics.hxx +79 -71
  349. package/deps/couchbase-cxx-client/core/operations/document_append.cxx +18 -15
  350. package/deps/couchbase-cxx-client/core/operations/document_append.hxx +18 -16
  351. package/deps/couchbase-cxx-client/core/operations/document_decrement.cxx +26 -23
  352. package/deps/couchbase-cxx-client/core/operations/document_decrement.hxx +24 -20
  353. package/deps/couchbase-cxx-client/core/operations/document_exists.cxx +23 -21
  354. package/deps/couchbase-cxx-client/core/operations/document_exists.hxx +25 -23
  355. package/deps/couchbase-cxx-client/core/operations/document_get.cxx +17 -15
  356. package/deps/couchbase-cxx-client/core/operations/document_get.hxx +17 -15
  357. package/deps/couchbase-cxx-client/core/operations/document_get_all_replicas.hxx +121 -92
  358. package/deps/couchbase-cxx-client/core/operations/document_get_and_lock.cxx +19 -16
  359. package/deps/couchbase-cxx-client/core/operations/document_get_and_lock.hxx +21 -17
  360. package/deps/couchbase-cxx-client/core/operations/document_get_and_touch.cxx +19 -16
  361. package/deps/couchbase-cxx-client/core/operations/document_get_and_touch.hxx +22 -18
  362. package/deps/couchbase-cxx-client/core/operations/document_get_any_replica.hxx +111 -82
  363. package/deps/couchbase-cxx-client/core/operations/document_get_projected.cxx +193 -184
  364. package/deps/couchbase-cxx-client/core/operations/document_get_projected.hxx +25 -21
  365. package/deps/couchbase-cxx-client/core/operations/document_increment.cxx +26 -23
  366. package/deps/couchbase-cxx-client/core/operations/document_increment.hxx +24 -20
  367. package/deps/couchbase-cxx-client/core/operations/document_insert.cxx +23 -20
  368. package/deps/couchbase-cxx-client/core/operations/document_insert.hxx +20 -18
  369. package/deps/couchbase-cxx-client/core/operations/document_lookup_in.cxx +80 -67
  370. package/deps/couchbase-cxx-client/core/operations/document_lookup_in.hxx +31 -27
  371. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +187 -149
  372. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +190 -145
  373. package/deps/couchbase-cxx-client/core/operations/document_mutate_in.cxx +98 -80
  374. package/deps/couchbase-cxx-client/core/operations/document_mutate_in.hxx +38 -33
  375. package/deps/couchbase-cxx-client/core/operations/document_prepend.cxx +18 -15
  376. package/deps/couchbase-cxx-client/core/operations/document_prepend.hxx +18 -16
  377. package/deps/couchbase-cxx-client/core/operations/document_query.cxx +367 -356
  378. package/deps/couchbase-cxx-client/core/operations/document_query.hxx +83 -79
  379. package/deps/couchbase-cxx-client/core/operations/document_remove.cxx +18 -15
  380. package/deps/couchbase-cxx-client/core/operations/document_remove.hxx +18 -16
  381. package/deps/couchbase-cxx-client/core/operations/document_replace.cxx +27 -24
  382. package/deps/couchbase-cxx-client/core/operations/document_replace.hxx +22 -20
  383. package/deps/couchbase-cxx-client/core/operations/document_search.cxx +322 -308
  384. package/deps/couchbase-cxx-client/core/operations/document_search.hxx +125 -121
  385. package/deps/couchbase-cxx-client/core/operations/document_touch.cxx +16 -14
  386. package/deps/couchbase-cxx-client/core/operations/document_touch.hxx +19 -17
  387. package/deps/couchbase-cxx-client/core/operations/document_unlock.cxx +16 -14
  388. package/deps/couchbase-cxx-client/core/operations/document_unlock.hxx +19 -17
  389. package/deps/couchbase-cxx-client/core/operations/document_upsert.cxx +26 -23
  390. package/deps/couchbase-cxx-client/core/operations/document_upsert.hxx +21 -19
  391. package/deps/couchbase-cxx-client/core/operations/document_view.cxx +169 -159
  392. package/deps/couchbase-cxx-client/core/operations/document_view.hxx +68 -65
  393. package/deps/couchbase-cxx-client/core/operations/http_noop.cxx +38 -35
  394. package/deps/couchbase-cxx-client/core/operations/http_noop.hxx +12 -10
  395. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.cxx +58 -56
  396. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.hxx +20 -17
  397. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.cxx +49 -44
  398. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.hxx +18 -15
  399. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_get_all.cxx +46 -43
  400. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_get_all.hxx +16 -13
  401. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.cxx +48 -43
  402. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.hxx +17 -14
  403. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.cxx +48 -43
  404. package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.hxx +17 -14
  405. package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.cxx +38 -35
  406. package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.hxx +16 -14
  407. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_create.cxx +68 -66
  408. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_create.hxx +20 -17
  409. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.cxx +56 -51
  410. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.hxx +19 -16
  411. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_get_all.cxx +44 -42
  412. package/deps/couchbase-cxx-client/core/operations/management/analytics_index_get_all.hxx +16 -13
  413. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.cxx +49 -43
  414. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.hxx +23 -20
  415. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_create.cxx +52 -51
  416. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_create.hxx +33 -30
  417. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.cxx +46 -42
  418. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.hxx +22 -19
  419. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.cxx +70 -67
  420. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.hxx +22 -19
  421. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.cxx +92 -85
  422. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.hxx +27 -24
  423. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_replace.cxx +52 -51
  424. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_replace.hxx +33 -30
  425. package/deps/couchbase-cxx-client/core/operations/management/analytics_link_utils.hxx +6 -4
  426. package/deps/couchbase-cxx-client/core/operations/management/analytics_problem.hxx +2 -2
  427. package/deps/couchbase-cxx-client/core/operations/management/bucket_create.cxx +158 -149
  428. package/deps/couchbase-cxx-client/core/operations/management/bucket_create.hxx +14 -12
  429. package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.cxx +118 -42
  430. package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.hxx +47 -22
  431. package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.cxx +19 -18
  432. package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.hxx +13 -11
  433. package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.cxx +25 -24
  434. package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.hxx +13 -11
  435. package/deps/couchbase-cxx-client/core/operations/management/bucket_get.cxx +24 -22
  436. package/deps/couchbase-cxx-client/core/operations/management/bucket_get.hxx +14 -12
  437. package/deps/couchbase-cxx-client/core/operations/management/bucket_get_all.cxx +25 -23
  438. package/deps/couchbase-cxx-client/core/operations/management/bucket_get_all.hxx +13 -11
  439. package/deps/couchbase-cxx-client/core/operations/management/bucket_update.cxx +112 -107
  440. package/deps/couchbase-cxx-client/core/operations/management/bucket_update.hxx +15 -13
  441. package/deps/couchbase-cxx-client/core/operations/management/change_password.cxx +22 -20
  442. package/deps/couchbase-cxx-client/core/operations/management/change_password.hxx +13 -11
  443. package/deps/couchbase-cxx-client/core/operations/management/cluster_describe.cxx +52 -50
  444. package/deps/couchbase-cxx-client/core/operations/management/cluster_describe.hxx +31 -29
  445. package/deps/couchbase-cxx-client/core/operations/management/cluster_developer_preview_enable.cxx +14 -12
  446. package/deps/couchbase-cxx-client/core/operations/management/cluster_developer_preview_enable.hxx +13 -11
  447. package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +48 -46
  448. package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +19 -16
  449. package/deps/couchbase-cxx-client/core/operations/management/collection_drop.cxx +37 -35
  450. package/deps/couchbase-cxx-client/core/operations/management/collection_drop.hxx +16 -14
  451. package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +49 -47
  452. package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +19 -16
  453. package/deps/couchbase-cxx-client/core/operations/management/collections_manifest_get.cxx +11 -9
  454. package/deps/couchbase-cxx-client/core/operations/management/collections_manifest_get.hxx +17 -13
  455. package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +210 -198
  456. package/deps/couchbase-cxx-client/core/operations/management/error_utils.hxx +3 -1
  457. package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.cxx +30 -28
  458. package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.hxx +17 -14
  459. package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.cxx +31 -29
  460. package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.hxx +17 -14
  461. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_all_functions.cxx +49 -43
  462. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_all_functions.hxx +17 -14
  463. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.cxx +29 -27
  464. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.hxx +18 -15
  465. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_status.cxx +45 -39
  466. package/deps/couchbase-cxx-client/core/operations/management/eventing_get_status.hxx +17 -14
  467. package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.cxx +30 -28
  468. package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.hxx +17 -14
  469. package/deps/couchbase-cxx-client/core/operations/management/eventing_problem.hxx +3 -3
  470. package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.cxx +30 -28
  471. package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.hxx +17 -14
  472. package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.cxx +30 -28
  473. package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.hxx +17 -14
  474. package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.cxx +328 -318
  475. package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.hxx +17 -14
  476. package/deps/couchbase-cxx-client/core/operations/management/freeform.cxx +23 -22
  477. package/deps/couchbase-cxx-client/core/operations/management/freeform.hxx +19 -17
  478. package/deps/couchbase-cxx-client/core/operations/management/group_drop.cxx +18 -17
  479. package/deps/couchbase-cxx-client/core/operations/management/group_drop.hxx +13 -11
  480. package/deps/couchbase-cxx-client/core/operations/management/group_get.cxx +25 -23
  481. package/deps/couchbase-cxx-client/core/operations/management/group_get.hxx +14 -12
  482. package/deps/couchbase-cxx-client/core/operations/management/group_get_all.cxx +23 -22
  483. package/deps/couchbase-cxx-client/core/operations/management/group_get_all.hxx +13 -11
  484. package/deps/couchbase-cxx-client/core/operations/management/group_upsert.cxx +58 -55
  485. package/deps/couchbase-cxx-client/core/operations/management/group_upsert.hxx +14 -12
  486. package/deps/couchbase-cxx-client/core/operations/management/query_index_build.cxx +53 -48
  487. package/deps/couchbase-cxx-client/core/operations/management/query_index_build.hxx +25 -22
  488. package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +75 -67
  489. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +128 -122
  490. package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +31 -28
  491. package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.cxx +95 -93
  492. package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.hxx +26 -24
  493. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.cxx +97 -93
  494. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +24 -21
  495. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.cxx +66 -62
  496. package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.hxx +24 -22
  497. package/deps/couchbase-cxx-client/core/operations/management/role_get_all.cxx +24 -22
  498. package/deps/couchbase-cxx-client/core/operations/management/role_get_all.hxx +13 -11
  499. package/deps/couchbase-cxx-client/core/operations/management/scope_create.cxx +38 -36
  500. package/deps/couchbase-cxx-client/core/operations/management/scope_create.hxx +15 -13
  501. package/deps/couchbase-cxx-client/core/operations/management/scope_drop.cxx +33 -32
  502. package/deps/couchbase-cxx-client/core/operations/management/scope_drop.hxx +15 -13
  503. package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.cxx +27 -25
  504. package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.hxx +14 -12
  505. package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.cxx +12 -10
  506. package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.hxx +13 -11
  507. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +72 -67
  508. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +20 -18
  509. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +62 -59
  510. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +19 -16
  511. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +62 -59
  512. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +19 -17
  513. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +62 -59
  514. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +19 -16
  515. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +58 -55
  516. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +18 -15
  517. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +59 -56
  518. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +18 -16
  519. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +51 -46
  520. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +18 -15
  521. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +66 -61
  522. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +19 -17
  523. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.cxx +38 -36
  524. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.hxx +17 -14
  525. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +98 -95
  526. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +20 -17
  527. package/deps/couchbase-cxx-client/core/operations/management/user_drop.cxx +18 -17
  528. package/deps/couchbase-cxx-client/core/operations/management/user_drop.hxx +16 -12
  529. package/deps/couchbase-cxx-client/core/operations/management/user_get.cxx +25 -23
  530. package/deps/couchbase-cxx-client/core/operations/management/user_get.hxx +17 -13
  531. package/deps/couchbase-cxx-client/core/operations/management/user_get_all.cxx +24 -22
  532. package/deps/couchbase-cxx-client/core/operations/management/user_get_all.hxx +16 -12
  533. package/deps/couchbase-cxx-client/core/operations/management/user_upsert.cxx +63 -60
  534. package/deps/couchbase-cxx-client/core/operations/management/user_upsert.hxx +17 -13
  535. package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.cxx +16 -12
  536. package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.hxx +15 -13
  537. package/deps/couchbase-cxx-client/core/operations/management/view_index_get.cxx +40 -35
  538. package/deps/couchbase-cxx-client/core/operations/management/view_index_get.hxx +16 -14
  539. package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.cxx +73 -69
  540. package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.hxx +16 -13
  541. package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.cxx +39 -35
  542. package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.hxx +15 -12
  543. package/deps/couchbase-cxx-client/core/origin.cxx +259 -249
  544. package/deps/couchbase-cxx-client/core/origin.hxx +55 -49
  545. package/deps/couchbase-cxx-client/core/pending_operation.hxx +3 -3
  546. package/deps/couchbase-cxx-client/core/ping_collector.hxx +3 -3
  547. package/deps/couchbase-cxx-client/core/ping_options.hxx +30 -30
  548. package/deps/couchbase-cxx-client/core/ping_reporter.hxx +3 -3
  549. package/deps/couchbase-cxx-client/core/platform/backtrace.c +100 -91
  550. package/deps/couchbase-cxx-client/core/platform/base64.cc +135 -134
  551. package/deps/couchbase-cxx-client/core/platform/dirutils.cc +66 -63
  552. package/deps/couchbase-cxx-client/core/platform/random.cc +43 -42
  553. package/deps/couchbase-cxx-client/core/platform/random.h +4 -4
  554. package/deps/couchbase-cxx-client/core/platform/string_hex.cc +42 -40
  555. package/deps/couchbase-cxx-client/core/platform/terminate_handler.cc +54 -52
  556. package/deps/couchbase-cxx-client/core/platform/uuid.cc +47 -47
  557. package/deps/couchbase-cxx-client/core/protocol/client_opcode.hxx +336 -327
  558. package/deps/couchbase-cxx-client/core/protocol/client_opcode_fmt.hxx +291 -291
  559. package/deps/couchbase-cxx-client/core/protocol/client_request.cxx +13 -10
  560. package/deps/couchbase-cxx-client/core/protocol/client_request.hxx +133 -130
  561. package/deps/couchbase-cxx-client/core/protocol/client_response.cxx +40 -40
  562. package/deps/couchbase-cxx-client/core/protocol/client_response.hxx +153 -150
  563. package/deps/couchbase-cxx-client/core/protocol/cmd_append.cxx +24 -23
  564. package/deps/couchbase-cxx-client/core/protocol/cmd_append.hxx +65 -65
  565. package/deps/couchbase-cxx-client/core/protocol/cmd_cluster_map_change_notification.cxx +25 -21
  566. package/deps/couchbase-cxx-client/core/protocol/cmd_cluster_map_change_notification.hxx +33 -25
  567. package/deps/couchbase-cxx-client/core/protocol/cmd_decrement.cxx +38 -38
  568. package/deps/couchbase-cxx-client/core/protocol/cmd_decrement.hxx +87 -87
  569. package/deps/couchbase-cxx-client/core/protocol/cmd_get.cxx +17 -17
  570. package/deps/couchbase-cxx-client/core/protocol/cmd_get.hxx +59 -59
  571. package/deps/couchbase-cxx-client/core/protocol/cmd_get_and_lock.cxx +20 -20
  572. package/deps/couchbase-cxx-client/core/protocol/cmd_get_and_lock.hxx +72 -72
  573. package/deps/couchbase-cxx-client/core/protocol/cmd_get_and_touch.cxx +20 -20
  574. package/deps/couchbase-cxx-client/core/protocol/cmd_get_and_touch.hxx +72 -72
  575. package/deps/couchbase-cxx-client/core/protocol/cmd_get_cluster_config.cxx +46 -39
  576. package/deps/couchbase-cxx-client/core/protocol/cmd_get_cluster_config.hxx +57 -49
  577. package/deps/couchbase-cxx-client/core/protocol/cmd_get_collection_id.cxx +17 -17
  578. package/deps/couchbase-cxx-client/core/protocol/cmd_get_collection_id.hxx +59 -59
  579. package/deps/couchbase-cxx-client/core/protocol/cmd_get_collections_manifest.cxx +16 -14
  580. package/deps/couchbase-cxx-client/core/protocol/cmd_get_collections_manifest.hxx +39 -39
  581. package/deps/couchbase-cxx-client/core/protocol/cmd_get_error_map.cxx +18 -17
  582. package/deps/couchbase-cxx-client/core/protocol/cmd_get_error_map.hxx +62 -62
  583. package/deps/couchbase-cxx-client/core/protocol/cmd_get_meta.cxx +24 -23
  584. package/deps/couchbase-cxx-client/core/protocol/cmd_get_meta.hxx +81 -79
  585. package/deps/couchbase-cxx-client/core/protocol/cmd_get_replica.cxx +23 -23
  586. package/deps/couchbase-cxx-client/core/protocol/cmd_get_replica.hxx +44 -44
  587. package/deps/couchbase-cxx-client/core/protocol/cmd_hello.cxx +28 -27
  588. package/deps/couchbase-cxx-client/core/protocol/cmd_hello.hxx +106 -105
  589. package/deps/couchbase-cxx-client/core/protocol/cmd_increment.cxx +38 -38
  590. package/deps/couchbase-cxx-client/core/protocol/cmd_increment.hxx +87 -87
  591. package/deps/couchbase-cxx-client/core/protocol/cmd_info.hxx +3 -3
  592. package/deps/couchbase-cxx-client/core/protocol/cmd_insert.cxx +27 -27
  593. package/deps/couchbase-cxx-client/core/protocol/cmd_insert.hxx +81 -81
  594. package/deps/couchbase-cxx-client/core/protocol/cmd_lookup_in.cxx +54 -51
  595. package/deps/couchbase-cxx-client/core/protocol/cmd_lookup_in.hxx +90 -90
  596. package/deps/couchbase-cxx-client/core/protocol/cmd_lookup_in_replica.cxx +54 -51
  597. package/deps/couchbase-cxx-client/core/protocol/cmd_lookup_in_replica.hxx +88 -88
  598. package/deps/couchbase-cxx-client/core/protocol/cmd_mutate_in.cxx +105 -97
  599. package/deps/couchbase-cxx-client/core/protocol/cmd_mutate_in.hxx +161 -153
  600. package/deps/couchbase-cxx-client/core/protocol/cmd_noop.cxx +4 -4
  601. package/deps/couchbase-cxx-client/core/protocol/cmd_noop.hxx +32 -32
  602. package/deps/couchbase-cxx-client/core/protocol/cmd_observe_seqno.cxx +36 -34
  603. package/deps/couchbase-cxx-client/core/protocol/cmd_observe_seqno.hxx +89 -89
  604. package/deps/couchbase-cxx-client/core/protocol/cmd_prepend.cxx +22 -22
  605. package/deps/couchbase-cxx-client/core/protocol/cmd_prepend.hxx +63 -63
  606. package/deps/couchbase-cxx-client/core/protocol/cmd_remove.cxx +23 -23
  607. package/deps/couchbase-cxx-client/core/protocol/cmd_remove.hxx +54 -54
  608. package/deps/couchbase-cxx-client/core/protocol/cmd_replace.cxx +28 -28
  609. package/deps/couchbase-cxx-client/core/protocol/cmd_replace.hxx +88 -88
  610. package/deps/couchbase-cxx-client/core/protocol/cmd_sasl_auth.cxx +17 -15
  611. package/deps/couchbase-cxx-client/core/protocol/cmd_sasl_auth.hxx +56 -56
  612. package/deps/couchbase-cxx-client/core/protocol/cmd_sasl_list_mechs.cxx +24 -19
  613. package/deps/couchbase-cxx-client/core/protocol/cmd_sasl_list_mechs.hxx +39 -39
  614. package/deps/couchbase-cxx-client/core/protocol/cmd_sasl_step.cxx +17 -15
  615. package/deps/couchbase-cxx-client/core/protocol/cmd_sasl_step.hxx +56 -56
  616. package/deps/couchbase-cxx-client/core/protocol/cmd_select_bucket.cxx +6 -6
  617. package/deps/couchbase-cxx-client/core/protocol/cmd_select_bucket.hxx +36 -36
  618. package/deps/couchbase-cxx-client/core/protocol/cmd_touch.cxx +8 -8
  619. package/deps/couchbase-cxx-client/core/protocol/cmd_touch.hxx +38 -38
  620. package/deps/couchbase-cxx-client/core/protocol/cmd_unlock.cxx +5 -5
  621. package/deps/couchbase-cxx-client/core/protocol/cmd_unlock.hxx +36 -36
  622. package/deps/couchbase-cxx-client/core/protocol/cmd_upsert.cxx +28 -28
  623. package/deps/couchbase-cxx-client/core/protocol/cmd_upsert.hxx +83 -83
  624. package/deps/couchbase-cxx-client/core/protocol/datatype.hxx +19 -18
  625. package/deps/couchbase-cxx-client/core/protocol/frame_info_id.hxx +108 -103
  626. package/deps/couchbase-cxx-client/core/protocol/frame_info_id_fmt.hxx +45 -45
  627. package/deps/couchbase-cxx-client/core/protocol/frame_info_utils.cxx +24 -21
  628. package/deps/couchbase-cxx-client/core/protocol/frame_info_utils.hxx +3 -1
  629. package/deps/couchbase-cxx-client/core/protocol/hello_feature.hxx +211 -175
  630. package/deps/couchbase-cxx-client/core/protocol/hello_feature_fmt.hxx +93 -90
  631. package/deps/couchbase-cxx-client/core/protocol/magic.hxx +24 -24
  632. package/deps/couchbase-cxx-client/core/protocol/magic_fmt.hxx +30 -30
  633. package/deps/couchbase-cxx-client/core/protocol/server_opcode.hxx +11 -11
  634. package/deps/couchbase-cxx-client/core/protocol/server_opcode_fmt.hxx +18 -18
  635. package/deps/couchbase-cxx-client/core/protocol/server_request.hxx +90 -86
  636. package/deps/couchbase-cxx-client/core/protocol/status.cxx +138 -138
  637. package/deps/couchbase-cxx-client/core/protocol/status.hxx +86 -86
  638. package/deps/couchbase-cxx-client/core/query_context.hxx +44 -43
  639. package/deps/couchbase-cxx-client/core/range_scan_load_balancer.cxx +51 -50
  640. package/deps/couchbase-cxx-client/core/range_scan_load_balancer.hxx +26 -25
  641. package/deps/couchbase-cxx-client/core/range_scan_options.cxx +2 -2
  642. package/deps/couchbase-cxx-client/core/range_scan_options.hxx +62 -59
  643. package/deps/couchbase-cxx-client/core/range_scan_orchestrator.cxx +515 -470
  644. package/deps/couchbase-cxx-client/core/range_scan_orchestrator.hxx +23 -18
  645. package/deps/couchbase-cxx-client/core/range_scan_orchestrator_options.hxx +10 -10
  646. package/deps/couchbase-cxx-client/core/resource_units.hxx +2 -2
  647. package/deps/couchbase-cxx-client/core/response_handler.hxx +8 -8
  648. package/deps/couchbase-cxx-client/core/retry_orchestrator.cxx +27 -19
  649. package/deps/couchbase-cxx-client/core/retry_orchestrator.hxx +3 -2
  650. package/deps/couchbase-cxx-client/core/sasl/client.cc +22 -18
  651. package/deps/couchbase-cxx-client/core/sasl/client.h +66 -62
  652. package/deps/couchbase-cxx-client/core/sasl/context.cc +4 -4
  653. package/deps/couchbase-cxx-client/core/sasl/context.h +19 -19
  654. package/deps/couchbase-cxx-client/core/sasl/error.h +12 -1
  655. package/deps/couchbase-cxx-client/core/sasl/error_fmt.h +42 -42
  656. package/deps/couchbase-cxx-client/core/sasl/mechanism.cc +13 -10
  657. package/deps/couchbase-cxx-client/core/sasl/mechanism.h +8 -3
  658. package/deps/couchbase-cxx-client/core/sasl/plain/plain.cc +8 -8
  659. package/deps/couchbase-cxx-client/core/sasl/plain/plain.h +25 -24
  660. package/deps/couchbase-cxx-client/core/sasl/scram-sha/scram-sha.cc +225 -218
  661. package/deps/couchbase-cxx-client/core/sasl/scram-sha/scram-sha.h +133 -115
  662. package/deps/couchbase-cxx-client/core/sasl/scram-sha/stringutils.cc +20 -20
  663. package/deps/couchbase-cxx-client/core/scan_result.cxx +38 -38
  664. package/deps/couchbase-cxx-client/core/scan_result.hxx +16 -16
  665. package/deps/couchbase-cxx-client/core/search_highlight_style.hxx +4 -1
  666. package/deps/couchbase-cxx-client/core/search_query_options.cxx +21 -21
  667. package/deps/couchbase-cxx-client/core/search_query_options.hxx +19 -18
  668. package/deps/couchbase-cxx-client/core/search_scan_consistency.hxx +3 -1
  669. package/deps/couchbase-cxx-client/core/seed_config.cxx +10 -7
  670. package/deps/couchbase-cxx-client/core/seed_config.hxx +8 -8
  671. package/deps/couchbase-cxx-client/core/service_type.hxx +7 -7
  672. package/deps/couchbase-cxx-client/core/service_type_fmt.hxx +33 -33
  673. package/deps/couchbase-cxx-client/core/stats_options.hxx +13 -13
  674. package/deps/couchbase-cxx-client/core/subdoc_options.hxx +60 -58
  675. package/deps/couchbase-cxx-client/core/tls_verify_mode.hxx +2 -2
  676. package/deps/couchbase-cxx-client/core/topology/capabilities.hxx +83 -83
  677. package/deps/couchbase-cxx-client/core/topology/capabilities_fmt.hxx +111 -111
  678. package/deps/couchbase-cxx-client/core/topology/collections_manifest.hxx +14 -14
  679. package/deps/couchbase-cxx-client/core/topology/collections_manifest_fmt.hxx +23 -21
  680. package/deps/couchbase-cxx-client/core/topology/collections_manifest_json.hxx +26 -25
  681. package/deps/couchbase-cxx-client/core/topology/configuration.cxx +213 -192
  682. package/deps/couchbase-cxx-client/core/topology/configuration.hxx +104 -91
  683. package/deps/couchbase-cxx-client/core/topology/configuration_fmt.hxx +131 -128
  684. package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +276 -242
  685. package/deps/couchbase-cxx-client/core/topology/error_map.hxx +5 -5
  686. package/deps/couchbase-cxx-client/core/topology/error_map_json.hxx +65 -60
  687. package/deps/couchbase-cxx-client/core/tracing/constants.hxx +153 -153
  688. package/deps/couchbase-cxx-client/core/tracing/noop_tracer.hxx +29 -28
  689. package/deps/couchbase-cxx-client/core/tracing/threshold_logging_options.hxx +30 -30
  690. package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.cxx +354 -344
  691. package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.hxx +12 -12
  692. package/deps/couchbase-cxx-client/core/transactions/active_transaction_record.cxx +153 -33
  693. package/deps/couchbase-cxx-client/core/transactions/active_transaction_record.hxx +30 -118
  694. package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.cxx +8 -2
  695. package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.hxx +163 -127
  696. package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +358 -334
  697. package/deps/couchbase-cxx-client/core/transactions/atr_ids.cxx +270 -185
  698. package/deps/couchbase-cxx-client/core/transactions/atr_ids.hxx +4 -4
  699. package/deps/couchbase-cxx-client/core/transactions/attempt_context.cxx +9 -5
  700. package/deps/couchbase-cxx-client/core/transactions/attempt_context.hxx +194 -154
  701. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +3278 -2159
  702. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +446 -573
  703. package/deps/couchbase-cxx-client/core/transactions/attempt_context_testing_hooks.cxx +15 -10
  704. package/deps/couchbase-cxx-client/core/transactions/attempt_context_testing_hooks.hxx +58 -49
  705. package/deps/couchbase-cxx-client/core/transactions/attempt_state.hxx +72 -72
  706. package/deps/couchbase-cxx-client/core/transactions/binary.cxx +3 -3
  707. package/deps/couchbase-cxx-client/core/transactions/cleanup_testing_hooks.cxx +2 -2
  708. package/deps/couchbase-cxx-client/core/transactions/cleanup_testing_hooks.hxx +28 -24
  709. package/deps/couchbase-cxx-client/core/transactions/document_metadata.hxx +68 -68
  710. package/deps/couchbase-cxx-client/core/transactions/durability_level.hxx +53 -53
  711. package/deps/couchbase-cxx-client/core/transactions/error_class.hxx +12 -12
  712. package/deps/couchbase-cxx-client/core/transactions/error_list.hxx +22 -22
  713. package/deps/couchbase-cxx-client/core/transactions/exceptions.cxx +167 -114
  714. package/deps/couchbase-cxx-client/core/transactions/exceptions.hxx +170 -139
  715. package/deps/couchbase-cxx-client/core/transactions/exceptions_fmt.hxx +105 -0
  716. package/deps/couchbase-cxx-client/core/transactions/forward_compat.cxx +220 -0
  717. package/deps/couchbase-cxx-client/core/transactions/forward_compat.hxx +63 -207
  718. package/deps/couchbase-cxx-client/core/transactions/internal/atr_cleanup_entry.hxx +110 -102
  719. package/deps/couchbase-cxx-client/core/transactions/internal/atr_entry.hxx +144 -144
  720. package/deps/couchbase-cxx-client/core/transactions/internal/client_record.hxx +53 -50
  721. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.cxx +5 -5
  722. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.hxx +38 -35
  723. package/deps/couchbase-cxx-client/core/transactions/internal/doc_record_fmt.hxx +17 -16
  724. package/deps/couchbase-cxx-client/core/transactions/internal/exceptions_internal.hxx +238 -281
  725. package/deps/couchbase-cxx-client/core/transactions/internal/exceptions_internal_fmt.hxx +103 -0
  726. package/deps/couchbase-cxx-client/core/transactions/internal/logging.hxx +52 -29
  727. package/deps/couchbase-cxx-client/core/transactions/internal/transaction_attempt.hxx +3 -3
  728. package/deps/couchbase-cxx-client/core/transactions/internal/transaction_context.hxx +136 -120
  729. package/deps/couchbase-cxx-client/core/transactions/internal/transaction_fields.hxx +2 -1
  730. package/deps/couchbase-cxx-client/core/transactions/internal/transactions_cleanup.hxx +127 -122
  731. package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +244 -219
  732. package/deps/couchbase-cxx-client/core/transactions/result.cxx +41 -40
  733. package/deps/couchbase-cxx-client/core/transactions/result.hxx +143 -141
  734. package/deps/couchbase-cxx-client/core/transactions/result_fmt.hxx +21 -20
  735. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +759 -627
  736. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.hxx +175 -156
  737. package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +231 -179
  738. package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.cxx +185 -198
  739. package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.hxx +207 -222
  740. package/deps/couchbase-cxx-client/core/transactions/transaction_keyspace.cxx +15 -11
  741. package/deps/couchbase-cxx-client/core/transactions/transaction_links.cxx +11 -7
  742. package/deps/couchbase-cxx-client/core/transactions/transaction_links.hxx +222 -201
  743. package/deps/couchbase-cxx-client/core/transactions/transaction_options.cxx +44 -41
  744. package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +167 -125
  745. package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +491 -424
  746. package/deps/couchbase-cxx-client/core/transactions/transactions_config.cxx +25 -19
  747. package/deps/couchbase-cxx-client/core/transactions/uid_generator.cxx +3 -3
  748. package/deps/couchbase-cxx-client/core/transactions/uid_generator.hxx +2 -2
  749. package/deps/couchbase-cxx-client/core/transactions/utils.cxx +82 -69
  750. package/deps/couchbase-cxx-client/core/transactions/waitable_op_list.hxx +154 -140
  751. package/deps/couchbase-cxx-client/core/transactions.hxx +184 -180
  752. package/deps/couchbase-cxx-client/core/utils/binary.cxx +3 -3
  753. package/deps/couchbase-cxx-client/core/utils/binary.hxx +19 -15
  754. package/deps/couchbase-cxx-client/core/utils/byteswap.hxx +17 -17
  755. package/deps/couchbase-cxx-client/core/utils/connection_string.cxx +395 -328
  756. package/deps/couchbase-cxx-client/core/utils/connection_string.hxx +37 -36
  757. package/deps/couchbase-cxx-client/core/utils/crc32.hxx +42 -34
  758. package/deps/couchbase-cxx-client/core/utils/duration_parser.cxx +142 -133
  759. package/deps/couchbase-cxx-client/core/utils/duration_parser.hxx +9 -9
  760. package/deps/couchbase-cxx-client/core/utils/join_strings.hxx +24 -24
  761. package/deps/couchbase-cxx-client/core/utils/json.cxx +234 -228
  762. package/deps/couchbase-cxx-client/core/utils/json.hxx +12 -12
  763. package/deps/couchbase-cxx-client/core/utils/json_stream_control.hxx +8 -8
  764. package/deps/couchbase-cxx-client/core/utils/json_streaming_lexer.cxx +288 -263
  765. package/deps/couchbase-cxx-client/core/utils/json_streaming_lexer.hxx +20 -17
  766. package/deps/couchbase-cxx-client/core/utils/keyspace.hxx +22 -21
  767. package/deps/couchbase-cxx-client/core/utils/movable_function.hxx +78 -76
  768. package/deps/couchbase-cxx-client/core/utils/mutation_token.cxx +7 -3
  769. package/deps/couchbase-cxx-client/core/utils/mutation_token.hxx +3 -1
  770. package/deps/couchbase-cxx-client/core/utils/name_codec.hxx +13 -13
  771. package/deps/couchbase-cxx-client/core/utils/split_string.cxx +9 -9
  772. package/deps/couchbase-cxx-client/core/utils/split_string.hxx +2 -2
  773. package/deps/couchbase-cxx-client/core/utils/unsigned_leb128.hxx +92 -88
  774. package/deps/couchbase-cxx-client/core/utils/url_codec.cxx +301 -297
  775. package/deps/couchbase-cxx-client/core/utils/url_codec.hxx +35 -35
  776. package/deps/couchbase-cxx-client/core/vector_query_combination.hxx +4 -1
  777. package/deps/couchbase-cxx-client/core/view_on_error.hxx +4 -3
  778. package/deps/couchbase-cxx-client/core/view_query_options.cxx +21 -21
  779. package/deps/couchbase-cxx-client/core/view_query_options.hxx +23 -22
  780. package/deps/couchbase-cxx-client/core/view_scan_consistency.hxx +3 -3
  781. package/deps/couchbase-cxx-client/core/view_sort_order.hxx +4 -1
  782. package/deps/couchbase-cxx-client/core/wait_until_ready_options.hxx +11 -10
  783. package/deps/couchbase-cxx-client/couchbase/allow_querying_search_index_options.hxx +11 -11
  784. package/deps/couchbase-cxx-client/couchbase/analytics_index_manager.hxx +423 -405
  785. package/deps/couchbase-cxx-client/couchbase/analytics_meta_data.hxx +105 -105
  786. package/deps/couchbase-cxx-client/couchbase/analytics_metrics.hxx +120 -118
  787. package/deps/couchbase-cxx-client/couchbase/analytics_options.hxx +318 -292
  788. package/deps/couchbase-cxx-client/couchbase/analytics_result.hxx +56 -55
  789. package/deps/couchbase-cxx-client/couchbase/analytics_scan_consistency.hxx +24 -21
  790. package/deps/couchbase-cxx-client/couchbase/analytics_status.hxx +10 -10
  791. package/deps/couchbase-cxx-client/couchbase/analytics_warning.hxx +44 -43
  792. package/deps/couchbase-cxx-client/couchbase/analyze_document_options.hxx +9 -9
  793. package/deps/couchbase-cxx-client/couchbase/append_options.hxx +51 -47
  794. package/deps/couchbase-cxx-client/couchbase/behavior_options.hxx +75 -69
  795. package/deps/couchbase-cxx-client/couchbase/best_effort_retry_strategy.hxx +12 -10
  796. package/deps/couchbase-cxx-client/couchbase/binary_collection.hxx +213 -183
  797. package/deps/couchbase-cxx-client/couchbase/boolean_field_query.hxx +38 -38
  798. package/deps/couchbase-cxx-client/couchbase/boolean_query.hxx +166 -157
  799. package/deps/couchbase-cxx-client/couchbase/bucket.hxx +69 -68
  800. package/deps/couchbase-cxx-client/couchbase/bucket_manager.hxx +97 -88
  801. package/deps/couchbase-cxx-client/couchbase/build_query_index_options.hxx +22 -21
  802. package/deps/couchbase-cxx-client/couchbase/cas.hxx +74 -73
  803. package/deps/couchbase-cxx-client/couchbase/certificate_authenticator.hxx +10 -10
  804. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +266 -310
  805. package/deps/couchbase-cxx-client/couchbase/cluster_options.hxx +235 -241
  806. package/deps/couchbase-cxx-client/couchbase/codec/binary_noop_serializer.hxx +11 -11
  807. package/deps/couchbase-cxx-client/couchbase/codec/codec_flags.hxx +39 -35
  808. package/deps/couchbase-cxx-client/couchbase/codec/encoded_value.hxx +15 -2
  809. package/deps/couchbase-cxx-client/couchbase/codec/json_transcoder.hxx +17 -15
  810. package/deps/couchbase-cxx-client/couchbase/codec/raw_binary_transcoder.hxx +19 -17
  811. package/deps/couchbase-cxx-client/couchbase/codec/raw_json_transcoder.hxx +31 -24
  812. package/deps/couchbase-cxx-client/couchbase/codec/raw_string_transcoder.hxx +20 -18
  813. package/deps/couchbase-cxx-client/couchbase/codec/tao_json_serializer.hxx +38 -30
  814. package/deps/couchbase-cxx-client/couchbase/collection.hxx +1007 -902
  815. package/deps/couchbase-cxx-client/couchbase/collection_manager.hxx +115 -107
  816. package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +200 -188
  817. package/deps/couchbase-cxx-client/couchbase/common_durability_options.hxx +68 -62
  818. package/deps/couchbase-cxx-client/couchbase/common_options.hxx +67 -67
  819. package/deps/couchbase-cxx-client/couchbase/compression_options.hxx +33 -33
  820. package/deps/couchbase-cxx-client/couchbase/configuration_profile.hxx +12 -11
  821. package/deps/couchbase-cxx-client/couchbase/configuration_profiles_registry.hxx +24 -22
  822. package/deps/couchbase-cxx-client/couchbase/conjunction_query.hxx +47 -45
  823. package/deps/couchbase-cxx-client/couchbase/connect_link_analytics_options.hxx +74 -72
  824. package/deps/couchbase-cxx-client/couchbase/counter_result.hxx +32 -32
  825. package/deps/couchbase-cxx-client/couchbase/create_bucket_options.hxx +9 -10
  826. package/deps/couchbase-cxx-client/couchbase/create_collection_options.hxx +35 -34
  827. package/deps/couchbase-cxx-client/couchbase/create_dataset_analytics_options.hxx +76 -76
  828. package/deps/couchbase-cxx-client/couchbase/create_dataverse_analytics_options.hxx +44 -44
  829. package/deps/couchbase-cxx-client/couchbase/create_index_analytics_options.hxx +60 -60
  830. package/deps/couchbase-cxx-client/couchbase/create_link_analytics_options.hxx +25 -25
  831. package/deps/couchbase-cxx-client/couchbase/create_primary_query_index_options.hxx +95 -94
  832. package/deps/couchbase-cxx-client/couchbase/create_query_index_options.hxx +97 -96
  833. package/deps/couchbase-cxx-client/couchbase/create_scope_options.hxx +9 -9
  834. package/deps/couchbase-cxx-client/couchbase/date_range.hxx +29 -27
  835. package/deps/couchbase-cxx-client/couchbase/date_range_facet.hxx +20 -20
  836. package/deps/couchbase-cxx-client/couchbase/date_range_facet_result.hxx +14 -14
  837. package/deps/couchbase-cxx-client/couchbase/date_range_query.hxx +219 -205
  838. package/deps/couchbase-cxx-client/couchbase/decrement_options.hxx +93 -91
  839. package/deps/couchbase-cxx-client/couchbase/diagnostics_options.hxx +42 -41
  840. package/deps/couchbase-cxx-client/couchbase/diagnostics_result.hxx +82 -83
  841. package/deps/couchbase-cxx-client/couchbase/disallow_querying_search_index_options.hxx +11 -10
  842. package/deps/couchbase-cxx-client/couchbase/disconnect_link_analytics_options.hxx +62 -62
  843. package/deps/couchbase-cxx-client/couchbase/disjunction_query.hxx +61 -60
  844. package/deps/couchbase-cxx-client/couchbase/dns_options.hxx +30 -30
  845. package/deps/couchbase-cxx-client/couchbase/doc_id_query.hxx +69 -69
  846. package/deps/couchbase-cxx-client/couchbase/drop_bucket_options.hxx +9 -9
  847. package/deps/couchbase-cxx-client/couchbase/drop_collection_options.hxx +9 -9
  848. package/deps/couchbase-cxx-client/couchbase/drop_dataset_analytics_options.hxx +60 -60
  849. package/deps/couchbase-cxx-client/couchbase/drop_dataverse_analytics_options.hxx +44 -44
  850. package/deps/couchbase-cxx-client/couchbase/drop_index_analytics_options.hxx +60 -60
  851. package/deps/couchbase-cxx-client/couchbase/drop_link_analytics_options.hxx +25 -25
  852. package/deps/couchbase-cxx-client/couchbase/drop_primary_query_index_options.hxx +58 -58
  853. package/deps/couchbase-cxx-client/couchbase/drop_query_index_options.hxx +44 -44
  854. package/deps/couchbase-cxx-client/couchbase/drop_scope_options.hxx +9 -9
  855. package/deps/couchbase-cxx-client/couchbase/drop_search_index_options.hxx +9 -9
  856. package/deps/couchbase-cxx-client/couchbase/durability_level.hxx +32 -29
  857. package/deps/couchbase-cxx-client/couchbase/endpoint_diagnostics.hxx +171 -171
  858. package/deps/couchbase-cxx-client/couchbase/endpoint_ping_report.hxx +166 -169
  859. package/deps/couchbase-cxx-client/couchbase/error.hxx +51 -0
  860. package/deps/couchbase-cxx-client/couchbase/error_codes.hxx +975 -940
  861. package/deps/couchbase-cxx-client/couchbase/error_context.hxx +19 -152
  862. package/deps/couchbase-cxx-client/couchbase/exists_options.hxx +25 -24
  863. package/deps/couchbase-cxx-client/couchbase/exists_result.hxx +32 -32
  864. package/deps/couchbase-cxx-client/couchbase/fail_fast_retry_strategy.hxx +4 -4
  865. package/deps/couchbase-cxx-client/couchbase/flush_bucket_options.hxx +9 -9
  866. package/deps/couchbase-cxx-client/couchbase/fmt/analytics_scan_consistency.hxx +18 -18
  867. package/deps/couchbase-cxx-client/couchbase/fmt/analytics_status.hxx +42 -42
  868. package/deps/couchbase-cxx-client/couchbase/fmt/cas.hxx +10 -10
  869. package/deps/couchbase-cxx-client/couchbase/fmt/durability_level.hxx +24 -24
  870. package/deps/couchbase-cxx-client/couchbase/fmt/error.hxx +53 -0
  871. package/deps/couchbase-cxx-client/couchbase/fmt/error_context.hxx +43 -0
  872. package/deps/couchbase-cxx-client/couchbase/fmt/mutation_token.hxx +15 -11
  873. package/deps/couchbase-cxx-client/couchbase/fmt/query_profile.hxx +21 -21
  874. package/deps/couchbase-cxx-client/couchbase/fmt/query_scan_consistency.hxx +18 -18
  875. package/deps/couchbase-cxx-client/couchbase/fmt/query_status.hxx +42 -42
  876. package/deps/couchbase-cxx-client/couchbase/fmt/retry_reason.hxx +75 -75
  877. package/deps/couchbase-cxx-client/couchbase/fmt/search_scan_consistency.hxx +15 -15
  878. package/deps/couchbase-cxx-client/couchbase/fmt/tls_verify_mode.hxx +18 -18
  879. package/deps/couchbase-cxx-client/couchbase/fmt/transaction_keyspace.hxx +15 -11
  880. package/deps/couchbase-cxx-client/couchbase/fork_event.hxx +12 -12
  881. package/deps/couchbase-cxx-client/couchbase/freeze_plan_search_index_options.hxx +9 -9
  882. package/deps/couchbase-cxx-client/couchbase/geo_bounding_box_query.hxx +71 -64
  883. package/deps/couchbase-cxx-client/couchbase/geo_distance_query.hxx +73 -66
  884. package/deps/couchbase-cxx-client/couchbase/geo_point.hxx +2 -2
  885. package/deps/couchbase-cxx-client/couchbase/geo_polygon_query.hxx +40 -39
  886. package/deps/couchbase-cxx-client/couchbase/get_all_buckets_options.hxx +9 -9
  887. package/deps/couchbase-cxx-client/couchbase/get_all_datasets_analytics_options.hxx +25 -25
  888. package/deps/couchbase-cxx-client/couchbase/get_all_indexes_analytics_options.hxx +26 -25
  889. package/deps/couchbase-cxx-client/couchbase/get_all_query_indexes_options.hxx +27 -25
  890. package/deps/couchbase-cxx-client/couchbase/get_all_replicas_options.hxx +49 -26
  891. package/deps/couchbase-cxx-client/couchbase/get_all_scopes_options.hxx +9 -9
  892. package/deps/couchbase-cxx-client/couchbase/get_all_search_indexes_options.hxx +9 -9
  893. package/deps/couchbase-cxx-client/couchbase/get_and_lock_options.hxx +25 -24
  894. package/deps/couchbase-cxx-client/couchbase/get_and_touch_options.hxx +25 -24
  895. package/deps/couchbase-cxx-client/couchbase/get_any_replica_options.hxx +49 -26
  896. package/deps/couchbase-cxx-client/couchbase/get_bucket_options.hxx +9 -9
  897. package/deps/couchbase-cxx-client/couchbase/get_indexed_search_index_options.hxx +9 -9
  898. package/deps/couchbase-cxx-client/couchbase/get_links_analytics_options.hxx +74 -74
  899. package/deps/couchbase-cxx-client/couchbase/get_options.hxx +63 -60
  900. package/deps/couchbase-cxx-client/couchbase/get_pending_mutations_analytics_options.hxx +30 -28
  901. package/deps/couchbase-cxx-client/couchbase/get_replica_result.hxx +79 -75
  902. package/deps/couchbase-cxx-client/couchbase/get_result.hxx +86 -80
  903. package/deps/couchbase-cxx-client/couchbase/get_search_index_options.hxx +9 -9
  904. package/deps/couchbase-cxx-client/couchbase/highlight_style.hxx +14 -14
  905. package/deps/couchbase-cxx-client/couchbase/increment_options.hxx +94 -91
  906. package/deps/couchbase-cxx-client/couchbase/insert_options.hxx +62 -59
  907. package/deps/couchbase-cxx-client/couchbase/ip_protocol.hxx +3 -3
  908. package/deps/couchbase-cxx-client/couchbase/logger.hxx +51 -0
  909. package/deps/couchbase-cxx-client/couchbase/lookup_in_all_replicas_options.hxx +54 -43
  910. package/deps/couchbase-cxx-client/couchbase/lookup_in_any_replica_options.hxx +54 -44
  911. package/deps/couchbase-cxx-client/couchbase/lookup_in_options.hxx +40 -40
  912. package/deps/couchbase-cxx-client/couchbase/lookup_in_replica_result.hxx +38 -35
  913. package/deps/couchbase-cxx-client/couchbase/lookup_in_result.hxx +222 -216
  914. package/deps/couchbase-cxx-client/couchbase/lookup_in_specs.hxx +101 -101
  915. package/deps/couchbase-cxx-client/couchbase/management/analytics_dataset.hxx +16 -16
  916. package/deps/couchbase-cxx-client/couchbase/management/analytics_index.hxx +16 -16
  917. package/deps/couchbase-cxx-client/couchbase/management/analytics_link.hxx +193 -189
  918. package/deps/couchbase-cxx-client/couchbase/management/bucket_settings.hxx +91 -75
  919. package/deps/couchbase-cxx-client/couchbase/management/collection_spec.hxx +4 -4
  920. package/deps/couchbase-cxx-client/couchbase/management/query_index.hxx +10 -10
  921. package/deps/couchbase-cxx-client/couchbase/management/scope_spec.hxx +2 -2
  922. package/deps/couchbase-cxx-client/couchbase/management/search_index.hxx +9 -9
  923. package/deps/couchbase-cxx-client/couchbase/match_all_query.hxx +10 -9
  924. package/deps/couchbase-cxx-client/couchbase/match_none_query.hxx +10 -9
  925. package/deps/couchbase-cxx-client/couchbase/match_operator.hxx +15 -14
  926. package/deps/couchbase-cxx-client/couchbase/match_phrase_query.hxx +70 -65
  927. package/deps/couchbase-cxx-client/couchbase/match_query.hxx +115 -114
  928. package/deps/couchbase-cxx-client/couchbase/metrics/meter.hxx +33 -30
  929. package/deps/couchbase-cxx-client/couchbase/metrics/otel_meter.hxx +86 -74
  930. package/deps/couchbase-cxx-client/couchbase/metrics_options.hxx +34 -34
  931. package/deps/couchbase-cxx-client/couchbase/mutate_in_options.hxx +160 -149
  932. package/deps/couchbase-cxx-client/couchbase/mutate_in_result.hxx +130 -123
  933. package/deps/couchbase-cxx-client/couchbase/mutate_in_specs.hxx +473 -454
  934. package/deps/couchbase-cxx-client/couchbase/mutation_result.hxx +32 -32
  935. package/deps/couchbase-cxx-client/couchbase/mutation_state.hxx +35 -34
  936. package/deps/couchbase-cxx-client/couchbase/mutation_token.hxx +78 -78
  937. package/deps/couchbase-cxx-client/couchbase/network_options.hxx +101 -72
  938. package/deps/couchbase-cxx-client/couchbase/numeric_range.hxx +26 -26
  939. package/deps/couchbase-cxx-client/couchbase/numeric_range_facet.hxx +20 -20
  940. package/deps/couchbase-cxx-client/couchbase/numeric_range_facet_result.hxx +14 -14
  941. package/deps/couchbase-cxx-client/couchbase/numeric_range_query.hxx +97 -95
  942. package/deps/couchbase-cxx-client/couchbase/password_authenticator.hxx +17 -17
  943. package/deps/couchbase-cxx-client/couchbase/pause_ingest_search_index_options.hxx +11 -10
  944. package/deps/couchbase-cxx-client/couchbase/persist_to.hxx +45 -44
  945. package/deps/couchbase-cxx-client/couchbase/phrase_query.hxx +69 -65
  946. package/deps/couchbase-cxx-client/couchbase/ping_options.hxx +55 -54
  947. package/deps/couchbase-cxx-client/couchbase/ping_result.hxx +79 -77
  948. package/deps/couchbase-cxx-client/couchbase/prefix_query.hxx +43 -40
  949. package/deps/couchbase-cxx-client/couchbase/prepend_options.hxx +51 -47
  950. package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +207 -199
  951. package/deps/couchbase-cxx-client/couchbase/query_meta_data.hxx +120 -120
  952. package/deps/couchbase-cxx-client/couchbase/query_metrics.hxx +135 -133
  953. package/deps/couchbase-cxx-client/couchbase/query_options.hxx +518 -493
  954. package/deps/couchbase-cxx-client/couchbase/query_profile.hxx +29 -26
  955. package/deps/couchbase-cxx-client/couchbase/query_result.hxx +56 -55
  956. package/deps/couchbase-cxx-client/couchbase/query_scan_consistency.hxx +24 -21
  957. package/deps/couchbase-cxx-client/couchbase/query_status.hxx +10 -10
  958. package/deps/couchbase-cxx-client/couchbase/query_string_query.hxx +34 -29
  959. package/deps/couchbase-cxx-client/couchbase/query_warning.hxx +75 -71
  960. package/deps/couchbase-cxx-client/couchbase/read_preference.hxx +58 -0
  961. package/deps/couchbase-cxx-client/couchbase/regexp_query.hxx +40 -39
  962. package/deps/couchbase-cxx-client/couchbase/remove_options.hxx +51 -47
  963. package/deps/couchbase-cxx-client/couchbase/replace_link_analytics_options.hxx +25 -25
  964. package/deps/couchbase-cxx-client/couchbase/replace_options.hxx +112 -104
  965. package/deps/couchbase-cxx-client/couchbase/replicate_to.hxx +28 -28
  966. package/deps/couchbase-cxx-client/couchbase/result.hxx +28 -28
  967. package/deps/couchbase-cxx-client/couchbase/resume_ingest_search_index_options.hxx +11 -10
  968. package/deps/couchbase-cxx-client/couchbase/retry_action.hxx +10 -10
  969. package/deps/couchbase-cxx-client/couchbase/retry_reason.hxx +53 -51
  970. package/deps/couchbase-cxx-client/couchbase/retry_request.hxx +7 -7
  971. package/deps/couchbase-cxx-client/couchbase/retry_strategy.hxx +4 -4
  972. package/deps/couchbase-cxx-client/couchbase/scan_options.hxx +114 -108
  973. package/deps/couchbase-cxx-client/couchbase/scan_result.hxx +97 -96
  974. package/deps/couchbase-cxx-client/couchbase/scan_result_item.hxx +120 -118
  975. package/deps/couchbase-cxx-client/couchbase/scan_type.hxx +237 -232
  976. package/deps/couchbase-cxx-client/couchbase/scope.hxx +164 -157
  977. package/deps/couchbase-cxx-client/couchbase/scope_search_index_manager.hxx +263 -238
  978. package/deps/couchbase-cxx-client/couchbase/search_date_range.hxx +32 -29
  979. package/deps/couchbase-cxx-client/couchbase/search_facet.hxx +25 -25
  980. package/deps/couchbase-cxx-client/couchbase/search_facet_result.hxx +11 -11
  981. package/deps/couchbase-cxx-client/couchbase/search_geo_distance_units.hxx +11 -1
  982. package/deps/couchbase-cxx-client/couchbase/search_index_manager.hxx +261 -238
  983. package/deps/couchbase-cxx-client/couchbase/search_meta_data.hxx +37 -37
  984. package/deps/couchbase-cxx-client/couchbase/search_metrics.hxx +84 -83
  985. package/deps/couchbase-cxx-client/couchbase/search_numeric_range.hxx +32 -32
  986. package/deps/couchbase-cxx-client/couchbase/search_options.hxx +449 -435
  987. package/deps/couchbase-cxx-client/couchbase/search_query.hxx +32 -30
  988. package/deps/couchbase-cxx-client/couchbase/search_request.hxx +69 -68
  989. package/deps/couchbase-cxx-client/couchbase/search_result.hxx +29 -26
  990. package/deps/couchbase-cxx-client/couchbase/search_row.hxx +52 -52
  991. package/deps/couchbase-cxx-client/couchbase/search_row_location.hxx +20 -20
  992. package/deps/couchbase-cxx-client/couchbase/search_row_locations.hxx +39 -38
  993. package/deps/couchbase-cxx-client/couchbase/search_scan_consistency.hxx +11 -10
  994. package/deps/couchbase-cxx-client/couchbase/search_sort.hxx +20 -20
  995. package/deps/couchbase-cxx-client/couchbase/search_sort_field.hxx +77 -71
  996. package/deps/couchbase-cxx-client/couchbase/search_sort_field_missing.hxx +2 -2
  997. package/deps/couchbase-cxx-client/couchbase/search_sort_field_mode.hxx +3 -3
  998. package/deps/couchbase-cxx-client/couchbase/search_sort_field_type.hxx +4 -4
  999. package/deps/couchbase-cxx-client/couchbase/search_sort_geo_distance.hxx +41 -41
  1000. package/deps/couchbase-cxx-client/couchbase/search_sort_id.hxx +23 -23
  1001. package/deps/couchbase-cxx-client/couchbase/search_sort_score.hxx +23 -23
  1002. package/deps/couchbase-cxx-client/couchbase/search_term_range.hxx +17 -17
  1003. package/deps/couchbase-cxx-client/couchbase/security_options.hxx +50 -50
  1004. package/deps/couchbase-cxx-client/couchbase/service_type.hxx +34 -34
  1005. package/deps/couchbase-cxx-client/couchbase/store_semantics.hxx +28 -28
  1006. package/deps/couchbase-cxx-client/couchbase/subdoc/array_add_unique.hxx +54 -54
  1007. package/deps/couchbase-cxx-client/couchbase/subdoc/array_append.hxx +40 -40
  1008. package/deps/couchbase-cxx-client/couchbase/subdoc/array_insert.hxx +41 -41
  1009. package/deps/couchbase-cxx-client/couchbase/subdoc/array_prepend.hxx +41 -41
  1010. package/deps/couchbase-cxx-client/couchbase/subdoc/count.hxx +24 -24
  1011. package/deps/couchbase-cxx-client/couchbase/subdoc/counter.hxx +41 -41
  1012. package/deps/couchbase-cxx-client/couchbase/subdoc/exists.hxx +24 -24
  1013. package/deps/couchbase-cxx-client/couchbase/subdoc/get.hxx +45 -29
  1014. package/deps/couchbase-cxx-client/couchbase/subdoc/insert.hxx +70 -54
  1015. package/deps/couchbase-cxx-client/couchbase/subdoc/lookup_in_macro.hxx +13 -12
  1016. package/deps/couchbase-cxx-client/couchbase/subdoc/mutate_in_macro.hxx +7 -2
  1017. package/deps/couchbase-cxx-client/couchbase/subdoc/remove.hxx +24 -24
  1018. package/deps/couchbase-cxx-client/couchbase/subdoc/replace.hxx +55 -39
  1019. package/deps/couchbase-cxx-client/couchbase/subdoc/upsert.hxx +70 -54
  1020. package/deps/couchbase-cxx-client/couchbase/term_facet.hxx +16 -16
  1021. package/deps/couchbase-cxx-client/couchbase/term_facet_result.hxx +14 -14
  1022. package/deps/couchbase-cxx-client/couchbase/term_query.hxx +107 -104
  1023. package/deps/couchbase-cxx-client/couchbase/term_range_query.hxx +99 -96
  1024. package/deps/couchbase-cxx-client/couchbase/timeout_options.hxx +118 -112
  1025. package/deps/couchbase-cxx-client/couchbase/tls_verify_mode.hxx +2 -2
  1026. package/deps/couchbase-cxx-client/couchbase/touch_options.hxx +25 -24
  1027. package/deps/couchbase-cxx-client/couchbase/tracing/otel_tracer.hxx +45 -44
  1028. package/deps/couchbase-cxx-client/couchbase/tracing/request_span.hxx +34 -34
  1029. package/deps/couchbase-cxx-client/couchbase/tracing/request_tracer.hxx +27 -25
  1030. package/deps/couchbase-cxx-client/couchbase/tracing_options.hxx +147 -142
  1031. package/deps/couchbase-cxx-client/couchbase/transactions/async_attempt_context.hxx +149 -115
  1032. package/deps/couchbase-cxx-client/couchbase/transactions/attempt_context.hxx +146 -95
  1033. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_get_result.hxx +52 -80
  1034. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_keyspace.hxx +33 -29
  1035. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +101 -96
  1036. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +228 -223
  1037. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_result.hxx +11 -12
  1038. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_result.hxx +2 -3
  1039. package/deps/couchbase-cxx-client/couchbase/transactions/transactions_cleanup_config.hxx +105 -104
  1040. package/deps/couchbase-cxx-client/couchbase/transactions/transactions_config.hxx +191 -187
  1041. package/deps/couchbase-cxx-client/couchbase/transactions/transactions_query_config.hxx +32 -32
  1042. package/deps/couchbase-cxx-client/couchbase/transactions.hxx +56 -37
  1043. package/deps/couchbase-cxx-client/couchbase/unfreeze_plan_search_index_options.hxx +11 -10
  1044. package/deps/couchbase-cxx-client/couchbase/unlock_options.hxx +25 -24
  1045. package/deps/couchbase-cxx-client/couchbase/update_bucket_options.hxx +9 -9
  1046. package/deps/couchbase-cxx-client/couchbase/update_collection_options.hxx +35 -34
  1047. package/deps/couchbase-cxx-client/couchbase/upsert_options.hxx +85 -80
  1048. package/deps/couchbase-cxx-client/couchbase/upsert_search_index_options.hxx +9 -9
  1049. package/deps/couchbase-cxx-client/couchbase/vector_query.hxx +82 -62
  1050. package/deps/couchbase-cxx-client/couchbase/vector_search.hxx +51 -47
  1051. package/deps/couchbase-cxx-client/couchbase/vector_search_options.hxx +45 -41
  1052. package/deps/couchbase-cxx-client/couchbase/wan_development_configuration_profile.hxx +13 -13
  1053. package/deps/couchbase-cxx-client/couchbase/watch_query_indexes_options.hxx +41 -41
  1054. package/deps/couchbase-cxx-client/couchbase/wildcard_query.hxx +42 -41
  1055. package/deps/couchbase-cxx-client/third_party/expected/include/tl/expected.hpp +1746 -1584
  1056. package/deps/couchbase-cxx-client/third_party/jsonsl/jsonsl.c +2664 -2638
  1057. package/deps/couchbase-cxx-client/third_party/jsonsl/jsonsl.h +359 -342
  1058. package/dist/binding.d.ts +39 -4
  1059. package/dist/binding.js +4 -1
  1060. package/dist/collection.js +0 -1
  1061. package/dist/diagnosticstypes.js +2 -2
  1062. package/dist/searchtypes.d.ts +0 -4
  1063. package/dist/searchtypes.js +0 -4
  1064. package/dist/transactions.d.ts +1 -0
  1065. package/dist/transactions.js +12 -2
  1066. package/dist/vectorsearch.d.ts +4 -19
  1067. package/dist/vectorsearch.js +24 -19
  1068. package/package.json +29 -28
  1069. package/src/constants.cpp +111 -75
  1070. package/src/jstocbpp_autogen.hpp +146 -15
  1071. package/src/jstocbpp_basic.hpp +23 -0
  1072. package/src/jstocbpp_errors.hpp +9 -9
  1073. package/src/jstocbpp_transactions.hpp +17 -12
  1074. package/src/transaction.cpp +10 -5
  1075. package/tools/gen-bindings-js.js +1 -0
  1076. package/tools/gen-bindings-json.py +5 -2
  1077. package/deps/couchbase-cxx-cache/asio/41f31469d0dd420500b334dc8c2fd3ffe7320d8e/asio/asio/COPYING +0 -4
  1078. package/deps/couchbase-cxx-cache/asio/41f31469d0dd420500b334dc8c2fd3ffe7320d8e/asio/asio/README +0 -4
  1079. package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/crypto/obj/README +0 -15
  1080. package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/crypto/perlasm/readme +0 -100
  1081. package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/pki/testdata/nist-pkits/README.chromium +0 -19
  1082. package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/pki/testdata/ssl/certificates/README +0 -318
  1083. package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/pki/testdata/verify_certificate_chain_unittest/README +0 -87
  1084. package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/pki/testdata/verify_signed_data_unittest/README +0 -35
  1085. package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/third_party/fiat/README.chromium +0 -11
  1086. package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/util/bot/README +0 -3
  1087. package/deps/couchbase-cxx-cache/fmt/d3c862243fcf1c41b4c09903f35479bd42f135b7/fmt/support/README +0 -4
  1088. package/deps/couchbase-cxx-client/core/impl/internal_manager_error_context.cxx +0 -113
  1089. package/deps/couchbase-cxx-client/core/impl/internal_manager_error_context.hxx +0 -60
  1090. package/deps/couchbase-cxx-client/core/impl/manager_error_context.cxx +0 -100
  1091. package/deps/couchbase-cxx-client/core/impl/search_error_context.cxx +0 -147
  1092. package/deps/couchbase-cxx-client/couchbase/analytics_error_context.hxx +0 -143
  1093. package/deps/couchbase-cxx-client/couchbase/fmt/key_value_error_map_attribute.hxx +0 -100
  1094. package/deps/couchbase-cxx-client/couchbase/fmt/key_value_status_code.hxx +0 -269
  1095. package/deps/couchbase-cxx-client/couchbase/key_value_error_context.hxx +0 -229
  1096. package/deps/couchbase-cxx-client/couchbase/key_value_error_map_attribute.hxx +0 -136
  1097. package/deps/couchbase-cxx-client/couchbase/key_value_error_map_info.hxx +0 -138
  1098. package/deps/couchbase-cxx-client/couchbase/key_value_extended_error_info.hxx +0 -86
  1099. package/deps/couchbase-cxx-client/couchbase/key_value_status_code.hxx +0 -109
  1100. package/deps/couchbase-cxx-client/couchbase/manager_error_context.hxx +0 -111
  1101. package/deps/couchbase-cxx-client/couchbase/query_error_context.hxx +0 -145
  1102. package/deps/couchbase-cxx-client/couchbase/search_error_context.hxx +0 -138
  1103. package/deps/couchbase-cxx-client/couchbase/subdocument_error_context.hxx +0 -147
  1104. package/deps/couchbase-cxx-client/couchbase/transaction_op_error_context.hxx +0 -76
@@ -80,7 +80,8 @@ struct is_trivially_copy_constructible<std::vector<T, A>> : std::false_type {
80
80
  } // namespace tl
81
81
  #endif
82
82
 
83
- #define TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) tl::detail::is_trivially_copy_constructible<T>
83
+ #define TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) \
84
+ tl::detail::is_trivially_copy_constructible<T>
84
85
  #define TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(T) std::is_trivially_copy_assignable<T>
85
86
  #define TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(T) std::is_trivially_destructible<T>
86
87
  #else
@@ -117,7 +118,7 @@ class monostate
117
118
  };
118
119
 
119
120
  struct in_place_t {
120
- explicit in_place_t() = default;
121
+ explicit in_place_t() = default;
121
122
  };
122
123
  static constexpr in_place_t in_place{};
123
124
  #endif
@@ -125,87 +126,87 @@ static constexpr in_place_t in_place{};
125
126
  template<class E>
126
127
  class unexpected
127
128
  {
128
- public:
129
- static_assert(!std::is_same<E, void>::value, "E must not be void");
130
-
131
- unexpected() = delete;
132
- constexpr explicit unexpected(const E& e)
133
- : m_val(e)
134
- {
135
- }
136
-
137
- constexpr explicit unexpected(E&& e)
138
- : m_val(std::move(e))
139
- {
140
- }
141
-
142
- constexpr const E& value() const&
143
- {
144
- return m_val;
145
- }
146
- TL_EXPECTED_11_CONSTEXPR E& value() &
147
- {
148
- return m_val;
149
- }
150
- TL_EXPECTED_11_CONSTEXPR E&& value() &&
151
- {
152
- return std::move(m_val);
153
- }
154
- constexpr const E&& value() const&&
155
- {
156
- return std::move(m_val);
157
- }
158
-
159
- private:
160
- E m_val;
129
+ public:
130
+ static_assert(!std::is_same<E, void>::value, "E must not be void");
131
+
132
+ unexpected() = delete;
133
+ constexpr explicit unexpected(const E& e)
134
+ : m_val(e)
135
+ {
136
+ }
137
+
138
+ constexpr explicit unexpected(E&& e)
139
+ : m_val(std::move(e))
140
+ {
141
+ }
142
+
143
+ constexpr const E& value() const&
144
+ {
145
+ return m_val;
146
+ }
147
+ TL_EXPECTED_11_CONSTEXPR E& value() &
148
+ {
149
+ return m_val;
150
+ }
151
+ TL_EXPECTED_11_CONSTEXPR E&& value() &&
152
+ {
153
+ return std::move(m_val);
154
+ }
155
+ constexpr const E&& value() const&&
156
+ {
157
+ return std::move(m_val);
158
+ }
159
+
160
+ private:
161
+ E m_val;
161
162
  };
162
163
 
163
164
  template<class E>
164
165
  constexpr bool
165
166
  operator==(const unexpected<E>& lhs, const unexpected<E>& rhs)
166
167
  {
167
- return lhs.value() == rhs.value();
168
+ return lhs.value() == rhs.value();
168
169
  }
169
170
  template<class E>
170
171
  constexpr bool
171
172
  operator!=(const unexpected<E>& lhs, const unexpected<E>& rhs)
172
173
  {
173
- return lhs.value() != rhs.value();
174
+ return lhs.value() != rhs.value();
174
175
  }
175
176
  template<class E>
176
177
  constexpr bool
177
178
  operator<(const unexpected<E>& lhs, const unexpected<E>& rhs)
178
179
  {
179
- return lhs.value() < rhs.value();
180
+ return lhs.value() < rhs.value();
180
181
  }
181
182
  template<class E>
182
183
  constexpr bool
183
184
  operator<=(const unexpected<E>& lhs, const unexpected<E>& rhs)
184
185
  {
185
- return lhs.value() <= rhs.value();
186
+ return lhs.value() <= rhs.value();
186
187
  }
187
188
  template<class E>
188
189
  constexpr bool
189
190
  operator>(const unexpected<E>& lhs, const unexpected<E>& rhs)
190
191
  {
191
- return lhs.value() > rhs.value();
192
+ return lhs.value() > rhs.value();
192
193
  }
193
194
  template<class E>
194
195
  constexpr bool
195
196
  operator>=(const unexpected<E>& lhs, const unexpected<E>& rhs)
196
197
  {
197
- return lhs.value() >= rhs.value();
198
+ return lhs.value() >= rhs.value();
198
199
  }
199
200
 
200
201
  template<class E>
201
202
  unexpected<typename std::decay<E>::type>
202
203
  make_unexpected(E&& e)
203
204
  {
204
- return unexpected<typename std::decay<E>::type>(std::forward<E>(e));
205
+ return unexpected<typename std::decay<E>::type>(std::forward<E>(e));
205
206
  }
206
207
 
207
208
  struct unexpect_t {
208
- unexpect_t() = default;
209
+ unexpect_t() = default;
209
210
  };
210
211
  static constexpr unexpect_t unexpect{};
211
212
 
@@ -216,12 +217,12 @@ template<typename E>
216
217
  throw_exception(E&& e)
217
218
  {
218
219
  #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
219
- throw std::forward<E>(e);
220
+ throw std::forward<E>(e);
220
221
  #else
221
222
  #ifdef _MSC_VER
222
- __assume(0);
223
+ __assume(0);
223
224
  #else
224
- __builtin_unreachable();
225
+ __builtin_unreachable();
225
226
  #endif
226
227
  #endif
227
228
  }
@@ -297,7 +298,8 @@ struct is_const_or_const_ref<T const> : std::true_type {
297
298
  template<typename Fn,
298
299
  typename... Args,
299
300
  #ifdef TL_TRAITS_LIBCXX_MEM_FN_WORKAROUND
300
- typename = enable_if_t<!(is_pointer_to_non_const_member_func<Fn>::value && is_const_or_const_ref<Args...>::value)>,
301
+ typename = enable_if_t<!(is_pointer_to_non_const_member_func<Fn>::value &&
302
+ is_const_or_const_ref<Args...>::value)>,
301
303
  #endif
302
304
  typename = enable_if_t<std::is_member_pointer<decay_t<Fn>>::value>,
303
305
  int = 0>
@@ -305,15 +307,17 @@ constexpr auto
305
307
  invoke(Fn&& f, Args&&... args) noexcept(noexcept(std::mem_fn(f)(std::forward<Args>(args)...)))
306
308
  -> decltype(std::mem_fn(f)(std::forward<Args>(args)...))
307
309
  {
308
- return std::mem_fn(f)(std::forward<Args>(args)...);
310
+ return std::mem_fn(f)(std::forward<Args>(args)...);
309
311
  }
310
312
 
311
- template<typename Fn, typename... Args, typename = enable_if_t<!std::is_member_pointer<decay_t<Fn>>::value>>
313
+ template<typename Fn,
314
+ typename... Args,
315
+ typename = enable_if_t<!std::is_member_pointer<decay_t<Fn>>::value>>
312
316
  constexpr auto
313
317
  invoke(Fn&& f, Args&&... args) noexcept(noexcept(std::forward<Fn>(f)(std::forward<Args>(args)...)))
314
318
  -> decltype(std::forward<Fn>(f)(std::forward<Args>(args)...))
315
319
  {
316
- return std::forward<Fn>(f)(std::forward<Args>(args)...);
320
+ return std::forward<Fn>(f)(std::forward<Args>(args)...);
317
321
  }
318
322
 
319
323
  // std::invoke_result from C++17
@@ -321,8 +325,11 @@ template<class F, class, class... Us>
321
325
  struct invoke_result_impl;
322
326
 
323
327
  template<class F, class... Us>
324
- struct invoke_result_impl<F, decltype(detail::invoke(std::declval<F>(), std::declval<Us>()...), void()), Us...> {
325
- using type = decltype(detail::invoke(std::declval<F>(), std::declval<Us>()...));
328
+ struct invoke_result_impl<F,
329
+ decltype(detail::invoke(std::declval<F>(), std::declval<Us>()...),
330
+ void()),
331
+ Us...> {
332
+ using type = decltype(detail::invoke(std::declval<F>(), std::declval<Us>()...));
326
333
  };
327
334
 
328
335
  template<class F, class... Us>
@@ -373,7 +380,9 @@ uses_std(int);
373
380
 
374
381
  template<class T>
375
382
  struct is_std_swap_noexcept
376
- : std::integral_constant<bool, std::is_nothrow_move_constructible<T>::value && std::is_nothrow_move_assignable<T>::value> {
383
+ : std::integral_constant<bool,
384
+ std::is_nothrow_move_constructible<T>::value &&
385
+ std::is_nothrow_move_assignable<T>::value> {
377
386
  };
378
387
 
379
388
  template<class T, std::size_t N>
@@ -390,23 +399,26 @@ struct is_swappable
390
399
  : std::integral_constant<bool,
391
400
  decltype(detail::swap_adl_tests::can_swap<T, U>(0))::value &&
392
401
  (!decltype(detail::swap_adl_tests::uses_std<T, U>(0))::value ||
393
- (std::is_move_assignable<T>::value && std::is_move_constructible<T>::value))> {
402
+ (std::is_move_assignable<T>::value &&
403
+ std::is_move_constructible<T>::value))> {
394
404
  };
395
405
 
396
406
  template<class T, std::size_t N>
397
407
  struct is_swappable<T[N], T[N]>
398
408
  : std::integral_constant<bool,
399
409
  decltype(detail::swap_adl_tests::can_swap<T[N], T[N]>(0))::value &&
400
- (!decltype(detail::swap_adl_tests::uses_std<T[N], T[N]>(0))::value || is_swappable<T, T>::value)> {
410
+ (!decltype(detail::swap_adl_tests::uses_std<T[N], T[N]>(0))::value ||
411
+ is_swappable<T, T>::value)> {
401
412
  };
402
413
 
403
414
  template<class T, class U = T>
404
415
  struct is_nothrow_swappable
405
- : std::integral_constant<
406
- bool,
407
- is_swappable<T, U>::value &&
408
- ((decltype(detail::swap_adl_tests::uses_std<T, U>(0))::value&& detail::swap_adl_tests::is_std_swap_noexcept<T>::value) ||
409
- (!decltype(detail::swap_adl_tests::uses_std<T, U>(0))::value&& detail::swap_adl_tests::is_adl_swap_noexcept<T, U>::value))> {
416
+ : std::integral_constant<bool,
417
+ is_swappable<T, U>::value &&
418
+ ((decltype(detail::swap_adl_tests::uses_std<T, U>(0))::value &&
419
+ detail::swap_adl_tests::is_std_swap_noexcept<T>::value) ||
420
+ (!decltype(detail::swap_adl_tests::uses_std<T, U>(0))::value &&
421
+ detail::swap_adl_tests::is_adl_swap_noexcept<T, U>::value))> {
410
422
  };
411
423
  #endif
412
424
  #endif
@@ -423,16 +435,22 @@ using is_expected = is_expected_impl<decay_t<T>>;
423
435
 
424
436
  template<class T, class E, class U>
425
437
  using expected_enable_forward_value =
426
- detail::enable_if_t<std::is_constructible<T, U&&>::value && !std::is_same<detail::decay_t<U>, in_place_t>::value &&
427
- !std::is_same<expected<T, E>, detail::decay_t<U>>::value && !std::is_same<unexpected<E>, detail::decay_t<U>>::value>;
438
+ detail::enable_if_t<std::is_constructible<T, U&&>::value &&
439
+ !std::is_same<detail::decay_t<U>, in_place_t>::value &&
440
+ !std::is_same<expected<T, E>, detail::decay_t<U>>::value &&
441
+ !std::is_same<unexpected<E>, detail::decay_t<U>>::value>;
428
442
 
429
443
  template<class T, class E, class U, class G, class UR, class GR>
430
444
  using expected_enable_from_other =
431
445
  detail::enable_if_t<std::is_constructible<T, UR>::value && std::is_constructible<E, GR>::value &&
432
- !std::is_constructible<T, expected<U, G>&>::value && !std::is_constructible<T, expected<U, G>&&>::value &&
433
- !std::is_constructible<T, const expected<U, G>&>::value && !std::is_constructible<T, const expected<U, G>&&>::value &&
434
- !std::is_convertible<expected<U, G>&, T>::value && !std::is_convertible<expected<U, G>&&, T>::value &&
435
- !std::is_convertible<const expected<U, G>&, T>::value && !std::is_convertible<const expected<U, G>&&, T>::value>;
446
+ !std::is_constructible<T, expected<U, G>&>::value &&
447
+ !std::is_constructible<T, expected<U, G>&&>::value &&
448
+ !std::is_constructible<T, const expected<U, G>&>::value &&
449
+ !std::is_constructible<T, const expected<U, G>&&>::value &&
450
+ !std::is_convertible<expected<U, G>&, T>::value &&
451
+ !std::is_convertible<expected<U, G>&&, T>::value &&
452
+ !std::is_convertible<const expected<U, G>&, T>::value &&
453
+ !std::is_convertible<const expected<U, G>&&, T>::value>;
436
454
 
437
455
  template<class T, class U>
438
456
  using is_void_or = conditional_t<std::is_void<T>::value, std::true_type, U>;
@@ -463,631 +481,679 @@ static constexpr no_init_t no_init{};
463
481
  // This specialization is for where neither `T` or `E` is trivially
464
482
  // destructible, so the destructors must be called on destruction of the
465
483
  // `expected`
466
- template<class T, class E, bool = std::is_trivially_destructible<T>::value, bool = std::is_trivially_destructible<E>::value>
484
+ template<class T,
485
+ class E,
486
+ bool = std::is_trivially_destructible<T>::value,
487
+ bool = std::is_trivially_destructible<E>::value>
467
488
  struct expected_storage_base {
468
- constexpr expected_storage_base()
469
- : m_val(T{})
470
- , m_has_val(true)
471
- {
472
- }
473
- constexpr expected_storage_base(no_init_t)
474
- : m_no_init()
475
- , m_has_val(false)
476
- {
477
- }
478
-
479
- template<class... Args, detail::enable_if_t<std::is_constructible<T, Args&&...>::value>* = nullptr>
480
- constexpr expected_storage_base(in_place_t, Args&&... args)
481
- : m_val(std::forward<Args>(args)...)
482
- , m_has_val(true)
483
- {
484
- }
485
-
486
- template<class U, class... Args, detail::enable_if_t<std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
487
- constexpr expected_storage_base(in_place_t, std::initializer_list<U> il, Args&&... args)
488
- : m_val(il, std::forward<Args>(args)...)
489
- , m_has_val(true)
490
- {
491
- }
492
- template<class... Args, detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
493
- constexpr explicit expected_storage_base(unexpect_t, Args&&... args)
494
- : m_unexpect(std::forward<Args>(args)...)
495
- , m_has_val(false)
496
- {
497
- }
498
-
499
- template<class U, class... Args, detail::enable_if_t<std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
500
- constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args&&... args)
501
- : m_unexpect(il, std::forward<Args>(args)...)
502
- , m_has_val(false)
503
- {
504
- }
505
-
506
- ~expected_storage_base()
507
- {
508
- if (m_has_val) {
509
- m_val.~T();
510
- } else {
511
- m_unexpect.~unexpected<E>();
512
- }
513
- }
514
- union {
515
- T m_val;
516
- unexpected<E> m_unexpect;
517
- char m_no_init;
518
- };
519
- bool m_has_val;
489
+ constexpr expected_storage_base()
490
+ : m_val(T{})
491
+ , m_has_val(true)
492
+ {
493
+ }
494
+ constexpr expected_storage_base(no_init_t)
495
+ : m_no_init()
496
+ , m_has_val(false)
497
+ {
498
+ }
499
+
500
+ template<class... Args,
501
+ detail::enable_if_t<std::is_constructible<T, Args&&...>::value>* = nullptr>
502
+ constexpr expected_storage_base(in_place_t, Args&&... args)
503
+ : m_val(std::forward<Args>(args)...)
504
+ , m_has_val(true)
505
+ {
506
+ }
507
+
508
+ template<class U,
509
+ class... Args,
510
+ detail::enable_if_t<
511
+ std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
512
+ constexpr expected_storage_base(in_place_t, std::initializer_list<U> il, Args&&... args)
513
+ : m_val(il, std::forward<Args>(args)...)
514
+ , m_has_val(true)
515
+ {
516
+ }
517
+ template<class... Args,
518
+ detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
519
+ constexpr explicit expected_storage_base(unexpect_t, Args&&... args)
520
+ : m_unexpect(std::forward<Args>(args)...)
521
+ , m_has_val(false)
522
+ {
523
+ }
524
+
525
+ template<class U,
526
+ class... Args,
527
+ detail::enable_if_t<
528
+ std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
529
+ constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args&&... args)
530
+ : m_unexpect(il, std::forward<Args>(args)...)
531
+ , m_has_val(false)
532
+ {
533
+ }
534
+
535
+ ~expected_storage_base()
536
+ {
537
+ if (m_has_val) {
538
+ m_val.~T();
539
+ } else {
540
+ m_unexpect.~unexpected<E>();
541
+ }
542
+ }
543
+ union {
544
+ T m_val;
545
+ unexpected<E> m_unexpect;
546
+ char m_no_init;
547
+ };
548
+ bool m_has_val;
520
549
  };
521
550
 
522
551
  // This specialization is for when both `T` and `E` are trivially-destructible,
523
552
  // so the destructor of the `expected` can be trivial.
524
553
  template<class T, class E>
525
554
  struct expected_storage_base<T, E, true, true> {
526
- constexpr expected_storage_base()
527
- : m_val(T{})
528
- , m_has_val(true)
529
- {
530
- }
531
- constexpr expected_storage_base(no_init_t)
532
- : m_no_init()
533
- , m_has_val(false)
534
- {
535
- }
536
-
537
- template<class... Args, detail::enable_if_t<std::is_constructible<T, Args&&...>::value>* = nullptr>
538
- constexpr expected_storage_base(in_place_t, Args&&... args)
539
- : m_val(std::forward<Args>(args)...)
540
- , m_has_val(true)
541
- {
542
- }
543
-
544
- template<class U, class... Args, detail::enable_if_t<std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
545
- constexpr expected_storage_base(in_place_t, std::initializer_list<U> il, Args&&... args)
546
- : m_val(il, std::forward<Args>(args)...)
547
- , m_has_val(true)
548
- {
549
- }
550
- template<class... Args, detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
551
- constexpr explicit expected_storage_base(unexpect_t, Args&&... args)
552
- : m_unexpect(std::forward<Args>(args)...)
553
- , m_has_val(false)
554
- {
555
- }
556
-
557
- template<class U, class... Args, detail::enable_if_t<std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
558
- constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args&&... args)
559
- : m_unexpect(il, std::forward<Args>(args)...)
560
- , m_has_val(false)
561
- {
562
- }
563
-
564
- ~expected_storage_base() = default;
565
- union {
566
- T m_val;
567
- unexpected<E> m_unexpect;
568
- char m_no_init;
569
- };
570
- bool m_has_val;
555
+ constexpr expected_storage_base()
556
+ : m_val(T{})
557
+ , m_has_val(true)
558
+ {
559
+ }
560
+ constexpr expected_storage_base(no_init_t)
561
+ : m_no_init()
562
+ , m_has_val(false)
563
+ {
564
+ }
565
+
566
+ template<class... Args,
567
+ detail::enable_if_t<std::is_constructible<T, Args&&...>::value>* = nullptr>
568
+ constexpr expected_storage_base(in_place_t, Args&&... args)
569
+ : m_val(std::forward<Args>(args)...)
570
+ , m_has_val(true)
571
+ {
572
+ }
573
+
574
+ template<class U,
575
+ class... Args,
576
+ detail::enable_if_t<
577
+ std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
578
+ constexpr expected_storage_base(in_place_t, std::initializer_list<U> il, Args&&... args)
579
+ : m_val(il, std::forward<Args>(args)...)
580
+ , m_has_val(true)
581
+ {
582
+ }
583
+ template<class... Args,
584
+ detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
585
+ constexpr explicit expected_storage_base(unexpect_t, Args&&... args)
586
+ : m_unexpect(std::forward<Args>(args)...)
587
+ , m_has_val(false)
588
+ {
589
+ }
590
+
591
+ template<class U,
592
+ class... Args,
593
+ detail::enable_if_t<
594
+ std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
595
+ constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args&&... args)
596
+ : m_unexpect(il, std::forward<Args>(args)...)
597
+ , m_has_val(false)
598
+ {
599
+ }
600
+
601
+ ~expected_storage_base() = default;
602
+ union {
603
+ T m_val;
604
+ unexpected<E> m_unexpect;
605
+ char m_no_init;
606
+ };
607
+ bool m_has_val;
571
608
  };
572
609
 
573
610
  // T is trivial, E is not.
574
611
  template<class T, class E>
575
612
  struct expected_storage_base<T, E, true, false> {
576
- constexpr expected_storage_base()
577
- : m_val(T{})
578
- , m_has_val(true)
579
- {
580
- }
581
- TL_EXPECTED_MSVC2015_CONSTEXPR expected_storage_base(no_init_t)
582
- : m_no_init()
583
- , m_has_val(false)
584
- {
585
- }
586
-
587
- template<class... Args, detail::enable_if_t<std::is_constructible<T, Args&&...>::value>* = nullptr>
588
- constexpr expected_storage_base(in_place_t, Args&&... args)
589
- : m_val(std::forward<Args>(args)...)
590
- , m_has_val(true)
591
- {
592
- }
593
-
594
- template<class U, class... Args, detail::enable_if_t<std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
595
- constexpr expected_storage_base(in_place_t, std::initializer_list<U> il, Args&&... args)
596
- : m_val(il, std::forward<Args>(args)...)
597
- , m_has_val(true)
598
- {
599
- }
600
- template<class... Args, detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
601
- constexpr explicit expected_storage_base(unexpect_t, Args&&... args)
602
- : m_unexpect(std::forward<Args>(args)...)
603
- , m_has_val(false)
604
- {
605
- }
606
-
607
- template<class U, class... Args, detail::enable_if_t<std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
608
- constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args&&... args)
609
- : m_unexpect(il, std::forward<Args>(args)...)
610
- , m_has_val(false)
611
- {
612
- }
613
-
614
- ~expected_storage_base()
615
- {
616
- if (!m_has_val) {
617
- m_unexpect.~unexpected<E>();
618
- }
619
- }
620
-
621
- union {
622
- T m_val;
623
- unexpected<E> m_unexpect;
624
- char m_no_init;
625
- };
626
- bool m_has_val;
613
+ constexpr expected_storage_base()
614
+ : m_val(T{})
615
+ , m_has_val(true)
616
+ {
617
+ }
618
+ TL_EXPECTED_MSVC2015_CONSTEXPR expected_storage_base(no_init_t)
619
+ : m_no_init()
620
+ , m_has_val(false)
621
+ {
622
+ }
623
+
624
+ template<class... Args,
625
+ detail::enable_if_t<std::is_constructible<T, Args&&...>::value>* = nullptr>
626
+ constexpr expected_storage_base(in_place_t, Args&&... args)
627
+ : m_val(std::forward<Args>(args)...)
628
+ , m_has_val(true)
629
+ {
630
+ }
631
+
632
+ template<class U,
633
+ class... Args,
634
+ detail::enable_if_t<
635
+ std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
636
+ constexpr expected_storage_base(in_place_t, std::initializer_list<U> il, Args&&... args)
637
+ : m_val(il, std::forward<Args>(args)...)
638
+ , m_has_val(true)
639
+ {
640
+ }
641
+ template<class... Args,
642
+ detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
643
+ constexpr explicit expected_storage_base(unexpect_t, Args&&... args)
644
+ : m_unexpect(std::forward<Args>(args)...)
645
+ , m_has_val(false)
646
+ {
647
+ }
648
+
649
+ template<class U,
650
+ class... Args,
651
+ detail::enable_if_t<
652
+ std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
653
+ constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args&&... args)
654
+ : m_unexpect(il, std::forward<Args>(args)...)
655
+ , m_has_val(false)
656
+ {
657
+ }
658
+
659
+ ~expected_storage_base()
660
+ {
661
+ if (!m_has_val) {
662
+ m_unexpect.~unexpected<E>();
663
+ }
664
+ }
665
+
666
+ union {
667
+ T m_val;
668
+ unexpected<E> m_unexpect;
669
+ char m_no_init;
670
+ };
671
+ bool m_has_val;
627
672
  };
628
673
 
629
674
  // E is trivial, T is not.
630
675
  template<class T, class E>
631
676
  struct expected_storage_base<T, E, false, true> {
632
- constexpr expected_storage_base()
633
- : m_val(T{})
634
- , m_has_val(true)
635
- {
636
- }
637
- constexpr expected_storage_base(no_init_t)
638
- : m_no_init()
639
- , m_has_val(false)
640
- {
641
- }
642
-
643
- template<class... Args, detail::enable_if_t<std::is_constructible<T, Args&&...>::value>* = nullptr>
644
- constexpr expected_storage_base(in_place_t, Args&&... args)
645
- : m_val(std::forward<Args>(args)...)
646
- , m_has_val(true)
647
- {
648
- }
649
-
650
- template<class U, class... Args, detail::enable_if_t<std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
651
- constexpr expected_storage_base(in_place_t, std::initializer_list<U> il, Args&&... args)
652
- : m_val(il, std::forward<Args>(args)...)
653
- , m_has_val(true)
654
- {
655
- }
656
- template<class... Args, detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
657
- constexpr explicit expected_storage_base(unexpect_t, Args&&... args)
658
- : m_unexpect(std::forward<Args>(args)...)
659
- , m_has_val(false)
660
- {
661
- }
662
-
663
- template<class U, class... Args, detail::enable_if_t<std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
664
- constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args&&... args)
665
- : m_unexpect(il, std::forward<Args>(args)...)
666
- , m_has_val(false)
667
- {
668
- }
669
-
670
- ~expected_storage_base()
671
- {
672
- if (m_has_val) {
673
- m_val.~T();
674
- }
675
- }
676
- union {
677
- T m_val;
678
- unexpected<E> m_unexpect;
679
- char m_no_init;
680
- };
681
- bool m_has_val;
677
+ constexpr expected_storage_base()
678
+ : m_val(T{})
679
+ , m_has_val(true)
680
+ {
681
+ }
682
+ constexpr expected_storage_base(no_init_t)
683
+ : m_no_init()
684
+ , m_has_val(false)
685
+ {
686
+ }
687
+
688
+ template<class... Args,
689
+ detail::enable_if_t<std::is_constructible<T, Args&&...>::value>* = nullptr>
690
+ constexpr expected_storage_base(in_place_t, Args&&... args)
691
+ : m_val(std::forward<Args>(args)...)
692
+ , m_has_val(true)
693
+ {
694
+ }
695
+
696
+ template<class U,
697
+ class... Args,
698
+ detail::enable_if_t<
699
+ std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
700
+ constexpr expected_storage_base(in_place_t, std::initializer_list<U> il, Args&&... args)
701
+ : m_val(il, std::forward<Args>(args)...)
702
+ , m_has_val(true)
703
+ {
704
+ }
705
+ template<class... Args,
706
+ detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
707
+ constexpr explicit expected_storage_base(unexpect_t, Args&&... args)
708
+ : m_unexpect(std::forward<Args>(args)...)
709
+ , m_has_val(false)
710
+ {
711
+ }
712
+
713
+ template<class U,
714
+ class... Args,
715
+ detail::enable_if_t<
716
+ std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
717
+ constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args&&... args)
718
+ : m_unexpect(il, std::forward<Args>(args)...)
719
+ , m_has_val(false)
720
+ {
721
+ }
722
+
723
+ ~expected_storage_base()
724
+ {
725
+ if (m_has_val) {
726
+ m_val.~T();
727
+ }
728
+ }
729
+ union {
730
+ T m_val;
731
+ unexpected<E> m_unexpect;
732
+ char m_no_init;
733
+ };
734
+ bool m_has_val;
682
735
  };
683
736
 
684
737
  // `T` is `void`, `E` is trivially-destructible
685
738
  template<class E>
686
739
  struct expected_storage_base<void, E, false, true> {
687
- TL_EXPECTED_MSVC2015_CONSTEXPR expected_storage_base()
688
- : m_has_val(true)
689
- {
690
- }
691
- constexpr expected_storage_base(no_init_t)
692
- : m_val()
693
- , m_has_val(false)
694
- {
695
- }
696
-
697
- constexpr expected_storage_base(in_place_t)
698
- : m_has_val(true)
699
- {
700
- }
701
-
702
- template<class... Args, detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
703
- constexpr explicit expected_storage_base(unexpect_t, Args&&... args)
704
- : m_unexpect(std::forward<Args>(args)...)
705
- , m_has_val(false)
706
- {
707
- }
708
-
709
- template<class U, class... Args, detail::enable_if_t<std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
710
- constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args&&... args)
711
- : m_unexpect(il, std::forward<Args>(args)...)
712
- , m_has_val(false)
713
- {
714
- }
715
-
716
- ~expected_storage_base() = default;
717
- struct dummy {
718
- };
719
- union {
720
- unexpected<E> m_unexpect;
721
- dummy m_val;
722
- };
723
- bool m_has_val;
740
+ TL_EXPECTED_MSVC2015_CONSTEXPR expected_storage_base()
741
+ : m_has_val(true)
742
+ {
743
+ }
744
+ constexpr expected_storage_base(no_init_t)
745
+ : m_val()
746
+ , m_has_val(false)
747
+ {
748
+ }
749
+
750
+ constexpr expected_storage_base(in_place_t)
751
+ : m_has_val(true)
752
+ {
753
+ }
754
+
755
+ template<class... Args,
756
+ detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
757
+ constexpr explicit expected_storage_base(unexpect_t, Args&&... args)
758
+ : m_unexpect(std::forward<Args>(args)...)
759
+ , m_has_val(false)
760
+ {
761
+ }
762
+
763
+ template<class U,
764
+ class... Args,
765
+ detail::enable_if_t<
766
+ std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
767
+ constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args&&... args)
768
+ : m_unexpect(il, std::forward<Args>(args)...)
769
+ , m_has_val(false)
770
+ {
771
+ }
772
+
773
+ ~expected_storage_base() = default;
774
+ struct dummy {
775
+ };
776
+ union {
777
+ unexpected<E> m_unexpect;
778
+ dummy m_val;
779
+ };
780
+ bool m_has_val;
724
781
  };
725
782
 
726
783
  // `T` is `void`, `E` is not trivially-destructible
727
784
  template<class E>
728
785
  struct expected_storage_base<void, E, false, false> {
729
- constexpr expected_storage_base()
730
- : m_dummy()
731
- , m_has_val(true)
732
- {
733
- }
734
- constexpr expected_storage_base(no_init_t)
735
- : m_dummy()
736
- , m_has_val(false)
737
- {
738
- }
739
-
740
- constexpr expected_storage_base(in_place_t)
741
- : m_dummy()
742
- , m_has_val(true)
743
- {
744
- }
745
-
746
- template<class... Args, detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
747
- constexpr explicit expected_storage_base(unexpect_t, Args&&... args)
748
- : m_unexpect(std::forward<Args>(args)...)
749
- , m_has_val(false)
750
- {
751
- }
752
-
753
- template<class U, class... Args, detail::enable_if_t<std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
754
- constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args&&... args)
755
- : m_unexpect(il, std::forward<Args>(args)...)
756
- , m_has_val(false)
757
- {
758
- }
759
-
760
- ~expected_storage_base()
761
- {
762
- if (!m_has_val) {
763
- m_unexpect.~unexpected<E>();
764
- }
765
- }
766
-
767
- union {
768
- unexpected<E> m_unexpect;
769
- char m_dummy;
770
- };
771
- bool m_has_val;
786
+ constexpr expected_storage_base()
787
+ : m_dummy()
788
+ , m_has_val(true)
789
+ {
790
+ }
791
+ constexpr expected_storage_base(no_init_t)
792
+ : m_dummy()
793
+ , m_has_val(false)
794
+ {
795
+ }
796
+
797
+ constexpr expected_storage_base(in_place_t)
798
+ : m_dummy()
799
+ , m_has_val(true)
800
+ {
801
+ }
802
+
803
+ template<class... Args,
804
+ detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
805
+ constexpr explicit expected_storage_base(unexpect_t, Args&&... args)
806
+ : m_unexpect(std::forward<Args>(args)...)
807
+ , m_has_val(false)
808
+ {
809
+ }
810
+
811
+ template<class U,
812
+ class... Args,
813
+ detail::enable_if_t<
814
+ std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
815
+ constexpr explicit expected_storage_base(unexpect_t, std::initializer_list<U> il, Args&&... args)
816
+ : m_unexpect(il, std::forward<Args>(args)...)
817
+ , m_has_val(false)
818
+ {
819
+ }
820
+
821
+ ~expected_storage_base()
822
+ {
823
+ if (!m_has_val) {
824
+ m_unexpect.~unexpected<E>();
825
+ }
826
+ }
827
+
828
+ union {
829
+ unexpected<E> m_unexpect;
830
+ char m_dummy;
831
+ };
832
+ bool m_has_val;
772
833
  };
773
834
 
774
835
  // This base class provides some handy member functions which can be used in
775
836
  // further derived classes
776
837
  template<class T, class E>
777
838
  struct expected_operations_base : expected_storage_base<T, E> {
778
- using expected_storage_base<T, E>::expected_storage_base;
779
-
780
- template<class... Args>
781
- void construct(Args&&... args) noexcept
782
- {
783
- new (std::addressof(this->m_val)) T(std::forward<Args>(args)...);
784
- this->m_has_val = true;
785
- }
786
-
787
- template<class Rhs>
788
- void construct_with(Rhs&& rhs) noexcept
789
- {
790
- new (std::addressof(this->m_val)) T(std::forward<Rhs>(rhs).get());
791
- this->m_has_val = true;
792
- }
793
-
794
- template<class... Args>
795
- void construct_error(Args&&... args) noexcept
796
- {
797
- new (std::addressof(this->m_unexpect)) unexpected<E>(std::forward<Args>(args)...);
798
- this->m_has_val = false;
799
- }
839
+ using expected_storage_base<T, E>::expected_storage_base;
840
+
841
+ template<class... Args>
842
+ void construct(Args&&... args) noexcept
843
+ {
844
+ new (std::addressof(this->m_val)) T(std::forward<Args>(args)...);
845
+ this->m_has_val = true;
846
+ }
847
+
848
+ template<class Rhs>
849
+ void construct_with(Rhs&& rhs) noexcept
850
+ {
851
+ new (std::addressof(this->m_val)) T(std::forward<Rhs>(rhs).get());
852
+ this->m_has_val = true;
853
+ }
854
+
855
+ template<class... Args>
856
+ void construct_error(Args&&... args) noexcept
857
+ {
858
+ new (std::addressof(this->m_unexpect)) unexpected<E>(std::forward<Args>(args)...);
859
+ this->m_has_val = false;
860
+ }
800
861
 
801
862
  #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
802
863
 
803
- // These assign overloads ensure that the most efficient assignment
804
- // implementation is used while maintaining the strong exception guarantee.
805
- // The problematic case is where rhs has a value, but *this does not.
806
- //
807
- // This overload handles the case where we can just copy-construct `T`
808
- // directly into place without throwing.
809
- template<class U = T, detail::enable_if_t<std::is_nothrow_copy_constructible<U>::value>* = nullptr>
810
- void assign(const expected_operations_base& rhs) noexcept
811
- {
812
- if (!this->m_has_val && rhs.m_has_val) {
813
- geterr().~unexpected<E>();
814
- construct(rhs.get());
815
- } else {
816
- assign_common(rhs);
817
- }
818
- }
819
-
820
- // This overload handles the case where we can attempt to create a copy of
821
- // `T`, then no-throw move it into place if the copy was successful.
822
- template<class U = T,
823
- detail::enable_if_t<!std::is_nothrow_copy_constructible<U>::value && std::is_nothrow_move_constructible<U>::value>* = nullptr>
824
- void assign(const expected_operations_base& rhs) noexcept
825
- {
826
- if (!this->m_has_val && rhs.m_has_val) {
827
- T tmp = rhs.get();
828
- geterr().~unexpected<E>();
829
- construct(std::move(tmp));
830
- } else {
831
- assign_common(rhs);
832
- }
833
- }
834
-
835
- // This overload is the worst-case, where we have to move-construct the
836
- // unexpected value into temporary storage, then try to copy the T into place.
837
- // If the construction succeeds, then everything is fine, but if it throws,
838
- // then we move the old unexpected value back into place before rethrowing the
839
- // exception.
840
- template<class U = T,
841
- detail::enable_if_t<!std::is_nothrow_copy_constructible<U>::value && !std::is_nothrow_move_constructible<U>::value>* = nullptr>
842
- void assign(const expected_operations_base& rhs)
843
- {
844
- if (!this->m_has_val && rhs.m_has_val) {
845
- auto tmp = std::move(geterr());
846
- geterr().~unexpected<E>();
864
+ // These assign overloads ensure that the most efficient assignment
865
+ // implementation is used while maintaining the strong exception guarantee.
866
+ // The problematic case is where rhs has a value, but *this does not.
867
+ //
868
+ // This overload handles the case where we can just copy-construct `T`
869
+ // directly into place without throwing.
870
+ template<class U = T,
871
+ detail::enable_if_t<std::is_nothrow_copy_constructible<U>::value>* = nullptr>
872
+ void assign(const expected_operations_base& rhs) noexcept
873
+ {
874
+ if (!this->m_has_val && rhs.m_has_val) {
875
+ geterr().~unexpected<E>();
876
+ construct(rhs.get());
877
+ } else {
878
+ assign_common(rhs);
879
+ }
880
+ }
881
+
882
+ // This overload handles the case where we can attempt to create a copy of
883
+ // `T`, then no-throw move it into place if the copy was successful.
884
+ template<class U = T,
885
+ detail::enable_if_t<!std::is_nothrow_copy_constructible<U>::value &&
886
+ std::is_nothrow_move_constructible<U>::value>* = nullptr>
887
+ void assign(const expected_operations_base& rhs) noexcept
888
+ {
889
+ if (!this->m_has_val && rhs.m_has_val) {
890
+ T tmp = rhs.get();
891
+ geterr().~unexpected<E>();
892
+ construct(std::move(tmp));
893
+ } else {
894
+ assign_common(rhs);
895
+ }
896
+ }
897
+
898
+ // This overload is the worst-case, where we have to move-construct the
899
+ // unexpected value into temporary storage, then try to copy the T into place.
900
+ // If the construction succeeds, then everything is fine, but if it throws,
901
+ // then we move the old unexpected value back into place before rethrowing the
902
+ // exception.
903
+ template<class U = T,
904
+ detail::enable_if_t<!std::is_nothrow_copy_constructible<U>::value &&
905
+ !std::is_nothrow_move_constructible<U>::value>* = nullptr>
906
+ void assign(const expected_operations_base& rhs)
907
+ {
908
+ if (!this->m_has_val && rhs.m_has_val) {
909
+ auto tmp = std::move(geterr());
910
+ geterr().~unexpected<E>();
847
911
 
848
912
  #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
849
- try {
850
- construct(rhs.get());
851
- } catch (...) {
852
- geterr() = std::move(tmp);
853
- throw;
854
- }
913
+ try {
914
+ construct(rhs.get());
915
+ } catch (...) {
916
+ geterr() = std::move(tmp);
917
+ throw;
918
+ }
855
919
  #else
856
- construct(rhs.get());
920
+ construct(rhs.get());
857
921
  #endif
858
- } else {
859
- assign_common(rhs);
860
- }
861
- }
862
-
863
- // These overloads do the same as above, but for rvalues
864
- template<class U = T, detail::enable_if_t<std::is_nothrow_move_constructible<U>::value>* = nullptr>
865
- void assign(expected_operations_base&& rhs) noexcept
866
- {
867
- if (!this->m_has_val && rhs.m_has_val) {
868
- geterr().~unexpected<E>();
869
- construct(std::move(rhs).get());
870
- } else {
871
- assign_common(std::move(rhs));
872
- }
873
- }
874
-
875
- template<class U = T, detail::enable_if_t<!std::is_nothrow_move_constructible<U>::value>* = nullptr>
876
- void assign(expected_operations_base&& rhs)
877
- {
878
- if (!this->m_has_val && rhs.m_has_val) {
879
- auto tmp = std::move(geterr());
880
- geterr().~unexpected<E>();
922
+ } else {
923
+ assign_common(rhs);
924
+ }
925
+ }
926
+
927
+ // These overloads do the same as above, but for rvalues
928
+ template<class U = T,
929
+ detail::enable_if_t<std::is_nothrow_move_constructible<U>::value>* = nullptr>
930
+ void assign(expected_operations_base&& rhs) noexcept
931
+ {
932
+ if (!this->m_has_val && rhs.m_has_val) {
933
+ geterr().~unexpected<E>();
934
+ construct(std::move(rhs).get());
935
+ } else {
936
+ assign_common(std::move(rhs));
937
+ }
938
+ }
939
+
940
+ template<class U = T,
941
+ detail::enable_if_t<!std::is_nothrow_move_constructible<U>::value>* = nullptr>
942
+ void assign(expected_operations_base&& rhs)
943
+ {
944
+ if (!this->m_has_val && rhs.m_has_val) {
945
+ auto tmp = std::move(geterr());
946
+ geterr().~unexpected<E>();
881
947
  #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
882
- try {
883
- construct(std::move(rhs).get());
884
- } catch (...) {
885
- geterr() = std::move(tmp);
886
- throw;
887
- }
948
+ try {
949
+ construct(std::move(rhs).get());
950
+ } catch (...) {
951
+ geterr() = std::move(tmp);
952
+ throw;
953
+ }
888
954
  #else
889
- construct(std::move(rhs).get());
955
+ construct(std::move(rhs).get());
890
956
  #endif
891
- } else {
892
- assign_common(std::move(rhs));
893
- }
957
+ } else {
958
+ assign_common(std::move(rhs));
894
959
  }
960
+ }
895
961
 
896
962
  #else
897
963
 
898
- // If exceptions are disabled then we can just copy-construct
899
- void assign(const expected_operations_base& rhs) noexcept
900
- {
901
- if (!this->m_has_val && rhs.m_has_val) {
902
- geterr().~unexpected<E>();
903
- construct(rhs.get());
904
- } else {
905
- assign_common(rhs);
906
- }
964
+ // If exceptions are disabled then we can just copy-construct
965
+ void assign(const expected_operations_base& rhs) noexcept
966
+ {
967
+ if (!this->m_has_val && rhs.m_has_val) {
968
+ geterr().~unexpected<E>();
969
+ construct(rhs.get());
970
+ } else {
971
+ assign_common(rhs);
907
972
  }
973
+ }
908
974
 
909
- void assign(expected_operations_base&& rhs) noexcept
910
- {
911
- if (!this->m_has_val && rhs.m_has_val) {
912
- geterr().~unexpected<E>();
913
- construct(std::move(rhs).get());
914
- } else {
915
- assign_common(rhs);
916
- }
975
+ void assign(expected_operations_base&& rhs) noexcept
976
+ {
977
+ if (!this->m_has_val && rhs.m_has_val) {
978
+ geterr().~unexpected<E>();
979
+ construct(std::move(rhs).get());
980
+ } else {
981
+ assign_common(rhs);
917
982
  }
983
+ }
918
984
 
919
985
  #endif
920
986
 
921
- // The common part of move/copy assigning
922
- template<class Rhs>
923
- void assign_common(Rhs&& rhs)
924
- {
925
- if (this->m_has_val) {
926
- if (rhs.m_has_val) {
927
- get() = std::forward<Rhs>(rhs).get();
928
- } else {
929
- destroy_val();
930
- construct_error(std::forward<Rhs>(rhs).geterr());
931
- }
932
- } else {
933
- if (!rhs.m_has_val) {
934
- geterr() = std::forward<Rhs>(rhs).geterr();
935
- }
936
- }
937
- }
938
-
939
- bool has_value() const
940
- {
941
- return this->m_has_val;
942
- }
943
-
944
- TL_EXPECTED_11_CONSTEXPR T& get() &
945
- {
946
- return this->m_val;
947
- }
948
- constexpr const T& get() const&
949
- {
950
- return this->m_val;
951
- }
952
- TL_EXPECTED_11_CONSTEXPR T&& get() &&
953
- {
954
- return std::move(this->m_val);
955
- }
987
+ // The common part of move/copy assigning
988
+ template<class Rhs>
989
+ void assign_common(Rhs&& rhs)
990
+ {
991
+ if (this->m_has_val) {
992
+ if (rhs.m_has_val) {
993
+ get() = std::forward<Rhs>(rhs).get();
994
+ } else {
995
+ destroy_val();
996
+ construct_error(std::forward<Rhs>(rhs).geterr());
997
+ }
998
+ } else {
999
+ if (!rhs.m_has_val) {
1000
+ geterr() = std::forward<Rhs>(rhs).geterr();
1001
+ }
1002
+ }
1003
+ }
1004
+
1005
+ bool has_value() const
1006
+ {
1007
+ return this->m_has_val;
1008
+ }
1009
+
1010
+ TL_EXPECTED_11_CONSTEXPR T& get() &
1011
+ {
1012
+ return this->m_val;
1013
+ }
1014
+ constexpr const T& get() const&
1015
+ {
1016
+ return this->m_val;
1017
+ }
1018
+ TL_EXPECTED_11_CONSTEXPR T&& get() &&
1019
+ {
1020
+ return std::move(this->m_val);
1021
+ }
956
1022
  #ifndef TL_EXPECTED_NO_CONSTRR
957
- constexpr const T&& get() const&&
958
- {
959
- return std::move(this->m_val);
960
- }
1023
+ constexpr const T&& get() const&&
1024
+ {
1025
+ return std::move(this->m_val);
1026
+ }
961
1027
  #endif
962
1028
 
963
- TL_EXPECTED_11_CONSTEXPR unexpected<E>& geterr() &
964
- {
965
- return this->m_unexpect;
966
- }
967
- constexpr const unexpected<E>& geterr() const&
968
- {
969
- return this->m_unexpect;
970
- }
971
- TL_EXPECTED_11_CONSTEXPR unexpected<E>&& geterr() &&
972
- {
973
- return std::move(this->m_unexpect);
974
- }
1029
+ TL_EXPECTED_11_CONSTEXPR unexpected<E>& geterr() &
1030
+ {
1031
+ return this->m_unexpect;
1032
+ }
1033
+ constexpr const unexpected<E>& geterr() const&
1034
+ {
1035
+ return this->m_unexpect;
1036
+ }
1037
+ TL_EXPECTED_11_CONSTEXPR unexpected<E>&& geterr() &&
1038
+ {
1039
+ return std::move(this->m_unexpect);
1040
+ }
975
1041
  #ifndef TL_EXPECTED_NO_CONSTRR
976
- constexpr const unexpected<E>&& geterr() const&&
977
- {
978
- return std::move(this->m_unexpect);
979
- }
1042
+ constexpr const unexpected<E>&& geterr() const&&
1043
+ {
1044
+ return std::move(this->m_unexpect);
1045
+ }
980
1046
  #endif
981
1047
 
982
- TL_EXPECTED_11_CONSTEXPR void destroy_val()
983
- {
984
- get().~T();
985
- }
1048
+ TL_EXPECTED_11_CONSTEXPR void destroy_val()
1049
+ {
1050
+ get().~T();
1051
+ }
986
1052
  };
987
1053
 
988
1054
  // This base class provides some handy member functions which can be used in
989
1055
  // further derived classes
990
1056
  template<class E>
991
1057
  struct expected_operations_base<void, E> : expected_storage_base<void, E> {
992
- using expected_storage_base<void, E>::expected_storage_base;
993
-
994
- template<class... Args>
995
- void construct() noexcept
996
- {
997
- this->m_has_val = true;
998
- }
999
-
1000
- // This function doesn't use its argument, but needs it so that code in
1001
- // levels above this can work independently of whether T is void
1002
- template<class Rhs>
1003
- void construct_with(Rhs&&) noexcept
1004
- {
1005
- this->m_has_val = true;
1006
- }
1007
-
1008
- template<class... Args>
1009
- void construct_error(Args&&... args) noexcept
1010
- {
1011
- new (std::addressof(this->m_unexpect)) unexpected<E>(std::forward<Args>(args)...);
1012
- this->m_has_val = false;
1013
- }
1014
-
1015
- template<class Rhs>
1016
- void assign(Rhs&& rhs) noexcept
1017
- {
1018
- if (!this->m_has_val) {
1019
- if (rhs.m_has_val) {
1020
- geterr().~unexpected<E>();
1021
- construct();
1022
- } else {
1023
- geterr() = std::forward<Rhs>(rhs).geterr();
1024
- }
1025
- } else {
1026
- if (!rhs.m_has_val) {
1027
- construct_error(std::forward<Rhs>(rhs).geterr());
1028
- }
1029
- }
1030
- }
1031
-
1032
- bool has_value() const
1033
- {
1034
- return this->m_has_val;
1035
- }
1036
-
1037
- TL_EXPECTED_11_CONSTEXPR unexpected<E>& geterr() &
1038
- {
1039
- return this->m_unexpect;
1040
- }
1041
- constexpr const unexpected<E>& geterr() const&
1042
- {
1043
- return this->m_unexpect;
1044
- }
1045
- TL_EXPECTED_11_CONSTEXPR unexpected<E>&& geterr() &&
1046
- {
1047
- return std::move(this->m_unexpect);
1048
- }
1058
+ using expected_storage_base<void, E>::expected_storage_base;
1059
+
1060
+ template<class... Args>
1061
+ void construct() noexcept
1062
+ {
1063
+ this->m_has_val = true;
1064
+ }
1065
+
1066
+ // This function doesn't use its argument, but needs it so that code in
1067
+ // levels above this can work independently of whether T is void
1068
+ template<class Rhs>
1069
+ void construct_with(Rhs&&) noexcept
1070
+ {
1071
+ this->m_has_val = true;
1072
+ }
1073
+
1074
+ template<class... Args>
1075
+ void construct_error(Args&&... args) noexcept
1076
+ {
1077
+ new (std::addressof(this->m_unexpect)) unexpected<E>(std::forward<Args>(args)...);
1078
+ this->m_has_val = false;
1079
+ }
1080
+
1081
+ template<class Rhs>
1082
+ void assign(Rhs&& rhs) noexcept
1083
+ {
1084
+ if (!this->m_has_val) {
1085
+ if (rhs.m_has_val) {
1086
+ geterr().~unexpected<E>();
1087
+ construct();
1088
+ } else {
1089
+ geterr() = std::forward<Rhs>(rhs).geterr();
1090
+ }
1091
+ } else {
1092
+ if (!rhs.m_has_val) {
1093
+ construct_error(std::forward<Rhs>(rhs).geterr());
1094
+ }
1095
+ }
1096
+ }
1097
+
1098
+ bool has_value() const
1099
+ {
1100
+ return this->m_has_val;
1101
+ }
1102
+
1103
+ TL_EXPECTED_11_CONSTEXPR unexpected<E>& geterr() &
1104
+ {
1105
+ return this->m_unexpect;
1106
+ }
1107
+ constexpr const unexpected<E>& geterr() const&
1108
+ {
1109
+ return this->m_unexpect;
1110
+ }
1111
+ TL_EXPECTED_11_CONSTEXPR unexpected<E>&& geterr() &&
1112
+ {
1113
+ return std::move(this->m_unexpect);
1114
+ }
1049
1115
  #ifndef TL_EXPECTED_NO_CONSTRR
1050
- constexpr const unexpected<E>&& geterr() const&&
1051
- {
1052
- return std::move(this->m_unexpect);
1053
- }
1116
+ constexpr const unexpected<E>&& geterr() const&&
1117
+ {
1118
+ return std::move(this->m_unexpect);
1119
+ }
1054
1120
  #endif
1055
1121
 
1056
- TL_EXPECTED_11_CONSTEXPR void destroy_val()
1057
- {
1058
- // no-op
1059
- }
1122
+ TL_EXPECTED_11_CONSTEXPR void destroy_val()
1123
+ {
1124
+ // no-op
1125
+ }
1060
1126
  };
1061
1127
 
1062
1128
  // This class manages conditionally having a trivial copy constructor
1063
1129
  // This specialization is for when T and E are trivially copy constructible
1064
1130
  template<class T,
1065
1131
  class E,
1066
- bool =
1067
- is_void_or<T, TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T)>::value&& TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(E)::value>
1132
+ bool = is_void_or<T, TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T)>::value &&
1133
+ TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(E)::value>
1068
1134
  struct expected_copy_base : expected_operations_base<T, E> {
1069
- using expected_operations_base<T, E>::expected_operations_base;
1135
+ using expected_operations_base<T, E>::expected_operations_base;
1070
1136
  };
1071
1137
 
1072
1138
  // This specialization is for when T or E are not trivially copy constructible
1073
1139
  template<class T, class E>
1074
1140
  struct expected_copy_base<T, E, false> : expected_operations_base<T, E> {
1075
- using expected_operations_base<T, E>::expected_operations_base;
1076
-
1077
- expected_copy_base() = default;
1078
- expected_copy_base(const expected_copy_base& rhs)
1079
- : expected_operations_base<T, E>(no_init)
1080
- {
1081
- if (rhs.has_value()) {
1082
- this->construct_with(rhs);
1083
- } else {
1084
- this->construct_error(rhs.geterr());
1085
- }
1086
- }
1087
-
1088
- expected_copy_base(expected_copy_base&& rhs) = default;
1089
- expected_copy_base& operator=(const expected_copy_base& rhs) = default;
1090
- expected_copy_base& operator=(expected_copy_base&& rhs) = default;
1141
+ using expected_operations_base<T, E>::expected_operations_base;
1142
+
1143
+ expected_copy_base() = default;
1144
+ expected_copy_base(const expected_copy_base& rhs)
1145
+ : expected_operations_base<T, E>(no_init)
1146
+ {
1147
+ if (rhs.has_value()) {
1148
+ this->construct_with(rhs);
1149
+ } else {
1150
+ this->construct_error(rhs.geterr());
1151
+ }
1152
+ }
1153
+
1154
+ expected_copy_base(expected_copy_base&& rhs) = default;
1155
+ expected_copy_base& operator=(const expected_copy_base& rhs) = default;
1156
+ expected_copy_base& operator=(expected_copy_base&& rhs) = default;
1091
1157
  };
1092
1158
 
1093
1159
  // This class manages conditionally having a trivial move constructor
@@ -1098,9 +1164,10 @@ struct expected_copy_base<T, E, false> : expected_operations_base<T, E> {
1098
1164
  #ifndef TL_EXPECTED_GCC49
1099
1165
  template<class T,
1100
1166
  class E,
1101
- bool = is_void_or<T, std::is_trivially_move_constructible<T>>::value&& std::is_trivially_move_constructible<E>::value>
1167
+ bool = is_void_or<T, std::is_trivially_move_constructible<T>>::value &&
1168
+ std::is_trivially_move_constructible<E>::value>
1102
1169
  struct expected_move_base : expected_copy_base<T, E> {
1103
- using expected_copy_base<T, E>::expected_copy_base;
1170
+ using expected_copy_base<T, E>::expected_copy_base;
1104
1171
  };
1105
1172
  #else
1106
1173
  template<class T, class E, bool = false>
@@ -1108,51 +1175,53 @@ struct expected_move_base;
1108
1175
  #endif
1109
1176
  template<class T, class E>
1110
1177
  struct expected_move_base<T, E, false> : expected_copy_base<T, E> {
1111
- using expected_copy_base<T, E>::expected_copy_base;
1112
-
1113
- expected_move_base() = default;
1114
- expected_move_base(const expected_move_base& rhs) = default;
1115
-
1116
- expected_move_base(expected_move_base&& rhs) noexcept(std::is_nothrow_move_constructible<T>::value)
1117
- : expected_copy_base<T, E>(no_init)
1118
- {
1119
- if (rhs.has_value()) {
1120
- this->construct_with(std::move(rhs));
1121
- } else {
1122
- this->construct_error(std::move(rhs.geterr()));
1123
- }
1124
- }
1125
- expected_move_base& operator=(const expected_move_base& rhs) = default;
1126
- expected_move_base& operator=(expected_move_base&& rhs) = default;
1178
+ using expected_copy_base<T, E>::expected_copy_base;
1179
+
1180
+ expected_move_base() = default;
1181
+ expected_move_base(const expected_move_base& rhs) = default;
1182
+
1183
+ expected_move_base(expected_move_base&& rhs) noexcept(
1184
+ std::is_nothrow_move_constructible<T>::value)
1185
+ : expected_copy_base<T, E>(no_init)
1186
+ {
1187
+ if (rhs.has_value()) {
1188
+ this->construct_with(std::move(rhs));
1189
+ } else {
1190
+ this->construct_error(std::move(rhs.geterr()));
1191
+ }
1192
+ }
1193
+ expected_move_base& operator=(const expected_move_base& rhs) = default;
1194
+ expected_move_base& operator=(expected_move_base&& rhs) = default;
1127
1195
  };
1128
1196
 
1129
1197
  // This class manages conditionally having a trivial copy assignment operator
1130
1198
  template<class T,
1131
1199
  class E,
1132
- bool =
1133
- is_void_or<T,
1134
- conjunction<TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(T),
1135
- TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T),
1136
- TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(T)>>::value&& TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(E)::value&&
1137
- TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(E)::value&& TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(E)::value>
1200
+ bool = is_void_or<T,
1201
+ conjunction<TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(T),
1202
+ TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T),
1203
+ TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(T)>>::value &&
1204
+ TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(E)::value &&
1205
+ TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(E)::value &&
1206
+ TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(E)::value>
1138
1207
  struct expected_copy_assign_base : expected_move_base<T, E> {
1139
- using expected_move_base<T, E>::expected_move_base;
1208
+ using expected_move_base<T, E>::expected_move_base;
1140
1209
  };
1141
1210
 
1142
1211
  template<class T, class E>
1143
1212
  struct expected_copy_assign_base<T, E, false> : expected_move_base<T, E> {
1144
- using expected_move_base<T, E>::expected_move_base;
1145
-
1146
- expected_copy_assign_base() = default;
1147
- expected_copy_assign_base(const expected_copy_assign_base& rhs) = default;
1148
-
1149
- expected_copy_assign_base(expected_copy_assign_base&& rhs) = default;
1150
- expected_copy_assign_base& operator=(const expected_copy_assign_base& rhs)
1151
- {
1152
- this->assign(rhs);
1153
- return *this;
1154
- }
1155
- expected_copy_assign_base& operator=(expected_copy_assign_base&& rhs) = default;
1213
+ using expected_move_base<T, E>::expected_move_base;
1214
+
1215
+ expected_copy_assign_base() = default;
1216
+ expected_copy_assign_base(const expected_copy_assign_base& rhs) = default;
1217
+
1218
+ expected_copy_assign_base(expected_copy_assign_base&& rhs) = default;
1219
+ expected_copy_assign_base& operator=(const expected_copy_assign_base& rhs)
1220
+ {
1221
+ this->assign(rhs);
1222
+ return *this;
1223
+ }
1224
+ expected_copy_assign_base& operator=(expected_copy_assign_base&& rhs) = default;
1156
1225
  };
1157
1226
 
1158
1227
  // This class manages conditionally having a trivial move assignment operator
@@ -1161,15 +1230,17 @@ struct expected_copy_assign_base<T, E, false> : expected_move_base<T, E> {
1161
1230
  // to make do with a non-trivial move assignment operator even if T is trivially
1162
1231
  // move assignable
1163
1232
  #ifndef TL_EXPECTED_GCC49
1164
- template<
1165
- class T,
1166
- class E,
1167
- bool = is_void_or<
1168
- T,
1169
- conjunction<std::is_trivially_destructible<T>, std::is_trivially_move_constructible<T>, std::is_trivially_move_assignable<T>>>::value&&
1170
- std::is_trivially_destructible<E>::value&& std::is_trivially_move_constructible<E>::value&& std::is_trivially_move_assignable<E>::value>
1233
+ template<class T,
1234
+ class E,
1235
+ bool = is_void_or<T,
1236
+ conjunction<std::is_trivially_destructible<T>,
1237
+ std::is_trivially_move_constructible<T>,
1238
+ std::is_trivially_move_assignable<T>>>::value &&
1239
+ std::is_trivially_destructible<E>::value &&
1240
+ std::is_trivially_move_constructible<E>::value &&
1241
+ std::is_trivially_move_assignable<E>::value>
1171
1242
  struct expected_move_assign_base : expected_copy_assign_base<T, E> {
1172
- using expected_copy_assign_base<T, E>::expected_copy_assign_base;
1243
+ using expected_copy_assign_base<T, E>::expected_copy_assign_base;
1173
1244
  };
1174
1245
  #else
1175
1246
  template<class T, class E, bool = false>
@@ -1178,62 +1249,64 @@ struct expected_move_assign_base;
1178
1249
 
1179
1250
  template<class T, class E>
1180
1251
  struct expected_move_assign_base<T, E, false> : expected_copy_assign_base<T, E> {
1181
- using expected_copy_assign_base<T, E>::expected_copy_assign_base;
1252
+ using expected_copy_assign_base<T, E>::expected_copy_assign_base;
1182
1253
 
1183
- expected_move_assign_base() = default;
1184
- expected_move_assign_base(const expected_move_assign_base& rhs) = default;
1254
+ expected_move_assign_base() = default;
1255
+ expected_move_assign_base(const expected_move_assign_base& rhs) = default;
1185
1256
 
1186
- expected_move_assign_base(expected_move_assign_base&& rhs) = default;
1257
+ expected_move_assign_base(expected_move_assign_base&& rhs) = default;
1187
1258
 
1188
- expected_move_assign_base& operator=(const expected_move_assign_base& rhs) = default;
1259
+ expected_move_assign_base& operator=(const expected_move_assign_base& rhs) = default;
1189
1260
 
1190
- expected_move_assign_base& operator=(expected_move_assign_base&& rhs) noexcept(
1191
- std::is_nothrow_move_constructible<T>::value&& std::is_nothrow_move_assignable<T>::value)
1192
- {
1193
- this->assign(std::move(rhs));
1194
- return *this;
1195
- }
1261
+ expected_move_assign_base& operator=(expected_move_assign_base&& rhs) noexcept(
1262
+ std::is_nothrow_move_constructible<T>::value && std::is_nothrow_move_assignable<T>::value)
1263
+ {
1264
+ this->assign(std::move(rhs));
1265
+ return *this;
1266
+ }
1196
1267
  };
1197
1268
 
1198
1269
  // expected_delete_ctor_base will conditionally delete copy and move
1199
1270
  // constructors depending on whether T is copy/move constructible
1200
1271
  template<class T,
1201
1272
  class E,
1202
- bool EnableCopy = (is_copy_constructible_or_void<T>::value && std::is_copy_constructible<E>::value),
1203
- bool EnableMove = (is_move_constructible_or_void<T>::value && std::is_move_constructible<E>::value)>
1273
+ bool EnableCopy =
1274
+ (is_copy_constructible_or_void<T>::value && std::is_copy_constructible<E>::value),
1275
+ bool EnableMove =
1276
+ (is_move_constructible_or_void<T>::value && std::is_move_constructible<E>::value)>
1204
1277
  struct expected_delete_ctor_base {
1205
- expected_delete_ctor_base() = default;
1206
- expected_delete_ctor_base(const expected_delete_ctor_base&) = default;
1207
- expected_delete_ctor_base(expected_delete_ctor_base&&) noexcept = default;
1208
- expected_delete_ctor_base& operator=(const expected_delete_ctor_base&) = default;
1209
- expected_delete_ctor_base& operator=(expected_delete_ctor_base&&) noexcept = default;
1278
+ expected_delete_ctor_base() = default;
1279
+ expected_delete_ctor_base(const expected_delete_ctor_base&) = default;
1280
+ expected_delete_ctor_base(expected_delete_ctor_base&&) noexcept = default;
1281
+ expected_delete_ctor_base& operator=(const expected_delete_ctor_base&) = default;
1282
+ expected_delete_ctor_base& operator=(expected_delete_ctor_base&&) noexcept = default;
1210
1283
  };
1211
1284
 
1212
1285
  template<class T, class E>
1213
1286
  struct expected_delete_ctor_base<T, E, true, false> {
1214
- expected_delete_ctor_base() = default;
1215
- expected_delete_ctor_base(const expected_delete_ctor_base&) = default;
1216
- expected_delete_ctor_base(expected_delete_ctor_base&&) noexcept = delete;
1217
- expected_delete_ctor_base& operator=(const expected_delete_ctor_base&) = default;
1218
- expected_delete_ctor_base& operator=(expected_delete_ctor_base&&) noexcept = default;
1287
+ expected_delete_ctor_base() = default;
1288
+ expected_delete_ctor_base(const expected_delete_ctor_base&) = default;
1289
+ expected_delete_ctor_base(expected_delete_ctor_base&&) noexcept = delete;
1290
+ expected_delete_ctor_base& operator=(const expected_delete_ctor_base&) = default;
1291
+ expected_delete_ctor_base& operator=(expected_delete_ctor_base&&) noexcept = default;
1219
1292
  };
1220
1293
 
1221
1294
  template<class T, class E>
1222
1295
  struct expected_delete_ctor_base<T, E, false, true> {
1223
- expected_delete_ctor_base() = default;
1224
- expected_delete_ctor_base(const expected_delete_ctor_base&) = delete;
1225
- expected_delete_ctor_base(expected_delete_ctor_base&&) noexcept = default;
1226
- expected_delete_ctor_base& operator=(const expected_delete_ctor_base&) = default;
1227
- expected_delete_ctor_base& operator=(expected_delete_ctor_base&&) noexcept = default;
1296
+ expected_delete_ctor_base() = default;
1297
+ expected_delete_ctor_base(const expected_delete_ctor_base&) = delete;
1298
+ expected_delete_ctor_base(expected_delete_ctor_base&&) noexcept = default;
1299
+ expected_delete_ctor_base& operator=(const expected_delete_ctor_base&) = default;
1300
+ expected_delete_ctor_base& operator=(expected_delete_ctor_base&&) noexcept = default;
1228
1301
  };
1229
1302
 
1230
1303
  template<class T, class E>
1231
1304
  struct expected_delete_ctor_base<T, E, false, false> {
1232
- expected_delete_ctor_base() = default;
1233
- expected_delete_ctor_base(const expected_delete_ctor_base&) = delete;
1234
- expected_delete_ctor_base(expected_delete_ctor_base&&) noexcept = delete;
1235
- expected_delete_ctor_base& operator=(const expected_delete_ctor_base&) = default;
1236
- expected_delete_ctor_base& operator=(expected_delete_ctor_base&&) noexcept = default;
1305
+ expected_delete_ctor_base() = default;
1306
+ expected_delete_ctor_base(const expected_delete_ctor_base&) = delete;
1307
+ expected_delete_ctor_base(expected_delete_ctor_base&&) noexcept = delete;
1308
+ expected_delete_ctor_base& operator=(const expected_delete_ctor_base&) = default;
1309
+ expected_delete_ctor_base& operator=(expected_delete_ctor_base&&) noexcept = default;
1237
1310
  };
1238
1311
 
1239
1312
  // expected_delete_assign_base will conditionally delete copy and move
@@ -1241,115 +1314,119 @@ struct expected_delete_ctor_base<T, E, false, false> {
1241
1314
  // assignable
1242
1315
  template<class T,
1243
1316
  class E,
1244
- bool EnableCopy = (is_copy_constructible_or_void<T>::value && std::is_copy_constructible<E>::value &&
1245
- is_copy_assignable_or_void<T>::value && std::is_copy_assignable<E>::value),
1246
- bool EnableMove = (is_move_constructible_or_void<T>::value && std::is_move_constructible<E>::value &&
1247
- is_move_assignable_or_void<T>::value && std::is_move_assignable<E>::value)>
1317
+ bool EnableCopy =
1318
+ (is_copy_constructible_or_void<T>::value && std::is_copy_constructible<E>::value &&
1319
+ is_copy_assignable_or_void<T>::value && std::is_copy_assignable<E>::value),
1320
+ bool EnableMove =
1321
+ (is_move_constructible_or_void<T>::value && std::is_move_constructible<E>::value &&
1322
+ is_move_assignable_or_void<T>::value && std::is_move_assignable<E>::value)>
1248
1323
  struct expected_delete_assign_base {
1249
- expected_delete_assign_base() = default;
1250
- expected_delete_assign_base(const expected_delete_assign_base&) = default;
1251
- expected_delete_assign_base(expected_delete_assign_base&&) noexcept = default;
1252
- expected_delete_assign_base& operator=(const expected_delete_assign_base&) = default;
1253
- expected_delete_assign_base& operator=(expected_delete_assign_base&&) noexcept = default;
1324
+ expected_delete_assign_base() = default;
1325
+ expected_delete_assign_base(const expected_delete_assign_base&) = default;
1326
+ expected_delete_assign_base(expected_delete_assign_base&&) noexcept = default;
1327
+ expected_delete_assign_base& operator=(const expected_delete_assign_base&) = default;
1328
+ expected_delete_assign_base& operator=(expected_delete_assign_base&&) noexcept = default;
1254
1329
  };
1255
1330
 
1256
1331
  template<class T, class E>
1257
1332
  struct expected_delete_assign_base<T, E, true, false> {
1258
- expected_delete_assign_base() = default;
1259
- expected_delete_assign_base(const expected_delete_assign_base&) = default;
1260
- expected_delete_assign_base(expected_delete_assign_base&&) noexcept = default;
1261
- expected_delete_assign_base& operator=(const expected_delete_assign_base&) = default;
1262
- expected_delete_assign_base& operator=(expected_delete_assign_base&&) noexcept = delete;
1333
+ expected_delete_assign_base() = default;
1334
+ expected_delete_assign_base(const expected_delete_assign_base&) = default;
1335
+ expected_delete_assign_base(expected_delete_assign_base&&) noexcept = default;
1336
+ expected_delete_assign_base& operator=(const expected_delete_assign_base&) = default;
1337
+ expected_delete_assign_base& operator=(expected_delete_assign_base&&) noexcept = delete;
1263
1338
  };
1264
1339
 
1265
1340
  template<class T, class E>
1266
1341
  struct expected_delete_assign_base<T, E, false, true> {
1267
- expected_delete_assign_base() = default;
1268
- expected_delete_assign_base(const expected_delete_assign_base&) = default;
1269
- expected_delete_assign_base(expected_delete_assign_base&&) noexcept = default;
1270
- expected_delete_assign_base& operator=(const expected_delete_assign_base&) = delete;
1271
- expected_delete_assign_base& operator=(expected_delete_assign_base&&) noexcept = default;
1342
+ expected_delete_assign_base() = default;
1343
+ expected_delete_assign_base(const expected_delete_assign_base&) = default;
1344
+ expected_delete_assign_base(expected_delete_assign_base&&) noexcept = default;
1345
+ expected_delete_assign_base& operator=(const expected_delete_assign_base&) = delete;
1346
+ expected_delete_assign_base& operator=(expected_delete_assign_base&&) noexcept = default;
1272
1347
  };
1273
1348
 
1274
1349
  template<class T, class E>
1275
1350
  struct expected_delete_assign_base<T, E, false, false> {
1276
- expected_delete_assign_base() = default;
1277
- expected_delete_assign_base(const expected_delete_assign_base&) = default;
1278
- expected_delete_assign_base(expected_delete_assign_base&&) noexcept = default;
1279
- expected_delete_assign_base& operator=(const expected_delete_assign_base&) = delete;
1280
- expected_delete_assign_base& operator=(expected_delete_assign_base&&) noexcept = delete;
1351
+ expected_delete_assign_base() = default;
1352
+ expected_delete_assign_base(const expected_delete_assign_base&) = default;
1353
+ expected_delete_assign_base(expected_delete_assign_base&&) noexcept = default;
1354
+ expected_delete_assign_base& operator=(const expected_delete_assign_base&) = delete;
1355
+ expected_delete_assign_base& operator=(expected_delete_assign_base&&) noexcept = delete;
1281
1356
  };
1282
1357
 
1283
1358
  // This is needed to be able to construct the expected_default_ctor_base which
1284
1359
  // follows, while still conditionally deleting the default constructor.
1285
1360
  struct default_constructor_tag {
1286
- explicit constexpr default_constructor_tag() = default;
1361
+ explicit constexpr default_constructor_tag() = default;
1287
1362
  };
1288
1363
 
1289
1364
  // expected_default_ctor_base will ensure that expected has a deleted default
1290
1365
  // consturctor if T is not default constructible.
1291
1366
  // This specialization is for when T is default constructible
1292
- template<class T, class E, bool Enable = std::is_default_constructible<T>::value || std::is_void<T>::value>
1367
+ template<class T,
1368
+ class E,
1369
+ bool Enable = std::is_default_constructible<T>::value || std::is_void<T>::value>
1293
1370
  struct expected_default_ctor_base {
1294
- constexpr expected_default_ctor_base() noexcept = default;
1295
- constexpr expected_default_ctor_base(expected_default_ctor_base const&) noexcept = default;
1296
- constexpr expected_default_ctor_base(expected_default_ctor_base&&) noexcept = default;
1297
- expected_default_ctor_base& operator=(expected_default_ctor_base const&) noexcept = default;
1298
- expected_default_ctor_base& operator=(expected_default_ctor_base&&) noexcept = default;
1299
-
1300
- constexpr explicit expected_default_ctor_base(default_constructor_tag)
1301
- {
1302
- }
1371
+ constexpr expected_default_ctor_base() noexcept = default;
1372
+ constexpr expected_default_ctor_base(expected_default_ctor_base const&) noexcept = default;
1373
+ constexpr expected_default_ctor_base(expected_default_ctor_base&&) noexcept = default;
1374
+ expected_default_ctor_base& operator=(expected_default_ctor_base const&) noexcept = default;
1375
+ expected_default_ctor_base& operator=(expected_default_ctor_base&&) noexcept = default;
1376
+
1377
+ constexpr explicit expected_default_ctor_base(default_constructor_tag)
1378
+ {
1379
+ }
1303
1380
  };
1304
1381
 
1305
1382
  // This specialization is for when T is not default constructible
1306
1383
  template<class T, class E>
1307
1384
  struct expected_default_ctor_base<T, E, false> {
1308
- constexpr expected_default_ctor_base() noexcept = delete;
1309
- constexpr expected_default_ctor_base(expected_default_ctor_base const&) noexcept = default;
1310
- constexpr expected_default_ctor_base(expected_default_ctor_base&&) noexcept = default;
1311
- expected_default_ctor_base& operator=(expected_default_ctor_base const&) noexcept = default;
1312
- expected_default_ctor_base& operator=(expected_default_ctor_base&&) noexcept = default;
1313
-
1314
- constexpr explicit expected_default_ctor_base(default_constructor_tag)
1315
- {
1316
- }
1385
+ constexpr expected_default_ctor_base() noexcept = delete;
1386
+ constexpr expected_default_ctor_base(expected_default_ctor_base const&) noexcept = default;
1387
+ constexpr expected_default_ctor_base(expected_default_ctor_base&&) noexcept = default;
1388
+ expected_default_ctor_base& operator=(expected_default_ctor_base const&) noexcept = default;
1389
+ expected_default_ctor_base& operator=(expected_default_ctor_base&&) noexcept = default;
1390
+
1391
+ constexpr explicit expected_default_ctor_base(default_constructor_tag)
1392
+ {
1393
+ }
1317
1394
  };
1318
1395
  } // namespace detail
1319
1396
 
1320
1397
  template<class E>
1321
1398
  class bad_expected_access : public std::exception
1322
1399
  {
1323
- public:
1324
- explicit bad_expected_access(E e)
1325
- : m_val(std::move(e))
1326
- {
1327
- }
1328
-
1329
- virtual const char* what() const noexcept override
1330
- {
1331
- return "Bad expected access";
1332
- }
1333
-
1334
- const E& error() const&
1335
- {
1336
- return m_val;
1337
- }
1338
- E& error() &
1339
- {
1340
- return m_val;
1341
- }
1342
- const E&& error() const&&
1343
- {
1344
- return std::move(m_val);
1345
- }
1346
- E&& error() &&
1347
- {
1348
- return std::move(m_val);
1349
- }
1350
-
1351
- private:
1352
- E m_val;
1400
+ public:
1401
+ explicit bad_expected_access(E e)
1402
+ : m_val(std::move(e))
1403
+ {
1404
+ }
1405
+
1406
+ virtual const char* what() const noexcept override
1407
+ {
1408
+ return "Bad expected access";
1409
+ }
1410
+
1411
+ const E& error() const&
1412
+ {
1413
+ return m_val;
1414
+ }
1415
+ E& error() &
1416
+ {
1417
+ return m_val;
1418
+ }
1419
+ const E&& error() const&&
1420
+ {
1421
+ return std::move(m_val);
1422
+ }
1423
+ E&& error() &&
1424
+ {
1425
+ return std::move(m_val);
1426
+ }
1427
+
1428
+ private:
1429
+ E m_val;
1353
1430
  };
1354
1431
 
1355
1432
  /// An `expected<T, E>` object is an object that contains the storage for
@@ -1366,781 +1443,843 @@ class expected
1366
1443
  , private detail::expected_delete_assign_base<T, E>
1367
1444
  , private detail::expected_default_ctor_base<T, E>
1368
1445
  {
1369
- static_assert(!std::is_reference<T>::value, "T must not be a reference");
1370
- static_assert(!std::is_same<T, std::remove_cv<in_place_t>::type>::value, "T must not be in_place_t");
1371
- static_assert(!std::is_same<T, std::remove_cv<unexpect_t>::type>::value, "T must not be unexpect_t");
1372
- static_assert(!std::is_same<T, typename std::remove_cv<unexpected<E>>::type>::value, "T must not be unexpected<E>");
1373
- static_assert(!std::is_reference<E>::value, "E must not be a reference");
1374
-
1375
- T* valptr()
1376
- {
1377
- return std::addressof(this->m_val);
1378
- }
1379
- const T* valptr() const
1380
- {
1381
- return std::addressof(this->m_val);
1382
- }
1383
- unexpected<E>* errptr()
1384
- {
1385
- return std::addressof(this->m_unexpect);
1386
- }
1387
- const unexpected<E>* errptr() const
1388
- {
1389
- return std::addressof(this->m_unexpect);
1390
- }
1391
-
1392
- template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
1393
- TL_EXPECTED_11_CONSTEXPR U& val()
1394
- {
1395
- return this->m_val;
1396
- }
1397
- TL_EXPECTED_11_CONSTEXPR unexpected<E>& err()
1398
- {
1399
- return this->m_unexpect;
1400
- }
1401
-
1402
- template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
1403
- constexpr const U& val() const
1404
- {
1405
- return this->m_val;
1406
- }
1407
- constexpr const unexpected<E>& err() const
1408
- {
1409
- return this->m_unexpect;
1410
- }
1411
-
1412
- using impl_base = detail::expected_move_assign_base<T, E>;
1413
- using ctor_base = detail::expected_default_ctor_base<T, E>;
1414
-
1415
- public:
1416
- typedef T value_type;
1417
- typedef E error_type;
1418
- typedef unexpected<E> unexpected_type;
1419
-
1420
- #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55)
1421
- template<class F>
1422
- TL_EXPECTED_11_CONSTEXPR auto and_then(F&& f) &
1423
- {
1424
- return and_then_impl(*this, std::forward<F>(f));
1425
- }
1426
- template<class F>
1427
- TL_EXPECTED_11_CONSTEXPR auto and_then(F&& f) &&
1428
- {
1429
- return and_then_impl(std::move(*this), std::forward<F>(f));
1430
- }
1431
- template<class F>
1432
- constexpr auto and_then(F&& f) const&
1433
- {
1434
- return and_then_impl(*this, std::forward<F>(f));
1435
- }
1446
+ static_assert(!std::is_reference<T>::value, "T must not be a reference");
1447
+ static_assert(!std::is_same<T, std::remove_cv<in_place_t>::type>::value,
1448
+ "T must not be in_place_t");
1449
+ static_assert(!std::is_same<T, std::remove_cv<unexpect_t>::type>::value,
1450
+ "T must not be unexpect_t");
1451
+ static_assert(!std::is_same<T, typename std::remove_cv<unexpected<E>>::type>::value,
1452
+ "T must not be unexpected<E>");
1453
+ static_assert(!std::is_reference<E>::value, "E must not be a reference");
1454
+
1455
+ T* valptr()
1456
+ {
1457
+ return std::addressof(this->m_val);
1458
+ }
1459
+ const T* valptr() const
1460
+ {
1461
+ return std::addressof(this->m_val);
1462
+ }
1463
+ unexpected<E>* errptr()
1464
+ {
1465
+ return std::addressof(this->m_unexpect);
1466
+ }
1467
+ const unexpected<E>* errptr() const
1468
+ {
1469
+ return std::addressof(this->m_unexpect);
1470
+ }
1471
+
1472
+ template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
1473
+ TL_EXPECTED_11_CONSTEXPR U& val()
1474
+ {
1475
+ return this->m_val;
1476
+ }
1477
+ TL_EXPECTED_11_CONSTEXPR unexpected<E>& err()
1478
+ {
1479
+ return this->m_unexpect;
1480
+ }
1481
+
1482
+ template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
1483
+ constexpr const U& val() const
1484
+ {
1485
+ return this->m_val;
1486
+ }
1487
+ constexpr const unexpected<E>& err() const
1488
+ {
1489
+ return this->m_unexpect;
1490
+ }
1491
+
1492
+ using impl_base = detail::expected_move_assign_base<T, E>;
1493
+ using ctor_base = detail::expected_default_ctor_base<T, E>;
1494
+
1495
+ public:
1496
+ typedef T value_type;
1497
+ typedef E error_type;
1498
+ typedef unexpected<E> unexpected_type;
1499
+
1500
+ #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && !defined(TL_EXPECTED_GCC54) && \
1501
+ !defined(TL_EXPECTED_GCC55)
1502
+ template<class F>
1503
+ TL_EXPECTED_11_CONSTEXPR auto and_then(F&& f) &
1504
+ {
1505
+ return and_then_impl(*this, std::forward<F>(f));
1506
+ }
1507
+ template<class F>
1508
+ TL_EXPECTED_11_CONSTEXPR auto and_then(F&& f) &&
1509
+ {
1510
+ return and_then_impl(std::move(*this), std::forward<F>(f));
1511
+ }
1512
+ template<class F>
1513
+ constexpr auto and_then(F&& f) const&
1514
+ {
1515
+ return and_then_impl(*this, std::forward<F>(f));
1516
+ }
1436
1517
 
1437
1518
  #ifndef TL_EXPECTED_NO_CONSTRR
1438
- template<class F>
1439
- constexpr auto and_then(F&& f) const&&
1440
- {
1441
- return and_then_impl(std::move(*this), std::forward<F>(f));
1442
- }
1519
+ template<class F>
1520
+ constexpr auto and_then(F&& f) const&&
1521
+ {
1522
+ return and_then_impl(std::move(*this), std::forward<F>(f));
1523
+ }
1443
1524
  #endif
1444
1525
 
1445
1526
  #else
1446
- template<class F>
1447
- TL_EXPECTED_11_CONSTEXPR auto and_then(F&& f) & -> decltype(and_then_impl(std::declval<expected&>(), std::forward<F>(f)))
1448
- {
1449
- return and_then_impl(*this, std::forward<F>(f));
1450
- }
1451
- template<class F>
1452
- TL_EXPECTED_11_CONSTEXPR auto and_then(F&& f) && -> decltype(and_then_impl(std::declval<expected&&>(), std::forward<F>(f)))
1453
- {
1454
- return and_then_impl(std::move(*this), std::forward<F>(f));
1455
- }
1456
- template<class F>
1457
- constexpr auto and_then(F&& f) const& -> decltype(and_then_impl(std::declval<expected const&>(), std::forward<F>(f)))
1458
- {
1459
- return and_then_impl(*this, std::forward<F>(f));
1460
- }
1527
+ template<class F>
1528
+ TL_EXPECTED_11_CONSTEXPR auto and_then(
1529
+ F&& f) & -> decltype(and_then_impl(std::declval<expected&>(), std::forward<F>(f)))
1530
+ {
1531
+ return and_then_impl(*this, std::forward<F>(f));
1532
+ }
1533
+ template<class F>
1534
+ TL_EXPECTED_11_CONSTEXPR auto and_then(
1535
+ F&& f) && -> decltype(and_then_impl(std::declval<expected&&>(), std::forward<F>(f)))
1536
+ {
1537
+ return and_then_impl(std::move(*this), std::forward<F>(f));
1538
+ }
1539
+ template<class F>
1540
+ constexpr auto and_then(F&& f) const& -> decltype(and_then_impl(std::declval<expected const&>(),
1541
+ std::forward<F>(f)))
1542
+ {
1543
+ return and_then_impl(*this, std::forward<F>(f));
1544
+ }
1461
1545
 
1462
1546
  #ifndef TL_EXPECTED_NO_CONSTRR
1463
- template<class F>
1464
- constexpr auto and_then(F&& f) const&& -> decltype(and_then_impl(std::declval<expected const&&>(), std::forward<F>(f)))
1465
- {
1466
- return and_then_impl(std::move(*this), std::forward<F>(f));
1467
- }
1547
+ template<class F>
1548
+ constexpr auto and_then(F&& f) const&& -> decltype(and_then_impl(std::declval<expected const&&>(),
1549
+ std::forward<F>(f)))
1550
+ {
1551
+ return and_then_impl(std::move(*this), std::forward<F>(f));
1552
+ }
1468
1553
  #endif
1469
1554
  #endif
1470
1555
 
1471
- #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55)
1472
- template<class F>
1473
- TL_EXPECTED_11_CONSTEXPR auto map(F&& f) &
1474
- {
1475
- return expected_map_impl(*this, std::forward<F>(f));
1476
- }
1477
- template<class F>
1478
- TL_EXPECTED_11_CONSTEXPR auto map(F&& f) &&
1479
- {
1480
- return expected_map_impl(std::move(*this), std::forward<F>(f));
1481
- }
1482
- template<class F>
1483
- constexpr auto map(F&& f) const&
1484
- {
1485
- return expected_map_impl(*this, std::forward<F>(f));
1486
- }
1487
- template<class F>
1488
- constexpr auto map(F&& f) const&&
1489
- {
1490
- return expected_map_impl(std::move(*this), std::forward<F>(f));
1491
- }
1556
+ #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && !defined(TL_EXPECTED_GCC54) && \
1557
+ !defined(TL_EXPECTED_GCC55)
1558
+ template<class F>
1559
+ TL_EXPECTED_11_CONSTEXPR auto map(F&& f) &
1560
+ {
1561
+ return expected_map_impl(*this, std::forward<F>(f));
1562
+ }
1563
+ template<class F>
1564
+ TL_EXPECTED_11_CONSTEXPR auto map(F&& f) &&
1565
+ {
1566
+ return expected_map_impl(std::move(*this), std::forward<F>(f));
1567
+ }
1568
+ template<class F>
1569
+ constexpr auto map(F&& f) const&
1570
+ {
1571
+ return expected_map_impl(*this, std::forward<F>(f));
1572
+ }
1573
+ template<class F>
1574
+ constexpr auto map(F&& f) const&&
1575
+ {
1576
+ return expected_map_impl(std::move(*this), std::forward<F>(f));
1577
+ }
1492
1578
  #else
1493
- template<class F>
1494
- TL_EXPECTED_11_CONSTEXPR decltype(expected_map_impl(std::declval<expected&>(), std::declval<F&&>())) map(F&& f) &
1495
- {
1496
- return expected_map_impl(*this, std::forward<F>(f));
1497
- }
1498
- template<class F>
1499
- TL_EXPECTED_11_CONSTEXPR decltype(expected_map_impl(std::declval<expected>(), std::declval<F&&>())) map(F&& f) &&
1500
- {
1501
- return expected_map_impl(std::move(*this), std::forward<F>(f));
1502
- }
1503
- template<class F>
1504
- constexpr decltype(expected_map_impl(std::declval<const expected&>(), std::declval<F&&>())) map(F&& f) const&
1505
- {
1506
- return expected_map_impl(*this, std::forward<F>(f));
1507
- }
1579
+ template<class F>
1580
+ TL_EXPECTED_11_CONSTEXPR decltype(expected_map_impl(std::declval<expected&>(),
1581
+ std::declval<F&&>()))
1582
+ map(F&& f) &
1583
+ {
1584
+ return expected_map_impl(*this, std::forward<F>(f));
1585
+ }
1586
+ template<class F>
1587
+ TL_EXPECTED_11_CONSTEXPR decltype(expected_map_impl(std::declval<expected>(),
1588
+ std::declval<F&&>()))
1589
+ map(F&& f) &&
1590
+ {
1591
+ return expected_map_impl(std::move(*this), std::forward<F>(f));
1592
+ }
1593
+ template<class F>
1594
+ constexpr decltype(expected_map_impl(std::declval<const expected&>(), std::declval<F&&>())) map(
1595
+ F&& f) const&
1596
+ {
1597
+ return expected_map_impl(*this, std::forward<F>(f));
1598
+ }
1508
1599
 
1509
1600
  #ifndef TL_EXPECTED_NO_CONSTRR
1510
- template<class F>
1511
- constexpr decltype(expected_map_impl(std::declval<const expected&&>(), std::declval<F&&>())) map(F&& f) const&&
1512
- {
1513
- return expected_map_impl(std::move(*this), std::forward<F>(f));
1514
- }
1601
+ template<class F>
1602
+ constexpr decltype(expected_map_impl(std::declval<const expected&&>(), std::declval<F&&>())) map(
1603
+ F&& f) const&&
1604
+ {
1605
+ return expected_map_impl(std::move(*this), std::forward<F>(f));
1606
+ }
1515
1607
  #endif
1516
1608
  #endif
1517
1609
 
1518
- #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55)
1519
- template<class F>
1520
- TL_EXPECTED_11_CONSTEXPR auto transform(F&& f) &
1521
- {
1522
- return expected_map_impl(*this, std::forward<F>(f));
1523
- }
1524
- template<class F>
1525
- TL_EXPECTED_11_CONSTEXPR auto transform(F&& f) &&
1526
- {
1527
- return expected_map_impl(std::move(*this), std::forward<F>(f));
1528
- }
1529
- template<class F>
1530
- constexpr auto transform(F&& f) const&
1531
- {
1532
- return expected_map_impl(*this, std::forward<F>(f));
1533
- }
1534
- template<class F>
1535
- constexpr auto transform(F&& f) const&&
1536
- {
1537
- return expected_map_impl(std::move(*this), std::forward<F>(f));
1538
- }
1610
+ #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && !defined(TL_EXPECTED_GCC54) && \
1611
+ !defined(TL_EXPECTED_GCC55)
1612
+ template<class F>
1613
+ TL_EXPECTED_11_CONSTEXPR auto transform(F&& f) &
1614
+ {
1615
+ return expected_map_impl(*this, std::forward<F>(f));
1616
+ }
1617
+ template<class F>
1618
+ TL_EXPECTED_11_CONSTEXPR auto transform(F&& f) &&
1619
+ {
1620
+ return expected_map_impl(std::move(*this), std::forward<F>(f));
1621
+ }
1622
+ template<class F>
1623
+ constexpr auto transform(F&& f) const&
1624
+ {
1625
+ return expected_map_impl(*this, std::forward<F>(f));
1626
+ }
1627
+ template<class F>
1628
+ constexpr auto transform(F&& f) const&&
1629
+ {
1630
+ return expected_map_impl(std::move(*this), std::forward<F>(f));
1631
+ }
1539
1632
  #else
1540
- template<class F>
1541
- TL_EXPECTED_11_CONSTEXPR decltype(expected_map_impl(std::declval<expected&>(), std::declval<F&&>())) transform(F&& f) &
1542
- {
1543
- return expected_map_impl(*this, std::forward<F>(f));
1544
- }
1545
- template<class F>
1546
- TL_EXPECTED_11_CONSTEXPR decltype(expected_map_impl(std::declval<expected>(), std::declval<F&&>())) transform(F&& f) &&
1547
- {
1548
- return expected_map_impl(std::move(*this), std::forward<F>(f));
1549
- }
1550
- template<class F>
1551
- constexpr decltype(expected_map_impl(std::declval<const expected&>(), std::declval<F&&>())) transform(F&& f) const&
1552
- {
1553
- return expected_map_impl(*this, std::forward<F>(f));
1554
- }
1633
+ template<class F>
1634
+ TL_EXPECTED_11_CONSTEXPR decltype(expected_map_impl(std::declval<expected&>(),
1635
+ std::declval<F&&>()))
1636
+ transform(F&& f) &
1637
+ {
1638
+ return expected_map_impl(*this, std::forward<F>(f));
1639
+ }
1640
+ template<class F>
1641
+ TL_EXPECTED_11_CONSTEXPR decltype(expected_map_impl(std::declval<expected>(),
1642
+ std::declval<F&&>()))
1643
+ transform(F&& f) &&
1644
+ {
1645
+ return expected_map_impl(std::move(*this), std::forward<F>(f));
1646
+ }
1647
+ template<class F>
1648
+ constexpr decltype(expected_map_impl(std::declval<const expected&>(), std::declval<F&&>()))
1649
+ transform(F&& f) const&
1650
+ {
1651
+ return expected_map_impl(*this, std::forward<F>(f));
1652
+ }
1555
1653
 
1556
1654
  #ifndef TL_EXPECTED_NO_CONSTRR
1557
- template<class F>
1558
- constexpr decltype(expected_map_impl(std::declval<const expected&&>(), std::declval<F&&>())) transform(F&& f) const&&
1559
- {
1560
- return expected_map_impl(std::move(*this), std::forward<F>(f));
1561
- }
1655
+ template<class F>
1656
+ constexpr decltype(expected_map_impl(std::declval<const expected&&>(), std::declval<F&&>()))
1657
+ transform(F&& f) const&&
1658
+ {
1659
+ return expected_map_impl(std::move(*this), std::forward<F>(f));
1660
+ }
1562
1661
  #endif
1563
1662
  #endif
1564
1663
 
1565
- #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55)
1566
- template<class F>
1567
- TL_EXPECTED_11_CONSTEXPR auto map_error(F&& f) &
1568
- {
1569
- return map_error_impl(*this, std::forward<F>(f));
1570
- }
1571
- template<class F>
1572
- TL_EXPECTED_11_CONSTEXPR auto map_error(F&& f) &&
1573
- {
1574
- return map_error_impl(std::move(*this), std::forward<F>(f));
1575
- }
1576
- template<class F>
1577
- constexpr auto map_error(F&& f) const&
1578
- {
1579
- return map_error_impl(*this, std::forward<F>(f));
1580
- }
1581
- template<class F>
1582
- constexpr auto map_error(F&& f) const&&
1583
- {
1584
- return map_error_impl(std::move(*this), std::forward<F>(f));
1585
- }
1664
+ #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && !defined(TL_EXPECTED_GCC54) && \
1665
+ !defined(TL_EXPECTED_GCC55)
1666
+ template<class F>
1667
+ TL_EXPECTED_11_CONSTEXPR auto map_error(F&& f) &
1668
+ {
1669
+ return map_error_impl(*this, std::forward<F>(f));
1670
+ }
1671
+ template<class F>
1672
+ TL_EXPECTED_11_CONSTEXPR auto map_error(F&& f) &&
1673
+ {
1674
+ return map_error_impl(std::move(*this), std::forward<F>(f));
1675
+ }
1676
+ template<class F>
1677
+ constexpr auto map_error(F&& f) const&
1678
+ {
1679
+ return map_error_impl(*this, std::forward<F>(f));
1680
+ }
1681
+ template<class F>
1682
+ constexpr auto map_error(F&& f) const&&
1683
+ {
1684
+ return map_error_impl(std::move(*this), std::forward<F>(f));
1685
+ }
1586
1686
  #else
1587
- template<class F>
1588
- TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected&>(), std::declval<F&&>())) map_error(F&& f) &
1589
- {
1590
- return map_error_impl(*this, std::forward<F>(f));
1591
- }
1592
- template<class F>
1593
- TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected&&>(), std::declval<F&&>())) map_error(F&& f) &&
1594
- {
1595
- return map_error_impl(std::move(*this), std::forward<F>(f));
1596
- }
1597
- template<class F>
1598
- constexpr decltype(map_error_impl(std::declval<const expected&>(), std::declval<F&&>())) map_error(F&& f) const&
1599
- {
1600
- return map_error_impl(*this, std::forward<F>(f));
1601
- }
1687
+ template<class F>
1688
+ TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected&>(), std::declval<F&&>()))
1689
+ map_error(F&& f) &
1690
+ {
1691
+ return map_error_impl(*this, std::forward<F>(f));
1692
+ }
1693
+ template<class F>
1694
+ TL_EXPECTED_11_CONSTEXPR decltype(map_error_impl(std::declval<expected&&>(), std::declval<F&&>()))
1695
+ map_error(F&& f) &&
1696
+ {
1697
+ return map_error_impl(std::move(*this), std::forward<F>(f));
1698
+ }
1699
+ template<class F>
1700
+ constexpr decltype(map_error_impl(std::declval<const expected&>(), std::declval<F&&>()))
1701
+ map_error(F&& f) const&
1702
+ {
1703
+ return map_error_impl(*this, std::forward<F>(f));
1704
+ }
1602
1705
 
1603
1706
  #ifndef TL_EXPECTED_NO_CONSTRR
1604
- template<class F>
1605
- constexpr decltype(map_error_impl(std::declval<const expected&&>(), std::declval<F&&>())) map_error(F&& f) const&&
1606
- {
1607
- return map_error_impl(std::move(*this), std::forward<F>(f));
1608
- }
1707
+ template<class F>
1708
+ constexpr decltype(map_error_impl(std::declval<const expected&&>(), std::declval<F&&>()))
1709
+ map_error(F&& f) const&&
1710
+ {
1711
+ return map_error_impl(std::move(*this), std::forward<F>(f));
1712
+ }
1609
1713
  #endif
1610
1714
  #endif
1611
- template<class F>
1612
- expected TL_EXPECTED_11_CONSTEXPR or_else(F&& f) &
1613
- {
1614
- return or_else_impl(*this, std::forward<F>(f));
1615
- }
1616
-
1617
- template<class F>
1618
- expected TL_EXPECTED_11_CONSTEXPR or_else(F&& f) &&
1619
- {
1620
- return or_else_impl(std::move(*this), std::forward<F>(f));
1621
- }
1622
-
1623
- template<class F>
1624
- expected constexpr or_else(F&& f) const&
1625
- {
1626
- return or_else_impl(*this, std::forward<F>(f));
1627
- }
1715
+ template<class F>
1716
+ expected TL_EXPECTED_11_CONSTEXPR or_else(F&& f) &
1717
+ {
1718
+ return or_else_impl(*this, std::forward<F>(f));
1719
+ }
1720
+
1721
+ template<class F>
1722
+ expected TL_EXPECTED_11_CONSTEXPR or_else(F&& f) &&
1723
+ {
1724
+ return or_else_impl(std::move(*this), std::forward<F>(f));
1725
+ }
1726
+
1727
+ template<class F>
1728
+ expected constexpr or_else(F&& f) const&
1729
+ {
1730
+ return or_else_impl(*this, std::forward<F>(f));
1731
+ }
1628
1732
 
1629
1733
  #ifndef TL_EXPECTED_NO_CONSTRR
1630
- template<class F>
1631
- expected constexpr or_else(F&& f) const&&
1632
- {
1633
- return or_else_impl(std::move(*this), std::forward<F>(f));
1634
- }
1734
+ template<class F>
1735
+ expected constexpr or_else(F&& f) const&&
1736
+ {
1737
+ return or_else_impl(std::move(*this), std::forward<F>(f));
1738
+ }
1635
1739
  #endif
1636
- constexpr expected() = default;
1637
- constexpr expected(const expected& rhs) = default;
1638
- constexpr expected(expected&& rhs) = default;
1639
- expected& operator=(const expected& rhs) = default;
1640
- expected& operator=(expected&& rhs) = default;
1641
-
1642
- template<class... Args, detail::enable_if_t<std::is_constructible<T, Args&&...>::value>* = nullptr>
1643
- constexpr expected(in_place_t, Args&&... args)
1644
- : impl_base(in_place, std::forward<Args>(args)...)
1645
- , ctor_base(detail::default_constructor_tag{})
1646
- {
1647
- }
1648
-
1649
- template<class U, class... Args, detail::enable_if_t<std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
1650
- constexpr expected(in_place_t, std::initializer_list<U> il, Args&&... args)
1651
- : impl_base(in_place, il, std::forward<Args>(args)...)
1652
- , ctor_base(detail::default_constructor_tag{})
1653
- {
1654
- }
1655
-
1656
- template<class G = E,
1657
- detail::enable_if_t<std::is_constructible<E, const G&>::value>* = nullptr,
1658
- detail::enable_if_t<!std::is_convertible<const G&, E>::value>* = nullptr>
1659
- explicit constexpr expected(const unexpected<G>& e)
1660
- : impl_base(unexpect, e.value())
1661
- , ctor_base(detail::default_constructor_tag{})
1662
- {
1663
- }
1664
-
1665
- template<class G = E,
1666
- detail::enable_if_t<std::is_constructible<E, const G&>::value>* = nullptr,
1667
- detail::enable_if_t<std::is_convertible<const G&, E>::value>* = nullptr>
1668
- constexpr expected(unexpected<G> const& e)
1669
- : impl_base(unexpect, e.value())
1670
- , ctor_base(detail::default_constructor_tag{})
1671
- {
1672
- }
1673
-
1674
- template<class G = E,
1675
- detail::enable_if_t<std::is_constructible<E, G&&>::value>* = nullptr,
1676
- detail::enable_if_t<!std::is_convertible<G&&, E>::value>* = nullptr>
1677
- explicit constexpr expected(unexpected<G>&& e) noexcept(std::is_nothrow_constructible<E, G&&>::value)
1678
- : impl_base(unexpect, std::move(e.value()))
1679
- , ctor_base(detail::default_constructor_tag{})
1680
- {
1681
- }
1682
-
1683
- template<class G = E,
1684
- detail::enable_if_t<std::is_constructible<E, G&&>::value>* = nullptr,
1685
- detail::enable_if_t<std::is_convertible<G&&, E>::value>* = nullptr>
1686
- constexpr expected(unexpected<G>&& e) noexcept(std::is_nothrow_constructible<E, G&&>::value)
1687
- : impl_base(unexpect, std::move(e.value()))
1688
- , ctor_base(detail::default_constructor_tag{})
1689
- {
1690
- }
1691
-
1692
- template<class... Args, detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
1693
- constexpr explicit expected(unexpect_t, Args&&... args)
1694
- : impl_base(unexpect, std::forward<Args>(args)...)
1695
- , ctor_base(detail::default_constructor_tag{})
1696
- {
1697
- }
1698
-
1699
- template<class U, class... Args, detail::enable_if_t<std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
1700
- constexpr explicit expected(unexpect_t, std::initializer_list<U> il, Args&&... args)
1701
- : impl_base(unexpect, il, std::forward<Args>(args)...)
1702
- , ctor_base(detail::default_constructor_tag{})
1703
- {
1704
- }
1705
-
1706
- template<class U,
1707
- class G,
1708
- detail::enable_if_t<!(std::is_convertible<U const&, T>::value && std::is_convertible<G const&, E>::value)>* = nullptr,
1709
- detail::expected_enable_from_other<T, E, U, G, const U&, const G&>* = nullptr>
1710
- explicit TL_EXPECTED_11_CONSTEXPR expected(const expected<U, G>& rhs)
1711
- : ctor_base(detail::default_constructor_tag{})
1712
- {
1713
- if (rhs.has_value()) {
1714
- this->construct(*rhs);
1715
- } else {
1716
- this->construct_error(rhs.error());
1717
- }
1718
- }
1719
-
1720
- template<class U,
1721
- class G,
1722
- detail::enable_if_t<(std::is_convertible<U const&, T>::value && std::is_convertible<G const&, E>::value)>* = nullptr,
1723
- detail::expected_enable_from_other<T, E, U, G, const U&, const G&>* = nullptr>
1724
- TL_EXPECTED_11_CONSTEXPR expected(const expected<U, G>& rhs)
1725
- : ctor_base(detail::default_constructor_tag{})
1726
- {
1727
- if (rhs.has_value()) {
1728
- this->construct(*rhs);
1729
- } else {
1730
- this->construct_error(rhs.error());
1731
- }
1732
- }
1733
-
1734
- template<class U,
1735
- class G,
1736
- detail::enable_if_t<!(std::is_convertible<U&&, T>::value && std::is_convertible<G&&, E>::value)>* = nullptr,
1737
- detail::expected_enable_from_other<T, E, U, G, U&&, G&&>* = nullptr>
1738
- explicit TL_EXPECTED_11_CONSTEXPR expected(expected<U, G>&& rhs)
1739
- : ctor_base(detail::default_constructor_tag{})
1740
- {
1741
- if (rhs.has_value()) {
1742
- this->construct(std::move(*rhs));
1743
- } else {
1744
- this->construct_error(std::move(rhs.error()));
1745
- }
1746
- }
1747
-
1748
- template<class U,
1749
- class G,
1750
- detail::enable_if_t<(std::is_convertible<U&&, T>::value && std::is_convertible<G&&, E>::value)>* = nullptr,
1751
- detail::expected_enable_from_other<T, E, U, G, U&&, G&&>* = nullptr>
1752
- TL_EXPECTED_11_CONSTEXPR expected(expected<U, G>&& rhs)
1753
- : ctor_base(detail::default_constructor_tag{})
1754
- {
1755
- if (rhs.has_value()) {
1756
- this->construct(std::move(*rhs));
1757
- } else {
1758
- this->construct_error(std::move(rhs.error()));
1759
- }
1760
- }
1761
-
1762
- template<class U = T,
1763
- detail::enable_if_t<!std::is_convertible<U&&, T>::value>* = nullptr,
1764
- detail::expected_enable_forward_value<T, E, U>* = nullptr>
1765
- explicit TL_EXPECTED_MSVC2015_CONSTEXPR expected(U&& v)
1766
- : expected(in_place, std::forward<U>(v))
1767
- {
1768
- }
1769
-
1770
- template<class U = T,
1771
- detail::enable_if_t<std::is_convertible<U&&, T>::value>* = nullptr,
1772
- detail::expected_enable_forward_value<T, E, U>* = nullptr>
1773
- TL_EXPECTED_MSVC2015_CONSTEXPR expected(U&& v)
1774
- : expected(in_place, std::forward<U>(v))
1775
- {
1776
- }
1777
-
1778
- template<class U = T,
1779
- class G = T,
1780
- detail::enable_if_t<std::is_nothrow_constructible<T, U&&>::value>* = nullptr,
1781
- detail::enable_if_t<!std::is_void<G>::value>* = nullptr,
1782
- detail::enable_if_t<(!std::is_same<expected<T, E>, detail::decay_t<U>>::value &&
1783
- !detail::conjunction<std::is_scalar<T>, std::is_same<T, detail::decay_t<U>>>::value &&
1784
- std::is_constructible<T, U>::value && std::is_assignable<G&, U>::value &&
1785
- std::is_nothrow_move_constructible<E>::value)>* = nullptr>
1786
- expected& operator=(U&& v)
1787
- {
1788
- if (has_value()) {
1789
- val() = std::forward<U>(v);
1790
- } else {
1791
- err().~unexpected<E>();
1792
- ::new (valptr()) T(std::forward<U>(v));
1793
- this->m_has_val = true;
1794
- }
1795
-
1796
- return *this;
1797
- }
1798
-
1799
- template<class U = T,
1800
- class G = T,
1801
- detail::enable_if_t<!std::is_nothrow_constructible<T, U&&>::value>* = nullptr,
1802
- detail::enable_if_t<!std::is_void<U>::value>* = nullptr,
1803
- detail::enable_if_t<(!std::is_same<expected<T, E>, detail::decay_t<U>>::value &&
1804
- !detail::conjunction<std::is_scalar<T>, std::is_same<T, detail::decay_t<U>>>::value &&
1805
- std::is_constructible<T, U>::value && std::is_assignable<G&, U>::value &&
1806
- std::is_nothrow_move_constructible<E>::value)>* = nullptr>
1807
- expected& operator=(U&& v)
1808
- {
1809
- if (has_value()) {
1810
- val() = std::forward<U>(v);
1811
- } else {
1812
- auto tmp = std::move(err());
1813
- err().~unexpected<E>();
1740
+ constexpr expected() = default;
1741
+ constexpr expected(const expected& rhs) = default;
1742
+ constexpr expected(expected&& rhs) = default;
1743
+ expected& operator=(const expected& rhs) = default;
1744
+ expected& operator=(expected&& rhs) = default;
1745
+
1746
+ template<class... Args,
1747
+ detail::enable_if_t<std::is_constructible<T, Args&&...>::value>* = nullptr>
1748
+ constexpr expected(in_place_t, Args&&... args)
1749
+ : impl_base(in_place, std::forward<Args>(args)...)
1750
+ , ctor_base(detail::default_constructor_tag{})
1751
+ {
1752
+ }
1753
+
1754
+ template<class U,
1755
+ class... Args,
1756
+ detail::enable_if_t<
1757
+ std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
1758
+ constexpr expected(in_place_t, std::initializer_list<U> il, Args&&... args)
1759
+ : impl_base(in_place, il, std::forward<Args>(args)...)
1760
+ , ctor_base(detail::default_constructor_tag{})
1761
+ {
1762
+ }
1763
+
1764
+ template<class G = E,
1765
+ detail::enable_if_t<std::is_constructible<E, const G&>::value>* = nullptr,
1766
+ detail::enable_if_t<!std::is_convertible<const G&, E>::value>* = nullptr>
1767
+ explicit constexpr expected(const unexpected<G>& e)
1768
+ : impl_base(unexpect, e.value())
1769
+ , ctor_base(detail::default_constructor_tag{})
1770
+ {
1771
+ }
1772
+
1773
+ template<class G = E,
1774
+ detail::enable_if_t<std::is_constructible<E, const G&>::value>* = nullptr,
1775
+ detail::enable_if_t<std::is_convertible<const G&, E>::value>* = nullptr>
1776
+ constexpr expected(unexpected<G> const& e)
1777
+ : impl_base(unexpect, e.value())
1778
+ , ctor_base(detail::default_constructor_tag{})
1779
+ {
1780
+ }
1781
+
1782
+ template<class G = E,
1783
+ detail::enable_if_t<std::is_constructible<E, G&&>::value>* = nullptr,
1784
+ detail::enable_if_t<!std::is_convertible<G&&, E>::value>* = nullptr>
1785
+ explicit constexpr expected(unexpected<G>&& e) noexcept(
1786
+ std::is_nothrow_constructible<E, G&&>::value)
1787
+ : impl_base(unexpect, std::move(e.value()))
1788
+ , ctor_base(detail::default_constructor_tag{})
1789
+ {
1790
+ }
1791
+
1792
+ template<class G = E,
1793
+ detail::enable_if_t<std::is_constructible<E, G&&>::value>* = nullptr,
1794
+ detail::enable_if_t<std::is_convertible<G&&, E>::value>* = nullptr>
1795
+ constexpr expected(unexpected<G>&& e) noexcept(std::is_nothrow_constructible<E, G&&>::value)
1796
+ : impl_base(unexpect, std::move(e.value()))
1797
+ , ctor_base(detail::default_constructor_tag{})
1798
+ {
1799
+ }
1800
+
1801
+ template<class... Args,
1802
+ detail::enable_if_t<std::is_constructible<E, Args&&...>::value>* = nullptr>
1803
+ constexpr explicit expected(unexpect_t, Args&&... args)
1804
+ : impl_base(unexpect, std::forward<Args>(args)...)
1805
+ , ctor_base(detail::default_constructor_tag{})
1806
+ {
1807
+ }
1808
+
1809
+ template<class U,
1810
+ class... Args,
1811
+ detail::enable_if_t<
1812
+ std::is_constructible<E, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
1813
+ constexpr explicit expected(unexpect_t, std::initializer_list<U> il, Args&&... args)
1814
+ : impl_base(unexpect, il, std::forward<Args>(args)...)
1815
+ , ctor_base(detail::default_constructor_tag{})
1816
+ {
1817
+ }
1818
+
1819
+ template<class U,
1820
+ class G,
1821
+ detail::enable_if_t<!(std::is_convertible<U const&, T>::value &&
1822
+ std::is_convertible<G const&, E>::value)>* = nullptr,
1823
+ detail::expected_enable_from_other<T, E, U, G, const U&, const G&>* = nullptr>
1824
+ explicit TL_EXPECTED_11_CONSTEXPR expected(const expected<U, G>& rhs)
1825
+ : ctor_base(detail::default_constructor_tag{})
1826
+ {
1827
+ if (rhs.has_value()) {
1828
+ this->construct(*rhs);
1829
+ } else {
1830
+ this->construct_error(rhs.error());
1831
+ }
1832
+ }
1833
+
1834
+ template<class U,
1835
+ class G,
1836
+ detail::enable_if_t<(std::is_convertible<U const&, T>::value &&
1837
+ std::is_convertible<G const&, E>::value)>* = nullptr,
1838
+ detail::expected_enable_from_other<T, E, U, G, const U&, const G&>* = nullptr>
1839
+ TL_EXPECTED_11_CONSTEXPR expected(const expected<U, G>& rhs)
1840
+ : ctor_base(detail::default_constructor_tag{})
1841
+ {
1842
+ if (rhs.has_value()) {
1843
+ this->construct(*rhs);
1844
+ } else {
1845
+ this->construct_error(rhs.error());
1846
+ }
1847
+ }
1848
+
1849
+ template<class U,
1850
+ class G,
1851
+ detail::enable_if_t<!(std::is_convertible<U&&, T>::value &&
1852
+ std::is_convertible<G&&, E>::value)>* = nullptr,
1853
+ detail::expected_enable_from_other<T, E, U, G, U&&, G&&>* = nullptr>
1854
+ explicit TL_EXPECTED_11_CONSTEXPR expected(expected<U, G>&& rhs)
1855
+ : ctor_base(detail::default_constructor_tag{})
1856
+ {
1857
+ if (rhs.has_value()) {
1858
+ this->construct(std::move(*rhs));
1859
+ } else {
1860
+ this->construct_error(std::move(rhs.error()));
1861
+ }
1862
+ }
1863
+
1864
+ template<class U,
1865
+ class G,
1866
+ detail::enable_if_t<(std::is_convertible<U&&, T>::value &&
1867
+ std::is_convertible<G&&, E>::value)>* = nullptr,
1868
+ detail::expected_enable_from_other<T, E, U, G, U&&, G&&>* = nullptr>
1869
+ TL_EXPECTED_11_CONSTEXPR expected(expected<U, G>&& rhs)
1870
+ : ctor_base(detail::default_constructor_tag{})
1871
+ {
1872
+ if (rhs.has_value()) {
1873
+ this->construct(std::move(*rhs));
1874
+ } else {
1875
+ this->construct_error(std::move(rhs.error()));
1876
+ }
1877
+ }
1878
+
1879
+ template<class U = T,
1880
+ detail::enable_if_t<!std::is_convertible<U&&, T>::value>* = nullptr,
1881
+ detail::expected_enable_forward_value<T, E, U>* = nullptr>
1882
+ explicit TL_EXPECTED_MSVC2015_CONSTEXPR expected(U&& v)
1883
+ : expected(in_place, std::forward<U>(v))
1884
+ {
1885
+ }
1886
+
1887
+ template<class U = T,
1888
+ detail::enable_if_t<std::is_convertible<U&&, T>::value>* = nullptr,
1889
+ detail::expected_enable_forward_value<T, E, U>* = nullptr>
1890
+ TL_EXPECTED_MSVC2015_CONSTEXPR expected(U&& v)
1891
+ : expected(in_place, std::forward<U>(v))
1892
+ {
1893
+ }
1894
+
1895
+ template<class U = T,
1896
+ class G = T,
1897
+ detail::enable_if_t<std::is_nothrow_constructible<T, U&&>::value>* = nullptr,
1898
+ detail::enable_if_t<!std::is_void<G>::value>* = nullptr,
1899
+ detail::enable_if_t<
1900
+ (!std::is_same<expected<T, E>, detail::decay_t<U>>::value &&
1901
+ !detail::conjunction<std::is_scalar<T>, std::is_same<T, detail::decay_t<U>>>::value &&
1902
+ std::is_constructible<T, U>::value && std::is_assignable<G&, U>::value &&
1903
+ std::is_nothrow_move_constructible<E>::value)>* = nullptr>
1904
+ expected& operator=(U&& v)
1905
+ {
1906
+ if (has_value()) {
1907
+ val() = std::forward<U>(v);
1908
+ } else {
1909
+ err().~unexpected<E>();
1910
+ ::new (valptr()) T(std::forward<U>(v));
1911
+ this->m_has_val = true;
1912
+ }
1913
+
1914
+ return *this;
1915
+ }
1916
+
1917
+ template<class U = T,
1918
+ class G = T,
1919
+ detail::enable_if_t<!std::is_nothrow_constructible<T, U&&>::value>* = nullptr,
1920
+ detail::enable_if_t<!std::is_void<U>::value>* = nullptr,
1921
+ detail::enable_if_t<
1922
+ (!std::is_same<expected<T, E>, detail::decay_t<U>>::value &&
1923
+ !detail::conjunction<std::is_scalar<T>, std::is_same<T, detail::decay_t<U>>>::value &&
1924
+ std::is_constructible<T, U>::value && std::is_assignable<G&, U>::value &&
1925
+ std::is_nothrow_move_constructible<E>::value)>* = nullptr>
1926
+ expected& operator=(U&& v)
1927
+ {
1928
+ if (has_value()) {
1929
+ val() = std::forward<U>(v);
1930
+ } else {
1931
+ auto tmp = std::move(err());
1932
+ err().~unexpected<E>();
1814
1933
 
1815
1934
  #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
1816
- try {
1817
- ::new (valptr()) T(std::forward<U>(v));
1818
- this->m_has_val = true;
1819
- } catch (...) {
1820
- err() = std::move(tmp);
1821
- throw;
1822
- }
1935
+ try {
1936
+ ::new (valptr()) T(std::forward<U>(v));
1937
+ this->m_has_val = true;
1938
+ } catch (...) {
1939
+ err() = std::move(tmp);
1940
+ throw;
1941
+ }
1823
1942
  #else
1824
- ::new (valptr()) T(std::forward<U>(v));
1825
- this->m_has_val = true;
1943
+ ::new (valptr()) T(std::forward<U>(v));
1944
+ this->m_has_val = true;
1826
1945
  #endif
1827
- }
1828
-
1829
- return *this;
1830
1946
  }
1831
1947
 
1832
- template<class G = E, detail::enable_if_t<std::is_nothrow_copy_constructible<G>::value && std::is_assignable<G&, G>::value>* = nullptr>
1833
- expected& operator=(const unexpected<G>& rhs)
1834
- {
1835
- if (!has_value()) {
1836
- err() = rhs;
1837
- } else {
1838
- this->destroy_val();
1839
- ::new (errptr()) unexpected<E>(rhs);
1840
- this->m_has_val = false;
1841
- }
1842
-
1843
- return *this;
1844
- }
1845
-
1846
- template<class G = E, detail::enable_if_t<std::is_nothrow_move_constructible<G>::value && std::is_move_assignable<G>::value>* = nullptr>
1847
- expected& operator=(unexpected<G>&& rhs) noexcept
1848
- {
1849
- if (!has_value()) {
1850
- err() = std::move(rhs);
1851
- } else {
1852
- this->destroy_val();
1853
- ::new (errptr()) unexpected<E>(std::move(rhs));
1854
- this->m_has_val = false;
1855
- }
1856
-
1857
- return *this;
1858
- }
1859
-
1860
- template<class... Args, detail::enable_if_t<std::is_nothrow_constructible<T, Args&&...>::value>* = nullptr>
1861
- void emplace(Args&&... args)
1862
- {
1863
- if (has_value()) {
1864
- val() = T(std::forward<Args>(args)...);
1865
- } else {
1866
- err().~unexpected<E>();
1867
- ::new (valptr()) T(std::forward<Args>(args)...);
1868
- this->m_has_val = true;
1869
- }
1870
- }
1871
-
1872
- template<class... Args, detail::enable_if_t<!std::is_nothrow_constructible<T, Args&&...>::value>* = nullptr>
1873
- void emplace(Args&&... args)
1874
- {
1875
- if (has_value()) {
1876
- val() = T(std::forward<Args>(args)...);
1877
- } else {
1878
- auto tmp = std::move(err());
1879
- err().~unexpected<E>();
1948
+ return *this;
1949
+ }
1950
+
1951
+ template<class G = E,
1952
+ detail::enable_if_t<std::is_nothrow_copy_constructible<G>::value &&
1953
+ std::is_assignable<G&, G>::value>* = nullptr>
1954
+ expected& operator=(const unexpected<G>& rhs)
1955
+ {
1956
+ if (!has_value()) {
1957
+ err() = rhs;
1958
+ } else {
1959
+ this->destroy_val();
1960
+ ::new (errptr()) unexpected<E>(rhs);
1961
+ this->m_has_val = false;
1962
+ }
1963
+
1964
+ return *this;
1965
+ }
1966
+
1967
+ template<class G = E,
1968
+ detail::enable_if_t<std::is_nothrow_move_constructible<G>::value &&
1969
+ std::is_move_assignable<G>::value>* = nullptr>
1970
+ expected& operator=(unexpected<G>&& rhs) noexcept
1971
+ {
1972
+ if (!has_value()) {
1973
+ err() = std::move(rhs);
1974
+ } else {
1975
+ this->destroy_val();
1976
+ ::new (errptr()) unexpected<E>(std::move(rhs));
1977
+ this->m_has_val = false;
1978
+ }
1979
+
1980
+ return *this;
1981
+ }
1982
+
1983
+ template<class... Args,
1984
+ detail::enable_if_t<std::is_nothrow_constructible<T, Args&&...>::value>* = nullptr>
1985
+ void emplace(Args&&... args)
1986
+ {
1987
+ if (has_value()) {
1988
+ val() = T(std::forward<Args>(args)...);
1989
+ } else {
1990
+ err().~unexpected<E>();
1991
+ ::new (valptr()) T(std::forward<Args>(args)...);
1992
+ this->m_has_val = true;
1993
+ }
1994
+ }
1995
+
1996
+ template<class... Args,
1997
+ detail::enable_if_t<!std::is_nothrow_constructible<T, Args&&...>::value>* = nullptr>
1998
+ void emplace(Args&&... args)
1999
+ {
2000
+ if (has_value()) {
2001
+ val() = T(std::forward<Args>(args)...);
2002
+ } else {
2003
+ auto tmp = std::move(err());
2004
+ err().~unexpected<E>();
1880
2005
 
1881
2006
  #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
1882
- try {
1883
- ::new (valptr()) T(std::forward<Args>(args)...);
1884
- this->m_has_val = true;
1885
- } catch (...) {
1886
- err() = std::move(tmp);
1887
- throw;
1888
- }
2007
+ try {
2008
+ ::new (valptr()) T(std::forward<Args>(args)...);
2009
+ this->m_has_val = true;
2010
+ } catch (...) {
2011
+ err() = std::move(tmp);
2012
+ throw;
2013
+ }
1889
2014
  #else
1890
- ::new (valptr()) T(std::forward<Args>(args)...);
1891
- this->m_has_val = true;
2015
+ ::new (valptr()) T(std::forward<Args>(args)...);
2016
+ this->m_has_val = true;
1892
2017
  #endif
1893
- }
1894
- }
1895
-
1896
- template<class U,
1897
- class... Args,
1898
- detail::enable_if_t<std::is_nothrow_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
1899
- void emplace(std::initializer_list<U> il, Args&&... args)
1900
- {
1901
- if (has_value()) {
1902
- T t(il, std::forward<Args>(args)...);
1903
- val() = std::move(t);
1904
- } else {
1905
- err().~unexpected<E>();
1906
- ::new (valptr()) T(il, std::forward<Args>(args)...);
1907
- this->m_has_val = true;
1908
- }
1909
2018
  }
1910
-
1911
- template<class U,
1912
- class... Args,
1913
- detail::enable_if_t<!std::is_nothrow_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
1914
- void emplace(std::initializer_list<U> il, Args&&... args)
1915
- {
1916
- if (has_value()) {
1917
- T t(il, std::forward<Args>(args)...);
1918
- val() = std::move(t);
1919
- } else {
1920
- auto tmp = std::move(err());
1921
- err().~unexpected<E>();
2019
+ }
2020
+
2021
+ template<
2022
+ class U,
2023
+ class... Args,
2024
+ detail::enable_if_t<
2025
+ std::is_nothrow_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
2026
+ void emplace(std::initializer_list<U> il, Args&&... args)
2027
+ {
2028
+ if (has_value()) {
2029
+ T t(il, std::forward<Args>(args)...);
2030
+ val() = std::move(t);
2031
+ } else {
2032
+ err().~unexpected<E>();
2033
+ ::new (valptr()) T(il, std::forward<Args>(args)...);
2034
+ this->m_has_val = true;
2035
+ }
2036
+ }
2037
+
2038
+ template<
2039
+ class U,
2040
+ class... Args,
2041
+ detail::enable_if_t<
2042
+ !std::is_nothrow_constructible<T, std::initializer_list<U>&, Args&&...>::value>* = nullptr>
2043
+ void emplace(std::initializer_list<U> il, Args&&... args)
2044
+ {
2045
+ if (has_value()) {
2046
+ T t(il, std::forward<Args>(args)...);
2047
+ val() = std::move(t);
2048
+ } else {
2049
+ auto tmp = std::move(err());
2050
+ err().~unexpected<E>();
1922
2051
 
1923
2052
  #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
1924
- try {
1925
- ::new (valptr()) T(il, std::forward<Args>(args)...);
1926
- this->m_has_val = true;
1927
- } catch (...) {
1928
- err() = std::move(tmp);
1929
- throw;
1930
- }
2053
+ try {
2054
+ ::new (valptr()) T(il, std::forward<Args>(args)...);
2055
+ this->m_has_val = true;
2056
+ } catch (...) {
2057
+ err() = std::move(tmp);
2058
+ throw;
2059
+ }
1931
2060
  #else
1932
- ::new (valptr()) T(il, std::forward<Args>(args)...);
1933
- this->m_has_val = true;
2061
+ ::new (valptr()) T(il, std::forward<Args>(args)...);
2062
+ this->m_has_val = true;
1934
2063
  #endif
1935
- }
1936
- }
1937
-
1938
- private:
1939
- using t_is_void = std::true_type;
1940
- using t_is_not_void = std::false_type;
1941
- using t_is_nothrow_move_constructible = std::true_type;
1942
- using move_constructing_t_can_throw = std::false_type;
1943
- using e_is_nothrow_move_constructible = std::true_type;
1944
- using move_constructing_e_can_throw = std::false_type;
1945
-
1946
- void swap_where_both_have_value(expected& /*rhs*/, t_is_void) noexcept
1947
- {
1948
- // swapping void is a no-op
1949
- }
1950
-
1951
- void swap_where_both_have_value(expected& rhs, t_is_not_void)
1952
- {
1953
- using std::swap;
1954
- swap(val(), rhs.val());
1955
2064
  }
1956
-
1957
- void swap_where_only_one_has_value(expected& rhs, t_is_void) noexcept(std::is_nothrow_move_constructible<E>::value)
1958
- {
1959
- ::new (errptr()) unexpected_type(std::move(rhs.err()));
1960
- rhs.err().~unexpected_type();
1961
- std::swap(this->m_has_val, rhs.m_has_val);
1962
- }
1963
-
1964
- void swap_where_only_one_has_value(expected& rhs, t_is_not_void)
1965
- {
1966
- swap_where_only_one_has_value_and_t_is_not_void(
1967
- rhs, typename std::is_nothrow_move_constructible<T>::type{}, typename std::is_nothrow_move_constructible<E>::type{});
1968
- }
1969
-
1970
- void swap_where_only_one_has_value_and_t_is_not_void(expected& rhs,
1971
- t_is_nothrow_move_constructible,
1972
- e_is_nothrow_move_constructible) noexcept
1973
- {
1974
- auto temp = std::move(val());
1975
- val().~T();
1976
- ::new (errptr()) unexpected_type(std::move(rhs.err()));
1977
- rhs.err().~unexpected_type();
1978
- ::new (rhs.valptr()) T(std::move(temp));
1979
- std::swap(this->m_has_val, rhs.m_has_val);
1980
- }
1981
-
1982
- void swap_where_only_one_has_value_and_t_is_not_void(expected& rhs, t_is_nothrow_move_constructible, move_constructing_e_can_throw)
1983
- {
1984
- auto temp = std::move(val());
1985
- val().~T();
2065
+ }
2066
+
2067
+ private:
2068
+ using t_is_void = std::true_type;
2069
+ using t_is_not_void = std::false_type;
2070
+ using t_is_nothrow_move_constructible = std::true_type;
2071
+ using move_constructing_t_can_throw = std::false_type;
2072
+ using e_is_nothrow_move_constructible = std::true_type;
2073
+ using move_constructing_e_can_throw = std::false_type;
2074
+
2075
+ void swap_where_both_have_value(expected& /*rhs*/, t_is_void) noexcept
2076
+ {
2077
+ // swapping void is a no-op
2078
+ }
2079
+
2080
+ void swap_where_both_have_value(expected& rhs, t_is_not_void)
2081
+ {
2082
+ using std::swap;
2083
+ swap(val(), rhs.val());
2084
+ }
2085
+
2086
+ void swap_where_only_one_has_value(expected& rhs, t_is_void) noexcept(
2087
+ std::is_nothrow_move_constructible<E>::value)
2088
+ {
2089
+ ::new (errptr()) unexpected_type(std::move(rhs.err()));
2090
+ rhs.err().~unexpected_type();
2091
+ std::swap(this->m_has_val, rhs.m_has_val);
2092
+ }
2093
+
2094
+ void swap_where_only_one_has_value(expected& rhs, t_is_not_void)
2095
+ {
2096
+ swap_where_only_one_has_value_and_t_is_not_void(
2097
+ rhs,
2098
+ typename std::is_nothrow_move_constructible<T>::type{},
2099
+ typename std::is_nothrow_move_constructible<E>::type{});
2100
+ }
2101
+
2102
+ void swap_where_only_one_has_value_and_t_is_not_void(expected& rhs,
2103
+ t_is_nothrow_move_constructible,
2104
+ e_is_nothrow_move_constructible) noexcept
2105
+ {
2106
+ auto temp = std::move(val());
2107
+ val().~T();
2108
+ ::new (errptr()) unexpected_type(std::move(rhs.err()));
2109
+ rhs.err().~unexpected_type();
2110
+ ::new (rhs.valptr()) T(std::move(temp));
2111
+ std::swap(this->m_has_val, rhs.m_has_val);
2112
+ }
2113
+
2114
+ void swap_where_only_one_has_value_and_t_is_not_void(expected& rhs,
2115
+ t_is_nothrow_move_constructible,
2116
+ move_constructing_e_can_throw)
2117
+ {
2118
+ auto temp = std::move(val());
2119
+ val().~T();
1986
2120
  #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
1987
- try {
1988
- ::new (errptr()) unexpected_type(std::move(rhs.err()));
1989
- rhs.err().~unexpected_type();
1990
- ::new (rhs.valptr()) T(std::move(temp));
1991
- std::swap(this->m_has_val, rhs.m_has_val);
1992
- } catch (...) {
1993
- val() = std::move(temp);
1994
- throw;
1995
- }
2121
+ try {
2122
+ ::new (errptr()) unexpected_type(std::move(rhs.err()));
2123
+ rhs.err().~unexpected_type();
2124
+ ::new (rhs.valptr()) T(std::move(temp));
2125
+ std::swap(this->m_has_val, rhs.m_has_val);
2126
+ } catch (...) {
2127
+ val() = std::move(temp);
2128
+ throw;
2129
+ }
1996
2130
  #else
1997
- ::new (errptr()) unexpected_type(std::move(rhs.err()));
1998
- rhs.err().~unexpected_type();
1999
- ::new (rhs.valptr()) T(std::move(temp));
2000
- std::swap(this->m_has_val, rhs.m_has_val);
2131
+ ::new (errptr()) unexpected_type(std::move(rhs.err()));
2132
+ rhs.err().~unexpected_type();
2133
+ ::new (rhs.valptr()) T(std::move(temp));
2134
+ std::swap(this->m_has_val, rhs.m_has_val);
2001
2135
  #endif
2002
- }
2003
-
2004
- void swap_where_only_one_has_value_and_t_is_not_void(expected& rhs, move_constructing_t_can_throw, t_is_nothrow_move_constructible)
2005
- {
2006
- auto temp = std::move(rhs.err());
2007
- rhs.err().~unexpected_type();
2136
+ }
2137
+
2138
+ void swap_where_only_one_has_value_and_t_is_not_void(expected& rhs,
2139
+ move_constructing_t_can_throw,
2140
+ t_is_nothrow_move_constructible)
2141
+ {
2142
+ auto temp = std::move(rhs.err());
2143
+ rhs.err().~unexpected_type();
2008
2144
  #ifdef TL_EXPECTED_EXCEPTIONS_ENABLED
2009
- try {
2010
- ::new (rhs.valptr()) T(val());
2011
- val().~T();
2012
- ::new (errptr()) unexpected_type(std::move(temp));
2013
- std::swap(this->m_has_val, rhs.m_has_val);
2014
- } catch (...) {
2015
- rhs.err() = std::move(temp);
2016
- throw;
2017
- }
2145
+ try {
2146
+ ::new (rhs.valptr()) T(val());
2147
+ val().~T();
2148
+ ::new (errptr()) unexpected_type(std::move(temp));
2149
+ std::swap(this->m_has_val, rhs.m_has_val);
2150
+ } catch (...) {
2151
+ rhs.err() = std::move(temp);
2152
+ throw;
2153
+ }
2018
2154
  #else
2019
- ::new (rhs.valptr()) T(val());
2020
- val().~T();
2021
- ::new (errptr()) unexpected_type(std::move(temp));
2022
- std::swap(this->m_has_val, rhs.m_has_val);
2155
+ ::new (rhs.valptr()) T(val());
2156
+ val().~T();
2157
+ ::new (errptr()) unexpected_type(std::move(temp));
2158
+ std::swap(this->m_has_val, rhs.m_has_val);
2023
2159
  #endif
2024
- }
2025
-
2026
- public:
2027
- template<class OT = T, class OE = E>
2028
- detail::enable_if_t<detail::is_swappable<OT>::value && detail::is_swappable<OE>::value &&
2029
- (std::is_nothrow_move_constructible<OT>::value || std::is_nothrow_move_constructible<OE>::value)>
2030
- swap(expected& rhs) noexcept(std::is_nothrow_move_constructible<T>::value&& detail::is_nothrow_swappable<T>::value&&
2031
- std::is_nothrow_move_constructible<E>::value&& detail::is_nothrow_swappable<E>::value)
2032
- {
2033
- if (has_value() && rhs.has_value()) {
2034
- swap_where_both_have_value(rhs, typename std::is_void<T>::type{});
2035
- } else if (!has_value() && rhs.has_value()) {
2036
- rhs.swap(*this);
2037
- } else if (has_value()) {
2038
- swap_where_only_one_has_value(rhs, typename std::is_void<T>::type{});
2039
- } else {
2040
- using std::swap;
2041
- swap(err(), rhs.err());
2042
- }
2043
- }
2044
-
2045
- constexpr const T* operator->() const
2046
- {
2047
- return valptr();
2048
- }
2049
- TL_EXPECTED_11_CONSTEXPR T* operator->()
2050
- {
2051
- return valptr();
2052
- }
2053
-
2054
- template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2055
- constexpr const U& operator*() const&
2056
- {
2057
- return val();
2058
- }
2059
- template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2060
- TL_EXPECTED_11_CONSTEXPR U& operator*() &
2061
- {
2062
- return val();
2063
- }
2064
- template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2065
- constexpr const U&& operator*() const&&
2066
- {
2067
- return std::move(val());
2068
- }
2069
- template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2070
- TL_EXPECTED_11_CONSTEXPR U&& operator*() &&
2071
- {
2072
- return std::move(val());
2073
- }
2074
-
2075
- constexpr bool has_value() const noexcept
2076
- {
2077
- return this->m_has_val;
2078
- }
2079
- constexpr explicit operator bool() const noexcept
2080
- {
2081
- return this->m_has_val;
2082
- }
2083
-
2084
- template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2085
- TL_EXPECTED_11_CONSTEXPR const U& value() const&
2086
- {
2087
- if (!has_value())
2088
- detail::throw_exception(bad_expected_access<E>(err().value()));
2089
- return val();
2090
- }
2091
- template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2092
- TL_EXPECTED_11_CONSTEXPR U& value() &
2093
- {
2094
- if (!has_value())
2095
- detail::throw_exception(bad_expected_access<E>(err().value()));
2096
- return val();
2097
- }
2098
- template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2099
- TL_EXPECTED_11_CONSTEXPR const U&& value() const&&
2100
- {
2101
- if (!has_value())
2102
- detail::throw_exception(bad_expected_access<E>(std::move(err()).value()));
2103
- return std::move(val());
2104
- }
2105
- template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2106
- TL_EXPECTED_11_CONSTEXPR U&& value() &&
2107
- {
2108
- if (!has_value())
2109
- detail::throw_exception(bad_expected_access<E>(std::move(err()).value()));
2110
- return std::move(val());
2111
- }
2112
-
2113
- constexpr const E& error() const&
2114
- {
2115
- return err().value();
2116
- }
2117
- TL_EXPECTED_11_CONSTEXPR E& error() &
2118
- {
2119
- return err().value();
2120
- }
2121
- constexpr const E&& error() const&&
2122
- {
2123
- return std::move(err().value());
2124
- }
2125
- TL_EXPECTED_11_CONSTEXPR E&& error() &&
2126
- {
2127
- return std::move(err().value());
2128
- }
2129
-
2130
- template<class U>
2131
- constexpr T value_or(U&& v) const&
2132
- {
2133
- static_assert(std::is_copy_constructible<T>::value && std::is_convertible<U&&, T>::value,
2134
- "T must be copy-constructible and convertible to from U&&");
2135
- return bool(*this) ? **this : static_cast<T>(std::forward<U>(v));
2136
- }
2137
- template<class U>
2138
- TL_EXPECTED_11_CONSTEXPR T value_or(U&& v) &&
2139
- {
2140
- static_assert(std::is_move_constructible<T>::value && std::is_convertible<U&&, T>::value,
2141
- "T must be move-constructible and convertible to from U&&");
2142
- return bool(*this) ? std::move(**this) : static_cast<T>(std::forward<U>(v));
2143
- }
2160
+ }
2161
+
2162
+ public:
2163
+ template<class OT = T, class OE = E>
2164
+ detail::enable_if_t<detail::is_swappable<OT>::value && detail::is_swappable<OE>::value &&
2165
+ (std::is_nothrow_move_constructible<OT>::value ||
2166
+ std::is_nothrow_move_constructible<OE>::value)>
2167
+ swap(expected& rhs) noexcept(std::is_nothrow_move_constructible<T>::value &&
2168
+ detail::is_nothrow_swappable<T>::value &&
2169
+ std::is_nothrow_move_constructible<E>::value &&
2170
+ detail::is_nothrow_swappable<E>::value)
2171
+ {
2172
+ if (has_value() && rhs.has_value()) {
2173
+ swap_where_both_have_value(rhs, typename std::is_void<T>::type{});
2174
+ } else if (!has_value() && rhs.has_value()) {
2175
+ rhs.swap(*this);
2176
+ } else if (has_value()) {
2177
+ swap_where_only_one_has_value(rhs, typename std::is_void<T>::type{});
2178
+ } else {
2179
+ using std::swap;
2180
+ swap(err(), rhs.err());
2181
+ }
2182
+ }
2183
+
2184
+ constexpr const T* operator->() const
2185
+ {
2186
+ return valptr();
2187
+ }
2188
+ TL_EXPECTED_11_CONSTEXPR T* operator->()
2189
+ {
2190
+ return valptr();
2191
+ }
2192
+
2193
+ template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2194
+ constexpr const U& operator*() const&
2195
+ {
2196
+ return val();
2197
+ }
2198
+ template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2199
+ TL_EXPECTED_11_CONSTEXPR U& operator*() &
2200
+ {
2201
+ return val();
2202
+ }
2203
+ template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2204
+ constexpr const U&& operator*() const&&
2205
+ {
2206
+ return std::move(val());
2207
+ }
2208
+ template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2209
+ TL_EXPECTED_11_CONSTEXPR U&& operator*() &&
2210
+ {
2211
+ return std::move(val());
2212
+ }
2213
+
2214
+ constexpr bool has_value() const noexcept
2215
+ {
2216
+ return this->m_has_val;
2217
+ }
2218
+ constexpr explicit operator bool() const noexcept
2219
+ {
2220
+ return this->m_has_val;
2221
+ }
2222
+
2223
+ template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2224
+ TL_EXPECTED_11_CONSTEXPR const U& value() const&
2225
+ {
2226
+ if (!has_value())
2227
+ detail::throw_exception(bad_expected_access<E>(err().value()));
2228
+ return val();
2229
+ }
2230
+ template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2231
+ TL_EXPECTED_11_CONSTEXPR U& value() &
2232
+ {
2233
+ if (!has_value())
2234
+ detail::throw_exception(bad_expected_access<E>(err().value()));
2235
+ return val();
2236
+ }
2237
+ template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2238
+ TL_EXPECTED_11_CONSTEXPR const U&& value() const&&
2239
+ {
2240
+ if (!has_value())
2241
+ detail::throw_exception(bad_expected_access<E>(std::move(err()).value()));
2242
+ return std::move(val());
2243
+ }
2244
+ template<class U = T, detail::enable_if_t<!std::is_void<U>::value>* = nullptr>
2245
+ TL_EXPECTED_11_CONSTEXPR U&& value() &&
2246
+ {
2247
+ if (!has_value())
2248
+ detail::throw_exception(bad_expected_access<E>(std::move(err()).value()));
2249
+ return std::move(val());
2250
+ }
2251
+
2252
+ constexpr const E& error() const&
2253
+ {
2254
+ return err().value();
2255
+ }
2256
+ TL_EXPECTED_11_CONSTEXPR E& error() &
2257
+ {
2258
+ return err().value();
2259
+ }
2260
+ constexpr const E&& error() const&&
2261
+ {
2262
+ return std::move(err().value());
2263
+ }
2264
+ TL_EXPECTED_11_CONSTEXPR E&& error() &&
2265
+ {
2266
+ return std::move(err().value());
2267
+ }
2268
+
2269
+ template<class U>
2270
+ constexpr T value_or(U&& v) const&
2271
+ {
2272
+ static_assert(std::is_copy_constructible<T>::value && std::is_convertible<U&&, T>::value,
2273
+ "T must be copy-constructible and convertible to from U&&");
2274
+ return bool(*this) ? **this : static_cast<T>(std::forward<U>(v));
2275
+ }
2276
+ template<class U>
2277
+ TL_EXPECTED_11_CONSTEXPR T value_or(U&& v) &&
2278
+ {
2279
+ static_assert(std::is_move_constructible<T>::value && std::is_convertible<U&&, T>::value,
2280
+ "T must be move-constructible and convertible to from U&&");
2281
+ return bool(*this) ? std::move(**this) : static_cast<T>(std::forward<U>(v));
2282
+ }
2144
2283
  };
2145
2284
 
2146
2285
  namespace detail
@@ -2160,9 +2299,10 @@ template<class Exp,
2160
2299
  constexpr auto
2161
2300
  and_then_impl(Exp&& exp, F&& f)
2162
2301
  {
2163
- static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2302
+ static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2164
2303
 
2165
- return exp.has_value() ? detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp)) : Ret(unexpect, std::forward<Exp>(exp).error());
2304
+ return exp.has_value() ? detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp))
2305
+ : Ret(unexpect, std::forward<Exp>(exp).error());
2166
2306
  }
2167
2307
 
2168
2308
  template<class Exp,
@@ -2172,9 +2312,10 @@ template<class Exp,
2172
2312
  constexpr auto
2173
2313
  and_then_impl(Exp&& exp, F&& f)
2174
2314
  {
2175
- static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2315
+ static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2176
2316
 
2177
- return exp.has_value() ? detail::invoke(std::forward<F>(f)) : Ret(unexpect, std::forward<Exp>(exp).error());
2317
+ return exp.has_value() ? detail::invoke(std::forward<F>(f))
2318
+ : Ret(unexpect, std::forward<Exp>(exp).error());
2178
2319
  }
2179
2320
  #else
2180
2321
  template<class>
@@ -2186,9 +2327,10 @@ template<class Exp,
2186
2327
  auto
2187
2328
  and_then_impl(Exp&& exp, F&& f) -> Ret
2188
2329
  {
2189
- static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2330
+ static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2190
2331
 
2191
- return exp.has_value() ? detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp)) : Ret(unexpect, std::forward<Exp>(exp).error());
2332
+ return exp.has_value() ? detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp))
2333
+ : Ret(unexpect, std::forward<Exp>(exp).error());
2192
2334
  }
2193
2335
 
2194
2336
  template<class Exp,
@@ -2198,9 +2340,10 @@ template<class Exp,
2198
2340
  constexpr auto
2199
2341
  and_then_impl(Exp&& exp, F&& f) -> Ret
2200
2342
  {
2201
- static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2343
+ static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2202
2344
 
2203
- return exp.has_value() ? detail::invoke(std::forward<F>(f)) : Ret(unexpect, std::forward<Exp>(exp).error());
2345
+ return exp.has_value() ? detail::invoke(std::forward<F>(f))
2346
+ : Ret(unexpect, std::forward<Exp>(exp).error());
2204
2347
  }
2205
2348
  #endif
2206
2349
 
@@ -2213,9 +2356,9 @@ template<class Exp,
2213
2356
  constexpr auto
2214
2357
  expected_map_impl(Exp&& exp, F&& f)
2215
2358
  {
2216
- using result = ret_t<Exp, detail::decay_t<Ret>>;
2217
- return exp.has_value() ? result(detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp)))
2218
- : result(unexpect, std::forward<Exp>(exp).error());
2359
+ using result = ret_t<Exp, detail::decay_t<Ret>>;
2360
+ return exp.has_value() ? result(detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp)))
2361
+ : result(unexpect, std::forward<Exp>(exp).error());
2219
2362
  }
2220
2363
 
2221
2364
  template<class Exp,
@@ -2226,13 +2369,13 @@ template<class Exp,
2226
2369
  auto
2227
2370
  expected_map_impl(Exp&& exp, F&& f)
2228
2371
  {
2229
- using result = expected<void, err_t<Exp>>;
2230
- if (exp.has_value()) {
2231
- detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp));
2232
- return result();
2233
- }
2372
+ using result = expected<void, err_t<Exp>>;
2373
+ if (exp.has_value()) {
2374
+ detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp));
2375
+ return result();
2376
+ }
2234
2377
 
2235
- return result(unexpect, std::forward<Exp>(exp).error());
2378
+ return result(unexpect, std::forward<Exp>(exp).error());
2236
2379
  }
2237
2380
 
2238
2381
  template<class Exp,
@@ -2243,8 +2386,9 @@ template<class Exp,
2243
2386
  constexpr auto
2244
2387
  expected_map_impl(Exp&& exp, F&& f)
2245
2388
  {
2246
- using result = ret_t<Exp, detail::decay_t<Ret>>;
2247
- return exp.has_value() ? result(detail::invoke(std::forward<F>(f))) : result(unexpect, std::forward<Exp>(exp).error());
2389
+ using result = ret_t<Exp, detail::decay_t<Ret>>;
2390
+ return exp.has_value() ? result(detail::invoke(std::forward<F>(f)))
2391
+ : result(unexpect, std::forward<Exp>(exp).error());
2248
2392
  }
2249
2393
 
2250
2394
  template<class Exp,
@@ -2255,13 +2399,13 @@ template<class Exp,
2255
2399
  auto
2256
2400
  expected_map_impl(Exp&& exp, F&& f)
2257
2401
  {
2258
- using result = expected<void, err_t<Exp>>;
2259
- if (exp.has_value()) {
2260
- detail::invoke(std::forward<F>(f));
2261
- return result();
2262
- }
2402
+ using result = expected<void, err_t<Exp>>;
2403
+ if (exp.has_value()) {
2404
+ detail::invoke(std::forward<F>(f));
2405
+ return result();
2406
+ }
2263
2407
 
2264
- return result(unexpect, std::forward<Exp>(exp).error());
2408
+ return result(unexpect, std::forward<Exp>(exp).error());
2265
2409
  }
2266
2410
  #else
2267
2411
  template<class Exp,
@@ -2273,10 +2417,10 @@ template<class Exp,
2273
2417
  constexpr auto
2274
2418
  expected_map_impl(Exp&& exp, F&& f) -> ret_t<Exp, detail::decay_t<Ret>>
2275
2419
  {
2276
- using result = ret_t<Exp, detail::decay_t<Ret>>;
2420
+ using result = ret_t<Exp, detail::decay_t<Ret>>;
2277
2421
 
2278
- return exp.has_value() ? result(detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp)))
2279
- : result(unexpect, std::forward<Exp>(exp).error());
2422
+ return exp.has_value() ? result(detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp)))
2423
+ : result(unexpect, std::forward<Exp>(exp).error());
2280
2424
  }
2281
2425
 
2282
2426
  template<class Exp,
@@ -2288,12 +2432,12 @@ template<class Exp,
2288
2432
  auto
2289
2433
  expected_map_impl(Exp&& exp, F&& f) -> expected<void, err_t<Exp>>
2290
2434
  {
2291
- if (exp.has_value()) {
2292
- detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp));
2293
- return {};
2294
- }
2435
+ if (exp.has_value()) {
2436
+ detail::invoke(std::forward<F>(f), *std::forward<Exp>(exp));
2437
+ return {};
2438
+ }
2295
2439
 
2296
- return unexpected<err_t<Exp>>(std::forward<Exp>(exp).error());
2440
+ return unexpected<err_t<Exp>>(std::forward<Exp>(exp).error());
2297
2441
  }
2298
2442
 
2299
2443
  template<class Exp,
@@ -2305,9 +2449,10 @@ template<class Exp,
2305
2449
  constexpr auto
2306
2450
  expected_map_impl(Exp&& exp, F&& f) -> ret_t<Exp, detail::decay_t<Ret>>
2307
2451
  {
2308
- using result = ret_t<Exp, detail::decay_t<Ret>>;
2452
+ using result = ret_t<Exp, detail::decay_t<Ret>>;
2309
2453
 
2310
- return exp.has_value() ? result(detail::invoke(std::forward<F>(f))) : result(unexpect, std::forward<Exp>(exp).error());
2454
+ return exp.has_value() ? result(detail::invoke(std::forward<F>(f)))
2455
+ : result(unexpect, std::forward<Exp>(exp).error());
2311
2456
  }
2312
2457
 
2313
2458
  template<class Exp,
@@ -2319,16 +2464,17 @@ template<class Exp,
2319
2464
  auto
2320
2465
  expected_map_impl(Exp&& exp, F&& f) -> expected<void, err_t<Exp>>
2321
2466
  {
2322
- if (exp.has_value()) {
2323
- detail::invoke(std::forward<F>(f));
2324
- return {};
2325
- }
2467
+ if (exp.has_value()) {
2468
+ detail::invoke(std::forward<F>(f));
2469
+ return {};
2470
+ }
2326
2471
 
2327
- return unexpected<err_t<Exp>>(std::forward<Exp>(exp).error());
2472
+ return unexpected<err_t<Exp>>(std::forward<Exp>(exp).error());
2328
2473
  }
2329
2474
  #endif
2330
2475
 
2331
- #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && !defined(TL_EXPECTED_GCC54) && !defined(TL_EXPECTED_GCC55)
2476
+ #if defined(TL_EXPECTED_CXX14) && !defined(TL_EXPECTED_GCC49) && !defined(TL_EXPECTED_GCC54) && \
2477
+ !defined(TL_EXPECTED_GCC55)
2332
2478
  template<class Exp,
2333
2479
  class F,
2334
2480
  detail::enable_if_t<!std::is_void<exp_t<Exp>>::value>* = nullptr,
@@ -2337,9 +2483,10 @@ template<class Exp,
2337
2483
  constexpr auto
2338
2484
  map_error_impl(Exp&& exp, F&& f)
2339
2485
  {
2340
- using result = expected<exp_t<Exp>, detail::decay_t<Ret>>;
2341
- return exp.has_value() ? result(*std::forward<Exp>(exp))
2342
- : result(unexpect, detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()));
2486
+ using result = expected<exp_t<Exp>, detail::decay_t<Ret>>;
2487
+ return exp.has_value()
2488
+ ? result(*std::forward<Exp>(exp))
2489
+ : result(unexpect, detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()));
2343
2490
  }
2344
2491
  template<class Exp,
2345
2492
  class F,
@@ -2349,13 +2496,13 @@ template<class Exp,
2349
2496
  auto
2350
2497
  map_error_impl(Exp&& exp, F&& f)
2351
2498
  {
2352
- using result = expected<exp_t<Exp>, monostate>;
2353
- if (exp.has_value()) {
2354
- return result(*std::forward<Exp>(exp));
2355
- }
2499
+ using result = expected<exp_t<Exp>, monostate>;
2500
+ if (exp.has_value()) {
2501
+ return result(*std::forward<Exp>(exp));
2502
+ }
2356
2503
 
2357
- detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error());
2358
- return result(unexpect, monostate{});
2504
+ detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error());
2505
+ return result(unexpect, monostate{});
2359
2506
  }
2360
2507
  template<class Exp,
2361
2508
  class F,
@@ -2365,8 +2512,10 @@ template<class Exp,
2365
2512
  constexpr auto
2366
2513
  map_error_impl(Exp&& exp, F&& f)
2367
2514
  {
2368
- using result = expected<exp_t<Exp>, detail::decay_t<Ret>>;
2369
- return exp.has_value() ? result() : result(unexpect, detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()));
2515
+ using result = expected<exp_t<Exp>, detail::decay_t<Ret>>;
2516
+ return exp.has_value()
2517
+ ? result()
2518
+ : result(unexpect, detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()));
2370
2519
  }
2371
2520
  template<class Exp,
2372
2521
  class F,
@@ -2376,13 +2525,13 @@ template<class Exp,
2376
2525
  auto
2377
2526
  map_error_impl(Exp&& exp, F&& f)
2378
2527
  {
2379
- using result = expected<exp_t<Exp>, monostate>;
2380
- if (exp.has_value()) {
2381
- return result();
2382
- }
2528
+ using result = expected<exp_t<Exp>, monostate>;
2529
+ if (exp.has_value()) {
2530
+ return result();
2531
+ }
2383
2532
 
2384
- detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error());
2385
- return result(unexpect, monostate{});
2533
+ detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error());
2534
+ return result(unexpect, monostate{});
2386
2535
  }
2387
2536
  #else
2388
2537
  template<class Exp,
@@ -2393,10 +2542,11 @@ template<class Exp,
2393
2542
  constexpr auto
2394
2543
  map_error_impl(Exp&& exp, F&& f) -> expected<exp_t<Exp>, detail::decay_t<Ret>>
2395
2544
  {
2396
- using result = expected<exp_t<Exp>, detail::decay_t<Ret>>;
2545
+ using result = expected<exp_t<Exp>, detail::decay_t<Ret>>;
2397
2546
 
2398
- return exp.has_value() ? result(*std::forward<Exp>(exp))
2399
- : result(unexpect, detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()));
2547
+ return exp.has_value()
2548
+ ? result(*std::forward<Exp>(exp))
2549
+ : result(unexpect, detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()));
2400
2550
  }
2401
2551
 
2402
2552
  template<class Exp,
@@ -2407,13 +2557,13 @@ template<class Exp,
2407
2557
  auto
2408
2558
  map_error_impl(Exp&& exp, F&& f) -> expected<exp_t<Exp>, monostate>
2409
2559
  {
2410
- using result = expected<exp_t<Exp>, monostate>;
2411
- if (exp.has_value()) {
2412
- return result(*std::forward<Exp>(exp));
2413
- }
2560
+ using result = expected<exp_t<Exp>, monostate>;
2561
+ if (exp.has_value()) {
2562
+ return result(*std::forward<Exp>(exp));
2563
+ }
2414
2564
 
2415
- detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error());
2416
- return result(unexpect, monostate{});
2565
+ detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error());
2566
+ return result(unexpect, monostate{});
2417
2567
  }
2418
2568
 
2419
2569
  template<class Exp,
@@ -2424,9 +2574,11 @@ template<class Exp,
2424
2574
  constexpr auto
2425
2575
  map_error_impl(Exp&& exp, F&& f) -> expected<exp_t<Exp>, detail::decay_t<Ret>>
2426
2576
  {
2427
- using result = expected<exp_t<Exp>, detail::decay_t<Ret>>;
2577
+ using result = expected<exp_t<Exp>, detail::decay_t<Ret>>;
2428
2578
 
2429
- return exp.has_value() ? result() : result(unexpect, detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()));
2579
+ return exp.has_value()
2580
+ ? result()
2581
+ : result(unexpect, detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()));
2430
2582
  }
2431
2583
 
2432
2584
  template<class Exp,
@@ -2437,13 +2589,13 @@ template<class Exp,
2437
2589
  auto
2438
2590
  map_error_impl(Exp&& exp, F&& f) -> expected<exp_t<Exp>, monostate>
2439
2591
  {
2440
- using result = expected<exp_t<Exp>, monostate>;
2441
- if (exp.has_value()) {
2442
- return result();
2443
- }
2592
+ using result = expected<exp_t<Exp>, monostate>;
2593
+ if (exp.has_value()) {
2594
+ return result();
2595
+ }
2444
2596
 
2445
- detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error());
2446
- return result(unexpect, monostate{});
2597
+ detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error());
2598
+ return result(unexpect, monostate{});
2447
2599
  }
2448
2600
  #endif
2449
2601
 
@@ -2455,8 +2607,9 @@ template<class Exp,
2455
2607
  constexpr auto
2456
2608
  or_else_impl(Exp&& exp, F&& f)
2457
2609
  {
2458
- static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2459
- return exp.has_value() ? std::forward<Exp>(exp) : detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error());
2610
+ static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2611
+ return exp.has_value() ? std::forward<Exp>(exp)
2612
+ : detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error());
2460
2613
  }
2461
2614
 
2462
2615
  template<class Exp,
@@ -2466,8 +2619,9 @@ template<class Exp,
2466
2619
  detail::decay_t<Exp>
2467
2620
  or_else_impl(Exp&& exp, F&& f)
2468
2621
  {
2469
- return exp.has_value() ? std::forward<Exp>(exp)
2470
- : (detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()), std::forward<Exp>(exp));
2622
+ return exp.has_value() ? std::forward<Exp>(exp)
2623
+ : (detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()),
2624
+ std::forward<Exp>(exp));
2471
2625
  }
2472
2626
  #else
2473
2627
  template<class Exp,
@@ -2477,8 +2631,9 @@ template<class Exp,
2477
2631
  auto
2478
2632
  or_else_impl(Exp&& exp, F&& f) -> Ret
2479
2633
  {
2480
- static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2481
- return exp.has_value() ? std::forward<Exp>(exp) : detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error());
2634
+ static_assert(detail::is_expected<Ret>::value, "F must return an expected");
2635
+ return exp.has_value() ? std::forward<Exp>(exp)
2636
+ : detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error());
2482
2637
  }
2483
2638
 
2484
2639
  template<class Exp,
@@ -2488,8 +2643,9 @@ template<class Exp,
2488
2643
  detail::decay_t<Exp>
2489
2644
  or_else_impl(Exp&& exp, F&& f)
2490
2645
  {
2491
- return exp.has_value() ? std::forward<Exp>(exp)
2492
- : (detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()), std::forward<Exp>(exp));
2646
+ return exp.has_value() ? std::forward<Exp>(exp)
2647
+ : (detail::invoke(std::forward<F>(f), std::forward<Exp>(exp).error()),
2648
+ std::forward<Exp>(exp));
2493
2649
  }
2494
2650
  #endif
2495
2651
  } // namespace detail
@@ -2498,73 +2654,79 @@ template<class T, class E, class U, class F>
2498
2654
  constexpr bool
2499
2655
  operator==(const expected<T, E>& lhs, const expected<U, F>& rhs)
2500
2656
  {
2501
- return (lhs.has_value() != rhs.has_value()) ? false : (!lhs.has_value() ? lhs.error() == rhs.error() : *lhs == *rhs);
2657
+ return (lhs.has_value() != rhs.has_value())
2658
+ ? false
2659
+ : (!lhs.has_value() ? lhs.error() == rhs.error() : *lhs == *rhs);
2502
2660
  }
2503
2661
  template<class T, class E, class U, class F>
2504
2662
  constexpr bool
2505
2663
  operator!=(const expected<T, E>& lhs, const expected<U, F>& rhs)
2506
2664
  {
2507
- return (lhs.has_value() != rhs.has_value()) ? true : (!lhs.has_value() ? lhs.error() != rhs.error() : *lhs != *rhs);
2665
+ return (lhs.has_value() != rhs.has_value())
2666
+ ? true
2667
+ : (!lhs.has_value() ? lhs.error() != rhs.error() : *lhs != *rhs);
2508
2668
  }
2509
2669
 
2510
2670
  template<class T, class E, class U>
2511
2671
  constexpr bool
2512
2672
  operator==(const expected<T, E>& x, const U& v)
2513
2673
  {
2514
- return x.has_value() ? *x == v : false;
2674
+ return x.has_value() ? *x == v : false;
2515
2675
  }
2516
2676
  template<class T, class E, class U>
2517
2677
  constexpr bool
2518
2678
  operator==(const U& v, const expected<T, E>& x)
2519
2679
  {
2520
- return x.has_value() ? *x == v : false;
2680
+ return x.has_value() ? *x == v : false;
2521
2681
  }
2522
2682
  template<class T, class E, class U>
2523
2683
  constexpr bool
2524
2684
  operator!=(const expected<T, E>& x, const U& v)
2525
2685
  {
2526
- return x.has_value() ? *x != v : true;
2686
+ return x.has_value() ? *x != v : true;
2527
2687
  }
2528
2688
  template<class T, class E, class U>
2529
2689
  constexpr bool
2530
2690
  operator!=(const U& v, const expected<T, E>& x)
2531
2691
  {
2532
- return x.has_value() ? *x != v : true;
2692
+ return x.has_value() ? *x != v : true;
2533
2693
  }
2534
2694
 
2535
2695
  template<class T, class E>
2536
2696
  constexpr bool
2537
2697
  operator==(const expected<T, E>& x, const unexpected<E>& e)
2538
2698
  {
2539
- return x.has_value() ? false : x.error() == e.value();
2699
+ return x.has_value() ? false : x.error() == e.value();
2540
2700
  }
2541
2701
  template<class T, class E>
2542
2702
  constexpr bool
2543
2703
  operator==(const unexpected<E>& e, const expected<T, E>& x)
2544
2704
  {
2545
- return x.has_value() ? false : x.error() == e.value();
2705
+ return x.has_value() ? false : x.error() == e.value();
2546
2706
  }
2547
2707
  template<class T, class E>
2548
2708
  constexpr bool
2549
2709
  operator!=(const expected<T, E>& x, const unexpected<E>& e)
2550
2710
  {
2551
- return x.has_value() ? true : x.error() != e.value();
2711
+ return x.has_value() ? true : x.error() != e.value();
2552
2712
  }
2553
2713
  template<class T, class E>
2554
2714
  constexpr bool
2555
2715
  operator!=(const unexpected<E>& e, const expected<T, E>& x)
2556
2716
  {
2557
- return x.has_value() ? true : x.error() != e.value();
2717
+ return x.has_value() ? true : x.error() != e.value();
2558
2718
  }
2559
2719
 
2560
- template<class T,
2561
- class E,
2562
- detail::enable_if_t<(std::is_void<T>::value || std::is_move_constructible<T>::value) && detail::is_swappable<T>::value &&
2563
- std::is_move_constructible<E>::value && detail::is_swappable<E>::value>* = nullptr>
2720
+ template<
2721
+ class T,
2722
+ class E,
2723
+ detail::enable_if_t<(std::is_void<T>::value || std::is_move_constructible<T>::value) &&
2724
+ detail::is_swappable<T>::value && std::is_move_constructible<E>::value &&
2725
+ detail::is_swappable<E>::value>* = nullptr>
2564
2726
  void
2565
2727
  swap(expected<T, E>& lhs, expected<T, E>& rhs) noexcept(noexcept(lhs.swap(rhs)))
2566
2728
  {
2567
- lhs.swap(rhs);
2729
+ lhs.swap(rhs);
2568
2730
  }
2569
2731
  } // namespace tl
2570
2732