From 8bf8fc3a01eb943546ca9c07ac1fc07a23ee46f3 Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Thu, 27 Aug 2026 19:20:09 -0400 Subject: [PATCH 1/3] chore: migrate from deprecated absl types to std equivalents --- MODULE.bazel | 2 +- .../v1/golden_kitchen_sink_connection.cc | 2 +- .../golden_kitchen_sink_connection_impl.cc | 2 +- .../golden_kitchen_sink_metadata_decorator.cc | 2 +- ...en_kitchen_sink_rest_metadata_decorator.cc | 2 +- .../tests/golden_kitchen_sink_client_test.cc | 2 +- generator/internal/connection_generator.cc | 2 +- .../internal/connection_impl_generator.cc | 2 +- generator/internal/descriptor_utils.cc | 1 - generator/internal/descriptor_utils.h | 1 - generator/internal/http_annotation_parser.cc | 5 +- generator/internal/http_annotation_parser.h | 4 +- .../internal/http_annotation_parser_test.cc | 15 ++-- generator/internal/http_option_utils.cc | 11 +-- generator/internal/longrunning.cc | 31 ++++--- .../internal/metadata_decorator_generator.cc | 2 +- .../metadata_decorator_rest_generator.cc | 2 +- .../featurestore_online_serving_connection.cc | 2 +- ...urestore_online_serving_connection_impl.cc | 2 +- .../v1/internal/prediction_connection_impl.cc | 6 +- .../internal/tensorboard_connection_impl.cc | 2 +- .../aiplatform/v1/prediction_connection.cc | 6 +- .../aiplatform/v1/tensorboard_connection.cc | 2 +- .../hive/v1/hive_metastore_connection.cc | 2 +- .../hive_metastore_connection_impl.cc | 2 +- .../storage/v1/bigquery_read_connection.cc | 2 +- .../internal/bigquery_read_connection_impl.cc | 2 +- .../minimal/internal/common_v2_resources.cc | 11 +-- .../v2/minimal/internal/common_v2_resources.h | 10 +-- .../v2/minimal/internal/dataset_connection.cc | 2 +- .../v2/minimal/internal/job_connection.cc | 2 +- .../v2/minimal/internal/project_connection.cc | 2 +- .../v2/minimal/internal/table_connection.cc | 2 +- google/cloud/bigtable/column_family.h | 6 +- google/cloud/bigtable/filters.h | 6 +- .../bigtable/internal/async_streaming_read.h | 1 - .../bigtable/internal/default_row_reader.cc | 11 +-- .../bigtable/internal/default_row_reader.h | 6 +- .../cloud/bigtable/internal/row_reader_impl.h | 6 +- .../bigtable/internal/traced_row_reader.cc | 2 +- .../cloud/bigtable/mocks/mock_row_reader.cc | 2 +- google/cloud/bigtable/mutations.h | 18 ++-- google/cloud/bigtable/row_reader_test.cc | 2 +- google/cloud/bigtable/table.h | 14 ++-- google/cloud/bigtable/value_test.cc | 4 +- .../v1/internal/session_connection_impl.cc | 2 +- google/cloud/ces/v1/session_connection.cc | 3 +- .../v1/internal/lineage_connection_impl.cc | 4 +- .../lineage/v1/lineage_connection.cc | 4 +- .../internal/sessions_connection_impl.cc | 2 +- .../dialogflow_cx/sessions_connection.cc | 2 +- .../v1/conversational_search_connection.cc | 2 +- .../conversational_search_connection_impl.cc | 2 +- google/cloud/future_generic.h | 3 +- .../v1/data_chat_connection.cc | 4 +- .../v1/internal/data_chat_connection_impl.cc | 4 +- google/cloud/internal/future_impl.h | 18 ++-- google/cloud/internal/future_then_impl.h | 9 +- .../streaming_read_rpc_logging_test.cc | 1 - google/cloud/internal/traced_stream_range.h | 2 +- google/cloud/internal/type_list.h | 3 +- google/cloud/mocks/mock_stream_range.h | 2 +- .../internal/monitored_resource.cc | 2 - .../internal/monitored_resource_test.cc | 84 +++++++++---------- .../internal/monitoring_exporter.cc | 4 +- .../internal/monitoring_exporter.h | 6 +- .../opentelemetry/internal/recordable.cc | 1 - .../internal/resource_detector_impl_test.cc | 28 +++---- .../opentelemetry/internal/time_series.cc | 20 ++--- .../opentelemetry/internal/time_series.h | 4 +- .../internal/time_series_test.cc | 2 +- .../opentelemetry/trace_exporter_test.cc | 2 +- .../v1/agent_endpoint_connection.cc | 4 +- .../agent_endpoint_connection_impl.cc | 4 +- google/cloud/rest_options.h | 1 + google/cloud/spanner/encryption_config.h | 6 +- .../cloud/spanner/internal/connection_impl.cc | 21 ++--- google/cloud/spanner/options.h | 6 +- google/cloud/storage/async/client.cc | 9 +- google/cloud/storage/async/reader.cc | 7 +- .../cloud/storage/async/reader_connection.h | 6 +- google/cloud/storage/async/writer.cc | 2 +- google/cloud/storage/async/writer.h | 4 +- .../cloud/storage/async/writer_connection.h | 4 +- google/cloud/storage/client.h | 3 +- google/cloud/storage/client_object_test.cc | 3 +- .../storage/examples/storage_async_samples.cc | 5 +- .../examples/storage_object_samples.cc | 17 ++-- .../connection_impl_appendable_upload_test.cc | 9 +- .../async/connection_impl_open_test.cc | 8 +- .../async/connection_impl_read_test.cc | 5 +- .../async/connection_impl_upload_hash_test.cc | 13 +-- .../async/connection_impl_upload_test.cc | 11 +-- .../async/object_descriptor_reader_tracing.cc | 7 +- .../async/reader_connection_resume.cc | 7 +- .../async/reader_connection_tracing.cc | 7 +- .../async/writer_connection_buffered.cc | 31 +++---- .../async/writer_connection_buffered_test.cc | 2 +- .../async/writer_connection_finalized.cc | 2 +- .../async/writer_connection_finalized.h | 2 +- .../internal/async/writer_connection_impl.cc | 17 ++-- .../internal/async/writer_connection_impl.h | 4 +- .../async/writer_connection_resumed.cc | 25 +++--- .../async/writer_connection_resumed_test.cc | 2 +- .../async/writer_connection_tracing.cc | 2 +- .../storage/internal/bucket_metadata_cache.cc | 4 +- .../storage/internal/bucket_metadata_cache.h | 4 +- .../cloud/storage/internal/grpc/make_cord.h | 3 +- .../internal/grpc/metrics_exporter_options.cc | 4 +- .../internal/storage_metadata_decorator.cc | 6 +- google/cloud/storage/internal/tuple_filter.h | 5 +- .../list_objects_and_prefixes_reader.h | 8 +- .../mocks/mock_async_writer_connection.h | 2 +- .../tests/async_client_integration_test.cc | 5 +- .../storage/tests/object_integration_test.cc | 25 +++--- .../storage_control_metadata_decorator.cc | 6 +- google/cloud/stream_range.h | 8 +- google/cloud/stream_range_test.cc | 2 +- .../testing_util/command_line_parsing.cc | 2 +- .../cloud/testing_util/command_line_parsing.h | 5 +- google/cloud/testing_util/is_proto_equal.cc | 12 +-- google/cloud/testing_util/is_proto_equal.h | 14 ++-- .../cloud/testing_util/scoped_environment.cc | 2 +- .../cloud/testing_util/scoped_environment.h | 6 +- google/cloud/testing_util/setenv.cc | 2 +- google/cloud/testing_util/setenv.h | 4 +- .../cloud/testing_util/validate_metadata.cc | 19 ++--- google/cloud/testing_util/validate_metadata.h | 8 +- 128 files changed, 432 insertions(+), 423 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 6f08aaec5e0e3..2348ef5558578 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -23,7 +23,7 @@ module( bazel_dep(name = "platforms", version = "1.1.0") bazel_dep(name = "bazel_skylib", version = "1.9.2") bazel_dep(name = "rules_cc", version = "0.2.17") -bazel_dep(name = "abseil-cpp", version = "20250814.2") +bazel_dep(name = "abseil-cpp", version = "20260526.0") # For backwards compatibility with WORKSPACE. # The name "com_google_protobuf" is internally used by @bazel_tools, diff --git a/generator/integration_tests/golden/v1/golden_kitchen_sink_connection.cc b/generator/integration_tests/golden/v1/golden_kitchen_sink_connection.cc index 96daeb8189fb1..9b8b075d20a28 100644 --- a/generator/integration_tests/golden/v1/golden_kitchen_sink_connection.cc +++ b/generator/integration_tests/golden/v1/golden_kitchen_sink_connection.cc @@ -84,7 +84,7 @@ StreamRange GoldenKitchenSinkConnec google::test::admin::database::v1::Request const&) { return google::cloud::internal::MakeStreamRange< google::test::admin::database::v1::Response>( - []() -> absl::variant std::variant{ return Status(StatusCode::kUnimplemented, "not implemented");} ); diff --git a/generator/integration_tests/golden/v1/internal/golden_kitchen_sink_connection_impl.cc b/generator/integration_tests/golden/v1/internal/golden_kitchen_sink_connection_impl.cc index d33a38853476c..12bfd1c9cdd44 100644 --- a/generator/integration_tests/golden/v1/internal/golden_kitchen_sink_connection_impl.cc +++ b/generator/integration_tests/golden/v1/internal/golden_kitchen_sink_connection_impl.cc @@ -184,7 +184,7 @@ GoldenKitchenSinkConnectionImpl::StreamingRead(google::test::admin::database::v1 GoldenKitchenSinkStreamingReadStreamingUpdater, request); return internal::MakeStreamRange( [resumable = std::move(resumable)]() - -> absl::variant< + -> std::variant< Status, google::test::admin::database::v1::Response> { google::test::admin::database::v1::Response response; diff --git a/generator/integration_tests/golden/v1/internal/golden_kitchen_sink_metadata_decorator.cc b/generator/integration_tests/golden/v1/internal/golden_kitchen_sink_metadata_decorator.cc index 46d01bf6abdfa..6ecde26bcf66f 100644 --- a/generator/integration_tests/golden/v1/internal/golden_kitchen_sink_metadata_decorator.cc +++ b/generator/integration_tests/golden/v1/internal/golden_kitchen_sink_metadata_decorator.cc @@ -175,7 +175,7 @@ GoldenKitchenSinkMetadata::ExplicitRouting1( {[](google::test::admin::database::v1::ExplicitRoutingRequest const& request) -> std::string const& { return request.app_profile_id(); }, - absl::nullopt}, + std::nullopt}, {[](google::test::admin::database::v1::ExplicitRoutingRequest const& request) -> std::string const& { return request.table_name(); }, diff --git a/generator/integration_tests/golden/v1/internal/golden_kitchen_sink_rest_metadata_decorator.cc b/generator/integration_tests/golden/v1/internal/golden_kitchen_sink_rest_metadata_decorator.cc index d2b3859215f0e..9e8caca8515b8 100644 --- a/generator/integration_tests/golden/v1/internal/golden_kitchen_sink_rest_metadata_decorator.cc +++ b/generator/integration_tests/golden/v1/internal/golden_kitchen_sink_rest_metadata_decorator.cc @@ -120,7 +120,7 @@ GoldenKitchenSinkRestMetadata::ExplicitRouting1( {[](google::test::admin::database::v1::ExplicitRoutingRequest const& request) -> std::string const& { return request.app_profile_id(); }, - absl::nullopt}, + std::nullopt}, {[](google::test::admin::database::v1::ExplicitRoutingRequest const& request) -> std::string const& { return request.table_name(); }, diff --git a/generator/integration_tests/tests/golden_kitchen_sink_client_test.cc b/generator/integration_tests/tests/golden_kitchen_sink_client_test.cc index 7b7f897c0cca9..6b3da2fa9b0e2 100644 --- a/generator/integration_tests/tests/golden_kitchen_sink_client_test.cc +++ b/generator/integration_tests/tests/golden_kitchen_sink_client_test.cc @@ -239,7 +239,7 @@ TEST(GoldenKitchenSinkClientTest, StreamingRead) { Contains("test-only/1.0")); EXPECT_THAT(request.stream(), "test-only-stream-name"); return google::cloud::internal::MakeStreamRange( - []() -> absl::variant { + []() -> std::variant { return Status(StatusCode::kPermissionDenied, "uh-oh"); }); }); diff --git a/generator/internal/connection_generator.cc b/generator/internal/connection_generator.cc index b45cc3d46b638..c9736bf2413bf 100644 --- a/generator/internal/connection_generator.cc +++ b/generator/internal/connection_generator.cc @@ -460,7 +460,7 @@ std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc< " $request_type$ const&) {\n" " return google::cloud::internal::MakeStreamRange<\n" " $response_type$>(\n" - " []() -> absl::variant std::variant{\n" " return Status(StatusCode::kUnimplemented, \"not implemented\");}\n" " );\n" diff --git a/generator/internal/connection_impl_generator.cc b/generator/internal/connection_impl_generator.cc index cb1ac65aa51a7..26e8121cfab11 100644 --- a/generator/internal/connection_impl_generator.cc +++ b/generator/internal/connection_impl_generator.cc @@ -363,7 +363,7 @@ StreamRange<$response_type$> $service_name$$method_name$StreamingUpdater, request); return internal::MakeStreamRange<$response_type$>( [resumable = std::move(resumable)]() - -> absl::variant< + -> std::variant< Status, $response_type$> { $response_type$ response; diff --git a/generator/internal/descriptor_utils.cc b/generator/internal/descriptor_utils.cc index b2d4cf9a9fc56..dbf667d62474c 100644 --- a/generator/internal/descriptor_utils.cc +++ b/generator/internal/descriptor_utils.cc @@ -34,7 +34,6 @@ #include "absl/strings/str_replace.h" #include "absl/strings/str_split.h" #include "absl/strings/strip.h" -#include "absl/types/variant.h" #include "google/api/annotations.pb.h" #include "google/api/http.pb.h" #include "google/api/routing.pb.h" diff --git a/generator/internal/descriptor_utils.h b/generator/internal/descriptor_utils.h index 27a7b2f38bb71..b7f05cc8006dd 100644 --- a/generator/internal/descriptor_utils.h +++ b/generator/internal/descriptor_utils.h @@ -19,7 +19,6 @@ #include "generator/internal/mixin_utils.h" #include "generator/internal/predicate_utils.h" #include "generator/internal/printer.h" -#include "absl/types/variant.h" #include #include #include diff --git a/generator/internal/http_annotation_parser.cc b/generator/internal/http_annotation_parser.cc index 03096241d581a..2a188dfece8e0 100644 --- a/generator/internal/http_annotation_parser.cc +++ b/generator/internal/http_annotation_parser.cc @@ -19,6 +19,7 @@ #include "absl/strings/str_cat.h" #include #include +#include namespace google { namespace cloud { @@ -246,7 +247,7 @@ StatusOr ParsePathTemplate(absl::string_view input) { return MakeParseError(input, v->end, " end of input", GCP_ERROR_INFO()); } return PathTemplate{std::move(s->value), - absl::get(v->value.value)}; + std::get(v->value.value)}; } std::ostream& operator<<(std::ostream& os, PathTemplate::Segment const& rhs) { @@ -263,7 +264,7 @@ std::ostream& operator<<(std::ostream& os, PathTemplate::Segment const& rhs) { } }; os << "{"; - absl::visit(Visitor{os}, rhs.value); + std::visit(Visitor{os}, rhs.value); os << "}"; return os; } diff --git a/generator/internal/http_annotation_parser.h b/generator/internal/http_annotation_parser.h index 6c8b685a770b5..b777c7afc2d11 100644 --- a/generator/internal/http_annotation_parser.h +++ b/generator/internal/http_annotation_parser.h @@ -17,8 +17,8 @@ #include "google/cloud/status_or.h" #include "absl/strings/string_view.h" -#include "absl/types/variant.h" #include +#include #include namespace google { @@ -86,7 +86,7 @@ struct PathTemplate { std::vector> segments; }; struct Segment { - absl::variant value; + std::variant value; }; using Segments = std::vector>; diff --git a/generator/internal/http_annotation_parser_test.cc b/generator/internal/http_annotation_parser_test.cc index ca6ea916b2978..f3ff0d980ba7f 100644 --- a/generator/internal/http_annotation_parser_test.cc +++ b/generator/internal/http_annotation_parser_test.cc @@ -17,6 +17,7 @@ #include #include #include +#include namespace google { namespace cloud { @@ -65,21 +66,21 @@ bool SameValues(PathTemplate::Segment const& a, struct Visitor { PathTemplate::Segment const& a; bool operator()(PathTemplate::Match const&) { - return absl::holds_alternative(a.value); + return std::holds_alternative(a.value); } bool operator()(PathTemplate::MatchRecursive const&) { - return absl::holds_alternative(a.value); + return std::holds_alternative(a.value); } bool operator()(std::string const& s) { - return absl::holds_alternative(a.value) && - absl::get(a.value) == s; + return std::holds_alternative(a.value) && + std::get(a.value) == s; } bool operator()(PathTemplate::Variable const& v) { - return absl::holds_alternative(a.value) && - SameValues(absl::get(a.value), v); + return std::holds_alternative(a.value) && + SameValues(std::get(a.value), v); } }; - return absl::visit(Visitor{a}, b.value); + return std::visit(Visitor{a}, b.value); } bool SameValues(PathTemplate const& a, PathTemplate const& b) { diff --git a/generator/internal/http_option_utils.cc b/generator/internal/http_option_utils.cc index c317cf3481f0a..05fb33fd172dd 100644 --- a/generator/internal/http_option_utils.cc +++ b/generator/internal/http_option_utils.cc @@ -30,6 +30,7 @@ #include #include #include +#include #include using ::google::protobuf::MethodDescriptor; @@ -96,7 +97,7 @@ struct RestPathVisitor { void RestPathVisitorHelper( std::optional api_version, PathTemplate::Segment const& s, std::vector& path) { - absl::visit(RestPathVisitor{std::move(api_version), path}, s.value); + std::visit(RestPathVisitor{std::move(api_version), path}, s.value); } std::string FormatQueryParameterCode( @@ -319,15 +320,15 @@ HttpExtensionInfo ParseHttpExtension(google::api::HttpRule const& http_rule) { }; auto segment_formatter = [](std::string* out, std::shared_ptr const& s) { - out->append(absl::visit(SegmentAsStringVisitor{}, s->value)); + out->append(std::visit(SegmentAsStringVisitor{}, s->value)); }; auto api_version = FormatApiVersionFromUrlPattern(info.url_path); auto rest_path_visitor = RestPathVisitor(std::move(api_version), info.rest_path); for (auto const& s : parsed_http_rule->segments) { - if (absl::holds_alternative(s->value)) { - auto v = absl::get(s->value); + if (std::holds_alternative(s->value)) { + auto v = std::get(s->value); if (v.segments.empty()) { info.field_substitutions.emplace_back(v.field_path, v.field_path); } else { @@ -336,7 +337,7 @@ HttpExtensionInfo ParseHttpExtension(google::api::HttpRule const& http_rule) { } } - absl::visit(rest_path_visitor, s->value); + std::visit(rest_path_visitor, s->value); } info.rest_path_verb = parsed_http_rule->verb; diff --git a/generator/internal/longrunning.cc b/generator/internal/longrunning.cc index 51b17fd945b25..9b20abeb92adc 100644 --- a/generator/internal/longrunning.cc +++ b/generator/internal/longrunning.cc @@ -19,9 +19,9 @@ #include "google/cloud/extended_operations.pb.h" #include "google/cloud/log.h" #include "absl/strings/str_cat.h" -#include "absl/types/variant.h" #include "google/longrunning/operations.pb.h" #include +#include using ::google::protobuf::Descriptor; using ::google::protobuf::MethodDescriptor; @@ -31,7 +31,7 @@ namespace cloud { namespace generator_internal { namespace { -absl::variant FullyQualifyMessageType( +std::variant FullyQualifyMessageType( MethodDescriptor const& method, std::string message_type) { Descriptor const* output_type = method.file()->pool()->FindMessageTypeByName(message_type); @@ -63,7 +63,7 @@ struct FormatDoxygenLinkVisitor { } }; -absl::variant +std::variant DeduceLongrunningOperationResponseType( MethodDescriptor const& method, google::longrunning::OperationInfo const& operation_info) { @@ -100,36 +100,36 @@ void SetLongrunningOperationMethodVars( if (IsGRPCLongrunningOperation(method)) { auto operation_info = method.options().GetExtension(google::longrunning::operation_info); - method_vars["longrunning_metadata_type"] = ProtoNameToCppName(absl::visit( + method_vars["longrunning_metadata_type"] = ProtoNameToCppName(std::visit( FullyQualifiedMessageTypeVisitor(), FullyQualifyMessageType(method, operation_info.metadata_type()))); - method_vars["longrunning_response_type"] = ProtoNameToCppName(absl::visit( + method_vars["longrunning_response_type"] = ProtoNameToCppName(std::visit( FullyQualifiedMessageTypeVisitor(), FullyQualifyMessageType(method, operation_info.response_type()))); auto deduced_response_type = DeduceLongrunningOperationResponseType(method, operation_info); method_vars["longrunning_deduced_response_message_type"] = - absl::visit(FullyQualifiedMessageTypeVisitor(), deduced_response_type); + std::visit(FullyQualifiedMessageTypeVisitor(), deduced_response_type); method_vars["longrunning_deduced_response_type"] = ProtoNameToCppName( method_vars["longrunning_deduced_response_message_type"]); method_vars["method_longrunning_deduced_return_doxygen_link"] = - absl::visit(FormatDoxygenLinkVisitor{}, deduced_response_type); + std::visit(FormatDoxygenLinkVisitor{}, deduced_response_type); return; } if (IsHttpLongrunningOperation(method)) { - method_vars["longrunning_response_type"] = ProtoNameToCppName(absl::visit( + method_vars["longrunning_response_type"] = ProtoNameToCppName(std::visit( FullyQualifiedMessageTypeVisitor(), FullyQualifyMessageType( method, std::string{method.output_type()->full_name()}))); - absl::variant + std::variant deduced_response_type = method.output_type(); method_vars["longrunning_deduced_response_message_type"] = - absl::visit(FullyQualifiedMessageTypeVisitor(), deduced_response_type); + std::visit(FullyQualifiedMessageTypeVisitor(), deduced_response_type); method_vars["longrunning_deduced_response_type"] = ProtoNameToCppName( method_vars["longrunning_deduced_response_message_type"]); method_vars["method_longrunning_deduced_return_doxygen_link"] = - absl::visit(FormatDoxygenLinkVisitor{}, deduced_response_type); + std::visit(FormatDoxygenLinkVisitor{}, deduced_response_type); } } @@ -169,11 +169,10 @@ void SetLongrunningOperationServiceVars( return; } if (IsHttpLongrunningOperation(*method)) { - service_vars["longrunning_response_type"] = - ProtoNameToCppName(absl::visit( - FullyQualifiedMessageTypeVisitor(), - FullyQualifyMessageType( - *method, std::string{method->output_type()->full_name()}))); + service_vars["longrunning_response_type"] = ProtoNameToCppName(std::visit( + FullyQualifiedMessageTypeVisitor(), + FullyQualifyMessageType( + *method, std::string{method->output_type()->full_name()}))); auto operation_service_extension = method->options().GetExtension(google::cloud::operation_service); diff --git a/generator/internal/metadata_decorator_generator.cc b/generator/internal/metadata_decorator_generator.cc index 1d726eedfd08f..740c1c99cc5a4 100644 --- a/generator/internal/metadata_decorator_generator.cc +++ b/generator/internal/metadata_decorator_generator.cc @@ -82,7 +82,7 @@ std::string SetMetadataText(google::protobuf::MethodDescriptor const& method, text += " },\n"; // In the special match-all case, we do not bother to set a regex. if (rp.pattern == "(.*)") { - text += " absl::nullopt},\n"; + text += " std::nullopt},\n"; } else { text += " std::regex{\"" + rp.pattern + "\", std::regex::optimize}},\n"; } diff --git a/generator/internal/metadata_decorator_rest_generator.cc b/generator/internal/metadata_decorator_rest_generator.cc index 6204aff2cc578..e5b0bfd630d6a 100644 --- a/generator/internal/metadata_decorator_rest_generator.cc +++ b/generator/internal/metadata_decorator_rest_generator.cc @@ -74,7 +74,7 @@ std::string SetMetadataText(google::protobuf::MethodDescriptor const& method, text += " },\n"; // In the special match-all case, we do not bother to set a regex. if (rp.pattern == "(.*)") { - text += " absl::nullopt},\n"; + text += " std::nullopt},\n"; } else { text += " std::regex{\"" + rp.pattern + "\", std::regex::optimize}},\n"; } diff --git a/google/cloud/aiplatform/v1/featurestore_online_serving_connection.cc b/google/cloud/aiplatform/v1/featurestore_online_serving_connection.cc index c24df7aaedae7..f886234d25c3c 100644 --- a/google/cloud/aiplatform/v1/featurestore_online_serving_connection.cc +++ b/google/cloud/aiplatform/v1/featurestore_online_serving_connection.cc @@ -50,7 +50,7 @@ FeaturestoreOnlineServingServiceConnection::StreamingReadFeatureValues( google::cloud::aiplatform::v1::StreamingReadFeatureValuesRequest const&) { return google::cloud::internal::MakeStreamRange< google::cloud::aiplatform::v1::ReadFeatureValuesResponse>( - []() -> absl::variant< + []() -> std::variant< Status, google::cloud::aiplatform::v1::ReadFeatureValuesResponse> { return Status(StatusCode::kUnimplemented, "not implemented"); diff --git a/google/cloud/aiplatform/v1/internal/featurestore_online_serving_connection_impl.cc b/google/cloud/aiplatform/v1/internal/featurestore_online_serving_connection_impl.cc index ab3d8ae5db58f..d89c7e0cb0d63 100644 --- a/google/cloud/aiplatform/v1/internal/featurestore_online_serving_connection_impl.cc +++ b/google/cloud/aiplatform/v1/internal/featurestore_online_serving_connection_impl.cc @@ -111,7 +111,7 @@ FeaturestoreOnlineServingServiceConnectionImpl::StreamingReadFeatureValues( return internal::MakeStreamRange< google::cloud::aiplatform::v1::ReadFeatureValuesResponse>( [resumable = std::move(resumable)]() - -> absl::variant< + -> std::variant< Status, google::cloud::aiplatform::v1::ReadFeatureValuesResponse> { google::cloud::aiplatform::v1::ReadFeatureValuesResponse response; diff --git a/google/cloud/aiplatform/v1/internal/prediction_connection_impl.cc b/google/cloud/aiplatform/v1/internal/prediction_connection_impl.cc index f182f29c3dd92..3b9ec6ae9bb82 100644 --- a/google/cloud/aiplatform/v1/internal/prediction_connection_impl.cc +++ b/google/cloud/aiplatform/v1/internal/prediction_connection_impl.cc @@ -120,7 +120,7 @@ PredictionServiceConnectionImpl::StreamRawPredict( PredictionServiceStreamRawPredictStreamingUpdater, request); return internal::MakeStreamRange( [resumable = std::move( - resumable)]() -> absl::variant { + resumable)]() -> std::variant { google::api::HttpBody response; auto status = resumable->Read(&response); if (status.has_value()) return *status; @@ -204,7 +204,7 @@ PredictionServiceConnectionImpl::ServerStreamingPredict( return internal::MakeStreamRange< google::cloud::aiplatform::v1::StreamingPredictResponse>( [resumable = std::move(resumable)]() - -> absl::variant< + -> std::variant< Status, google::cloud::aiplatform::v1::StreamingPredictResponse> { google::cloud::aiplatform::v1::StreamingPredictResponse response; auto status = resumable->Read(&response); @@ -270,7 +270,7 @@ PredictionServiceConnectionImpl::StreamGenerateContent( return internal::MakeStreamRange< google::cloud::aiplatform::v1::GenerateContentResponse>( [resumable = std::move(resumable)]() - -> absl::variant< + -> std::variant< Status, google::cloud::aiplatform::v1::GenerateContentResponse> { google::cloud::aiplatform::v1::GenerateContentResponse response; auto status = resumable->Read(&response); diff --git a/google/cloud/aiplatform/v1/internal/tensorboard_connection_impl.cc b/google/cloud/aiplatform/v1/internal/tensorboard_connection_impl.cc index eaa70b975079c..c74ef0d224b9b 100644 --- a/google/cloud/aiplatform/v1/internal/tensorboard_connection_impl.cc +++ b/google/cloud/aiplatform/v1/internal/tensorboard_connection_impl.cc @@ -1057,7 +1057,7 @@ TensorboardServiceConnectionImpl::ReadTensorboardBlobData( return internal::MakeStreamRange< google::cloud::aiplatform::v1::ReadTensorboardBlobDataResponse>( [resumable = std::move(resumable)]() - -> absl::variant< + -> std::variant< Status, google::cloud::aiplatform::v1::ReadTensorboardBlobDataResponse> { google::cloud::aiplatform::v1::ReadTensorboardBlobDataResponse response; diff --git a/google/cloud/aiplatform/v1/prediction_connection.cc b/google/cloud/aiplatform/v1/prediction_connection.cc index c04117b9c189c..1a8782a66e2d6 100644 --- a/google/cloud/aiplatform/v1/prediction_connection.cc +++ b/google/cloud/aiplatform/v1/prediction_connection.cc @@ -53,7 +53,7 @@ StreamRange PredictionServiceConnection::StreamRawPredict( google::cloud::aiplatform::v1::StreamRawPredictRequest const&) { return google::cloud::internal::MakeStreamRange( - []() -> absl::variant { + []() -> std::variant { return Status(StatusCode::kUnimplemented, "not implemented"); }); } @@ -109,7 +109,7 @@ PredictionServiceConnection::ServerStreamingPredict( return google::cloud::internal::MakeStreamRange< google::cloud::aiplatform::v1::StreamingPredictResponse>( []() - -> absl::variant< + -> std::variant< Status, google::cloud::aiplatform::v1::StreamingPredictResponse> { return Status(StatusCode::kUnimplemented, "not implemented"); }); @@ -143,7 +143,7 @@ PredictionServiceConnection::StreamGenerateContent( google::cloud::aiplatform::v1::GenerateContentRequest const&) { return google::cloud::internal::MakeStreamRange< google::cloud::aiplatform::v1::GenerateContentResponse>( - []() -> absl::variant< + []() -> std::variant< Status, google::cloud::aiplatform::v1::GenerateContentResponse> { return Status(StatusCode::kUnimplemented, "not implemented"); }); diff --git a/google/cloud/aiplatform/v1/tensorboard_connection.cc b/google/cloud/aiplatform/v1/tensorboard_connection.cc index 17af42eb38847..c441c7be40733 100644 --- a/google/cloud/aiplatform/v1/tensorboard_connection.cc +++ b/google/cloud/aiplatform/v1/tensorboard_connection.cc @@ -320,7 +320,7 @@ TensorboardServiceConnection::ReadTensorboardBlobData( google::cloud::aiplatform::v1::ReadTensorboardBlobDataRequest const&) { return google::cloud::internal::MakeStreamRange< google::cloud::aiplatform::v1::ReadTensorboardBlobDataResponse>( - []() -> absl::variant< + []() -> std::variant< Status, google::cloud::aiplatform::v1::ReadTensorboardBlobDataResponse> { return Status(StatusCode::kUnimplemented, "not implemented"); diff --git a/google/cloud/biglake/hive/v1/hive_metastore_connection.cc b/google/cloud/biglake/hive/v1/hive_metastore_connection.cc index db647bb867a80..685caf92f942e 100644 --- a/google/cloud/biglake/hive/v1/hive_metastore_connection.cc +++ b/google/cloud/biglake/hive/v1/hive_metastore_connection.cc @@ -153,7 +153,7 @@ HiveMetastoreServiceConnection::ListPartitions( google::cloud::biglake::hive::v1::ListPartitionsRequest const&) { return google::cloud::internal::MakeStreamRange< google::cloud::biglake::hive::v1::ListPartitionsResponse>( - []() -> absl::variant< + []() -> std::variant< Status, google::cloud::biglake::hive::v1::ListPartitionsResponse> { return Status(StatusCode::kUnimplemented, "not implemented"); diff --git a/google/cloud/biglake/hive/v1/internal/hive_metastore_connection_impl.cc b/google/cloud/biglake/hive/v1/internal/hive_metastore_connection_impl.cc index 9aec88d5a4671..1413469305362 100644 --- a/google/cloud/biglake/hive/v1/internal/hive_metastore_connection_impl.cc +++ b/google/cloud/biglake/hive/v1/internal/hive_metastore_connection_impl.cc @@ -426,7 +426,7 @@ HiveMetastoreServiceConnectionImpl::ListPartitions( return internal::MakeStreamRange< google::cloud::biglake::hive::v1::ListPartitionsResponse>( [resumable = std::move(resumable)]() - -> absl::variant< + -> std::variant< Status, google::cloud::biglake::hive::v1::ListPartitionsResponse> { google::cloud::biglake::hive::v1::ListPartitionsResponse response; diff --git a/google/cloud/bigquery/storage/v1/bigquery_read_connection.cc b/google/cloud/bigquery/storage/v1/bigquery_read_connection.cc index ac0e222eac708..e2b05e223efa2 100644 --- a/google/cloud/bigquery/storage/v1/bigquery_read_connection.cc +++ b/google/cloud/bigquery/storage/v1/bigquery_read_connection.cc @@ -48,7 +48,7 @@ BigQueryReadConnection::ReadRows( google::cloud::bigquery::storage::v1::ReadRowsRequest const&) { return google::cloud::internal::MakeStreamRange< google::cloud::bigquery::storage::v1::ReadRowsResponse>( - []() -> absl::variant< + []() -> std::variant< Status, google::cloud::bigquery::storage::v1::ReadRowsResponse> { return Status(StatusCode::kUnimplemented, "not implemented"); }); diff --git a/google/cloud/bigquery/storage/v1/internal/bigquery_read_connection_impl.cc b/google/cloud/bigquery/storage/v1/internal/bigquery_read_connection_impl.cc index 39adfebcdabeb..172a61008f46b 100644 --- a/google/cloud/bigquery/storage/v1/internal/bigquery_read_connection_impl.cc +++ b/google/cloud/bigquery/storage/v1/internal/bigquery_read_connection_impl.cc @@ -98,7 +98,7 @@ BigQueryReadConnectionImpl::ReadRows( return internal::MakeStreamRange< google::cloud::bigquery::storage::v1::ReadRowsResponse>( [resumable = std::move(resumable)]() - -> absl::variant< + -> std::variant< Status, google::cloud::bigquery::storage::v1::ReadRowsResponse> { google::cloud::bigquery::storage::v1::ReadRowsResponse response; auto status = resumable->Read(&response); diff --git a/google/cloud/bigquery/v2/minimal/internal/common_v2_resources.cc b/google/cloud/bigquery/v2/minimal/internal/common_v2_resources.cc index 1b2ef4c79af3e..aa8ca83c3d1a2 100644 --- a/google/cloud/bigquery/v2/minimal/internal/common_v2_resources.cc +++ b/google/cloud/bigquery/v2/minimal/internal/common_v2_resources.cc @@ -17,6 +17,7 @@ #include "google/cloud/internal/debug_string.h" #include "google/cloud/internal/format_time_point.h" #include "google/cloud/log.h" +#include namespace google { namespace cloud { @@ -133,7 +134,7 @@ void to_json(nlohmann::json& j, StandardSqlDataType const& t) { TypeKind type_kind; nlohmann::json& j; - void operator()(absl::monostate const&) { + void operator()(std::monostate const&) { j = nlohmann::json{{"typeKind", std::move(type_kind.value)}}; } void operator()(std::shared_ptr const& type) { @@ -148,7 +149,7 @@ void to_json(nlohmann::json& j, StandardSqlDataType const& t) { } }; - absl::visit(Visitor{t.type_kind, j}, t.sub_type); + std::visit(Visitor{t.type_kind, j}, t.sub_type); } void from_json(nlohmann::json const& j, StandardSqlDataType& t) { @@ -185,7 +186,7 @@ void to_json(nlohmann::json& j, Value const& v) { struct Visitor { nlohmann::json& j; - void operator()(absl::monostate const&) { + void operator()(std::monostate const&) { // Nothing to do. } void operator()(double const& val) { @@ -205,7 +206,7 @@ void to_json(nlohmann::json& j, Value const& v) { } }; - absl::visit(Visitor{j}, v.value_kind); + std::visit(Visitor{j}, v.value_kind); } void from_json(nlohmann::json const& j, Value& v) { @@ -493,7 +494,7 @@ std::string StandardSqlDataType::DebugString(absl::string_view name, std::string Value::DebugString(absl::string_view name, TracingOptions const& options, int indent) const { - return absl::visit(ValueKindDebugString{name, options, indent}, value_kind); + return std::visit(ValueKindDebugString{name, options, indent}, value_kind); } std::string SystemVariables::DebugString(absl::string_view name, diff --git a/google/cloud/bigquery/v2/minimal/internal/common_v2_resources.h b/google/cloud/bigquery/v2/minimal/internal/common_v2_resources.h index ae44d70743704..4b053a20d59f6 100644 --- a/google/cloud/bigquery/v2/minimal/internal/common_v2_resources.h +++ b/google/cloud/bigquery/v2/minimal/internal/common_v2_resources.h @@ -18,10 +18,10 @@ #include "google/cloud/tracing_options.h" #include "google/cloud/version.h" #include "absl/strings/string_view.h" -#include "absl/types/variant.h" #include #include #include +#include namespace google { namespace cloud { @@ -255,8 +255,8 @@ bool operator==(StandardSqlStructType const& lhs, // https://cloud.google.com/bigquery/docs/reference/rest/v2/StandardSqlDataType struct StandardSqlDataType { using ValueType = - absl::variant, - StandardSqlStructType>; + std::variant, + StandardSqlStructType>; TypeKind type_kind; ValueType sub_type; @@ -286,8 +286,8 @@ struct Struct; // For more details, please see: // https://protobuf.dev/reference/protobuf/google.protobuf/#value struct Value { - using KindType = absl::variant, std::vector>; + using KindType = std::variant, std::vector>; KindType value_kind; std::string DebugString(absl::string_view name, diff --git a/google/cloud/bigquery/v2/minimal/internal/dataset_connection.cc b/google/cloud/bigquery/v2/minimal/internal/dataset_connection.cc index 8ebbab6e64bce..328152fa23d96 100644 --- a/google/cloud/bigquery/v2/minimal/internal/dataset_connection.cc +++ b/google/cloud/bigquery/v2/minimal/internal/dataset_connection.cc @@ -33,7 +33,7 @@ StatusOr DatasetConnection::GetDataset(GetDatasetRequest const&) { StreamRange DatasetConnection::ListDatasets( ListDatasetsRequest const&) { return google::cloud::internal::MakeStreamRange( - []() -> absl::variant { + []() -> std::variant { return Status(StatusCode::kUnimplemented, "not implemented"); }); } diff --git a/google/cloud/bigquery/v2/minimal/internal/job_connection.cc b/google/cloud/bigquery/v2/minimal/internal/job_connection.cc index 8c8efd86582c5..da4f1bb9be640 100644 --- a/google/cloud/bigquery/v2/minimal/internal/job_connection.cc +++ b/google/cloud/bigquery/v2/minimal/internal/job_connection.cc @@ -33,7 +33,7 @@ StatusOr BigQueryJobConnection::GetJob(GetJobRequest const&) { StreamRange BigQueryJobConnection::ListJobs( ListJobsRequest const&) { return google::cloud::internal::MakeStreamRange( - []() -> absl::variant { + []() -> std::variant { return Status(StatusCode::kUnimplemented, "not implemented"); }); } diff --git a/google/cloud/bigquery/v2/minimal/internal/project_connection.cc b/google/cloud/bigquery/v2/minimal/internal/project_connection.cc index 4f47b48182310..ac36ab9723071 100644 --- a/google/cloud/bigquery/v2/minimal/internal/project_connection.cc +++ b/google/cloud/bigquery/v2/minimal/internal/project_connection.cc @@ -30,7 +30,7 @@ ProjectConnection::~ProjectConnection() = default; StreamRange ProjectConnection::ListProjects( ListProjectsRequest const&) { return google::cloud::internal::MakeStreamRange( - []() -> absl::variant { + []() -> std::variant { return Status(StatusCode::kUnimplemented, "not implemented"); }); } diff --git a/google/cloud/bigquery/v2/minimal/internal/table_connection.cc b/google/cloud/bigquery/v2/minimal/internal/table_connection.cc index 15f77d1e9c44f..82de28bf1744c 100644 --- a/google/cloud/bigquery/v2/minimal/internal/table_connection.cc +++ b/google/cloud/bigquery/v2/minimal/internal/table_connection.cc @@ -33,7 +33,7 @@ StatusOr TableConnection::GetTable(GetTableRequest const&) { StreamRange TableConnection::ListTables( ListTablesRequest const&) { return google::cloud::internal::MakeStreamRange( - []() -> absl::variant { + []() -> std::variant { return Status(StatusCode::kUnimplemented, "not implemented"); }); } diff --git a/google/cloud/bigtable/column_family.h b/google/cloud/bigtable/column_family.h index 28c898df25139..ea0868ca736ad 100644 --- a/google/cloud/bigtable/column_family.h +++ b/google/cloud/bigtable/column_family.h @@ -16,13 +16,13 @@ #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_COLUMN_FAMILY_H #include "google/cloud/bigtable/version.h" -#include "absl/meta/type_traits.h" #include "google/bigtable/admin/v2/bigtable_table_admin.pb.h" #include "google/bigtable/admin/v2/table.pb.h" #include #include #include #include +#include namespace google { namespace cloud { @@ -96,7 +96,7 @@ class GcRule { // letting the compiler figure things out N levels deep as it recurses on // `add_intersection()`. static_assert( - absl::conjunction...>::value, + std::conjunction...>::value, "The arguments to Intersection must be convertible to GcRule"); GcRule tmp; auto& intersection = *tmp.gc_rule_.mutable_intersection(); @@ -121,7 +121,7 @@ class GcRule { // letting the compiler figure things out N levels deep as it recurses on // `add_intersection()`. static_assert( - absl::conjunction...>::value, + std::conjunction...>::value, "The arguments to Union must be convertible to GcRule"); GcRule tmp; auto& gc_rule_union = *tmp.gc_rule_.mutable_union_(); diff --git a/google/cloud/bigtable/filters.h b/google/cloud/bigtable/filters.h index 5e93c549605cd..80413cc068bf7 100644 --- a/google/cloud/bigtable/filters.h +++ b/google/cloud/bigtable/filters.h @@ -16,11 +16,11 @@ #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_FILTERS_H #include "google/cloud/bigtable/version.h" -#include "absl/meta/type_traits.h" #include "google/bigtable/v2/data.pb.h" #include #include #include +#include namespace google { namespace cloud { @@ -572,7 +572,7 @@ class Filter { // just letting the compiler figure things out 3 levels deep // as it recurses on append_types(). static_assert( - absl::conjunction...>::value, + std::conjunction...>::value, "The arguments passed to Chain(...) must be convertible to Filter"); Filter tmp; auto& chain = *tmp.filter_.mutable_chain(); @@ -636,7 +636,7 @@ class Filter { template static Filter Interleave(FilterTypes&&... streams) { static_assert( - absl::conjunction...>::value, + std::conjunction...>::value, "The arguments passed to Interleave(...) must be convertible" " to Filter"); Filter tmp; diff --git a/google/cloud/bigtable/internal/async_streaming_read.h b/google/cloud/bigtable/internal/async_streaming_read.h index ba610510ddab4..5bdfb5ae296f9 100644 --- a/google/cloud/bigtable/internal/async_streaming_read.h +++ b/google/cloud/bigtable/internal/async_streaming_read.h @@ -16,7 +16,6 @@ #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_ASYNC_STREAMING_READ_H #include "google/cloud/internal/async_streaming_read_rpc.h" -#include "absl/types/variant.h" #include #include diff --git a/google/cloud/bigtable/internal/default_row_reader.cc b/google/cloud/bigtable/internal/default_row_reader.cc index 12427521f514d..0561c74c3e8dc 100644 --- a/google/cloud/bigtable/internal/default_row_reader.cc +++ b/google/cloud/bigtable/internal/default_row_reader.cc @@ -18,6 +18,7 @@ #include "google/cloud/grpc_options.h" #include "google/cloud/internal/make_status.h" #include "google/cloud/internal/retry_loop_helpers.h" +#include namespace google { namespace cloud { @@ -94,7 +95,7 @@ bool DefaultRowReader::NextChunk() { return true; } -absl::variant DefaultRowReader::Advance() { +std::variant DefaultRowReader::Advance() { // We only want to call ElementRequest if an RPC has previously been // made. if (stream_is_open_) { @@ -107,12 +108,12 @@ absl::variant DefaultRowReader::Advance() { } while (true) { auto variant = AdvanceOrFail(); - if (absl::holds_alternative(variant)) { + if (std::holds_alternative(variant)) { operation_context_->ElementDelivery(*client_context_); - return absl::get(std::move(variant)); + return std::get(std::move(variant)); } - auto status = absl::get(std::move(variant)); + auto status = std::get(std::move(variant)); if (status.ok()) return Status{}; // In the unlikely case when we have already reached the requested @@ -151,7 +152,7 @@ absl::variant DefaultRowReader::Advance() { } } -absl::variant DefaultRowReader::AdvanceOrFail() { +std::variant DefaultRowReader::AdvanceOrFail() { grpc::Status grpc_status; if (!stream_) MakeRequest(); while (!parser_->HasNext()) { diff --git a/google/cloud/bigtable/internal/default_row_reader.h b/google/cloud/bigtable/internal/default_row_reader.h index 5f83e9e4aebd5..35cc1c441127e 100644 --- a/google/cloud/bigtable/internal/default_row_reader.h +++ b/google/cloud/bigtable/internal/default_row_reader.h @@ -26,13 +26,13 @@ #include "google/cloud/bigtable/rpc_backoff_policy.h" #include "google/cloud/bigtable/rpc_retry_policy.h" #include "google/cloud/bigtable/version.h" -#include "absl/types/variant.h" #include #include #include #include #include #include +#include namespace google { namespace cloud { @@ -68,11 +68,11 @@ class DefaultRowReader : public RowReaderImpl { * * This call possibly blocks waiting for data until a full row is available. */ - absl::variant Advance() override; + std::variant Advance() override; private: /// Called by Advance(), does not handle retries. - absl::variant AdvanceOrFail(); + std::variant AdvanceOrFail(); /** * Move the `processed_chunks_count_` index to the next chunk, diff --git a/google/cloud/bigtable/internal/row_reader_impl.h b/google/cloud/bigtable/internal/row_reader_impl.h index f7557133bedeb..017c265e1930d 100644 --- a/google/cloud/bigtable/internal/row_reader_impl.h +++ b/google/cloud/bigtable/internal/row_reader_impl.h @@ -16,7 +16,7 @@ #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_ROW_READER_IMPL_H #include "google/cloud/bigtable/row.h" -#include "absl/types/variant.h" +#include namespace google { namespace cloud { @@ -30,7 +30,7 @@ class RowReaderImpl { virtual void Cancel() = 0; - virtual absl::variant Advance() = 0; + virtual std::variant Advance() = 0; }; /** @@ -45,7 +45,7 @@ class StatusOnlyRowReader : public RowReaderImpl { void Cancel() override {} - absl::variant Advance() override { return status_; } + std::variant Advance() override { return status_; } private: Status status_; diff --git a/google/cloud/bigtable/internal/traced_row_reader.cc b/google/cloud/bigtable/internal/traced_row_reader.cc index 07fbeb8b59929..a8415d3c4cab8 100644 --- a/google/cloud/bigtable/internal/traced_row_reader.cc +++ b/google/cloud/bigtable/internal/traced_row_reader.cc @@ -41,7 +41,7 @@ class TracedRowReader : public bigtable_internal::RowReaderImpl { reader_.Cancel(); }; - absl::variant Advance() override { + std::variant Advance() override { if (it_ == reader_.end()) return End(Status()); auto row = *it_; ++it_; diff --git a/google/cloud/bigtable/mocks/mock_row_reader.cc b/google/cloud/bigtable/mocks/mock_row_reader.cc index ff0d7d6cbfa66..45525fe919754 100644 --- a/google/cloud/bigtable/mocks/mock_row_reader.cc +++ b/google/cloud/bigtable/mocks/mock_row_reader.cc @@ -38,7 +38,7 @@ bigtable::RowReader MakeRowReader(std::vector rows, /// Skips remaining rows and invalidates current iterator. void Cancel() override { iter_ = rows_.cend(); }; - absl::variant Advance() override { + std::variant Advance() override { if (iter_ == rows_.cend()) return final_status_; return *iter_++; } diff --git a/google/cloud/bigtable/mutations.h b/google/cloud/bigtable/mutations.h index 642fe4969e299..62e06cf30faf4 100644 --- a/google/cloud/bigtable/mutations.h +++ b/google/cloud/bigtable/mutations.h @@ -22,7 +22,6 @@ #include "google/cloud/internal/big_endian.h" #include "google/cloud/status.h" #include "google/cloud/status_or.h" -#include "absl/meta/type_traits.h" #include "google/bigtable/v2/bigtable.pb.h" #include "google/bigtable/v2/data.pb.h" #include @@ -325,7 +324,7 @@ class SingleRowMutation { > explicit SingleRowMutation(RowKey&& row_key, M&&... m) { static_assert( - absl::conjunction...>::value, + std::conjunction...>::value, "The arguments passed to SingleRowMutation(std::string, ...) must be " "convertible to Mutation"); request_.set_row_key(std::forward(row_key)); @@ -521,13 +520,14 @@ class BulkMutation { } /// Create a multi-row mutation from a variadic list. - template ...>::value, - int> = 0 - /// @endcond - > + template < + typename... M, + /// @cond implementation_details + std::enable_if_t< + std::conjunction...>::value, + int> = 0 + /// @endcond + > // NOLINTNEXTLINE(google-explicit-constructor) BulkMutation(M&&... m) : BulkMutation() { emplace_many(std::forward(m)...); diff --git a/google/cloud/bigtable/row_reader_test.cc b/google/cloud/bigtable/row_reader_test.cc index 1ab61568e94c3..0cbdfefaff9f7 100644 --- a/google/cloud/bigtable/row_reader_test.cc +++ b/google/cloud/bigtable/row_reader_test.cc @@ -61,7 +61,7 @@ TEST(RowReaderTest, IteratorPostincrement) { class MockRowReader : public bigtable_internal::RowReaderImpl { public: MOCK_METHOD(void, Cancel, (), (override)); - MOCK_METHOD((absl::variant), Advance, (), (override)); + MOCK_METHOD((std::variant), Advance, (), (override)); }; TEST(RowReaderTest, OptionsSpan) { diff --git a/google/cloud/bigtable/table.h b/google/cloud/bigtable/table.h index 19a7c35deb678..e785953243265 100644 --- a/google/cloud/bigtable/table.h +++ b/google/cloud/bigtable/table.h @@ -40,8 +40,8 @@ #include "google/cloud/options.h" #include "google/cloud/status.h" #include "google/cloud/status_or.h" -#include "absl/meta/type_traits.h" #include +#include #include namespace google { @@ -157,13 +157,13 @@ class Table { /// A meta function to check if @p P is a valid Policy type. template struct ValidPolicy - : absl::disjunction, - std::is_base_of, - std::is_base_of> {}; + : std::disjunction, + std::is_base_of, + std::is_base_of> {}; /// A meta function to check if all the @p Policies are valid policy types. template - struct ValidPolicies : absl::conjunction...> {}; + struct ValidPolicies : std::conjunction...> {}; public: /** @@ -589,7 +589,7 @@ class Table { // Generate a better compile time error message than the default one // if the types do not match static_assert( - absl::conjunction, std::is_same, Options>>...>::value, "The arguments passed to ReadModifyWriteRow(row_key,...) must be " @@ -643,7 +643,7 @@ class Table { // Generate a better compile time error message than the default one // if the types do not match static_assert( - absl::conjunction, std::is_same, Options>>...>::value, "The arguments passed to AsyncReadModifyWriteRow(row_key,...) must be " diff --git a/google/cloud/bigtable/value_test.cc b/google/cloud/bigtable/value_test.cc index 3ac6792e92c1e..bf41c7179db91 100644 --- a/google/cloud/bigtable/value_test.cc +++ b/google/cloud/bigtable/value_test.cc @@ -305,8 +305,8 @@ template < std::is_same>, absl::Cord>::value>::type* = nullptr, typename std::enable_if_t< - absl::disjunction, - std::is_same>>::value, + std::disjunction, + std::is_same>>::value, int> = 0> StatusOr MovedFromString(Value const&) { diff --git a/google/cloud/ces/v1/internal/session_connection_impl.cc b/google/cloud/ces/v1/internal/session_connection_impl.cc index 1ed136a00cea9..5096548bb1a14 100644 --- a/google/cloud/ces/v1/internal/session_connection_impl.cc +++ b/google/cloud/ces/v1/internal/session_connection_impl.cc @@ -93,7 +93,7 @@ SessionServiceConnectionImpl::StreamRunSession( SessionServiceStreamRunSessionStreamingUpdater, request); return internal::MakeStreamRange( [resumable = std::move(resumable)]() - -> absl::variant { + -> std::variant { google::cloud::ces::v1::RunSessionResponse response; auto status = resumable->Read(&response); if (status.has_value()) return *status; diff --git a/google/cloud/ces/v1/session_connection.cc b/google/cloud/ces/v1/session_connection.cc index 3e87c93deb296..5d3412f0b68a9 100644 --- a/google/cloud/ces/v1/session_connection.cc +++ b/google/cloud/ces/v1/session_connection.cc @@ -49,8 +49,7 @@ SessionServiceConnection::StreamRunSession( google::cloud::ces::v1::RunSessionRequest const&) { return google::cloud::internal::MakeStreamRange< google::cloud::ces::v1::RunSessionResponse>( - []() - -> absl::variant { + []() -> std::variant { return Status(StatusCode::kUnimplemented, "not implemented"); }); } diff --git a/google/cloud/datacatalog/lineage/v1/internal/lineage_connection_impl.cc b/google/cloud/datacatalog/lineage/v1/internal/lineage_connection_impl.cc index 1fa26b41d722e..cec953d6afddc 100644 --- a/google/cloud/datacatalog/lineage/v1/internal/lineage_connection_impl.cc +++ b/google/cloud/datacatalog/lineage/v1/internal/lineage_connection_impl.cc @@ -636,8 +636,8 @@ LineageConnectionImpl::SearchLineageStreaming( return internal::MakeStreamRange< google::cloud::datacatalog::lineage::v1::SearchLineageStreamingResponse>( [resumable = std::move(resumable)]() - -> absl::variant { + -> std::variant { google::cloud::datacatalog::lineage::v1::SearchLineageStreamingResponse response; auto status = resumable->Read(&response); diff --git a/google/cloud/datacatalog/lineage/v1/lineage_connection.cc b/google/cloud/datacatalog/lineage/v1/lineage_connection.cc index 716fc80493a3f..9efd11c831ebf 100644 --- a/google/cloud/datacatalog/lineage/v1/lineage_connection.cc +++ b/google/cloud/datacatalog/lineage/v1/lineage_connection.cc @@ -190,8 +190,8 @@ LineageConnection::SearchLineageStreaming( SearchLineageStreamingRequest const&) { return google::cloud::internal::MakeStreamRange< google::cloud::datacatalog::lineage::v1::SearchLineageStreamingResponse>( - []() -> absl::variant { + []() -> std::variant { return Status(StatusCode::kUnimplemented, "not implemented"); }); } diff --git a/google/cloud/dialogflow_cx/internal/sessions_connection_impl.cc b/google/cloud/dialogflow_cx/internal/sessions_connection_impl.cc index 36fa15174be17..7b6c55877f6dc 100644 --- a/google/cloud/dialogflow_cx/internal/sessions_connection_impl.cc +++ b/google/cloud/dialogflow_cx/internal/sessions_connection_impl.cc @@ -98,7 +98,7 @@ SessionsConnectionImpl::ServerStreamingDetectIntent( return internal::MakeStreamRange< google::cloud::dialogflow::cx::v3::DetectIntentResponse>( [resumable = std::move(resumable)]() - -> absl::variant< + -> std::variant< Status, google::cloud::dialogflow::cx::v3::DetectIntentResponse> { google::cloud::dialogflow::cx::v3::DetectIntentResponse response; auto status = resumable->Read(&response); diff --git a/google/cloud/dialogflow_cx/sessions_connection.cc b/google/cloud/dialogflow_cx/sessions_connection.cc index 859f189c99c82..97cf1842b7903 100644 --- a/google/cloud/dialogflow_cx/sessions_connection.cc +++ b/google/cloud/dialogflow_cx/sessions_connection.cc @@ -50,7 +50,7 @@ SessionsConnection::ServerStreamingDetectIntent( return google::cloud::internal::MakeStreamRange< google::cloud::dialogflow::cx::v3::DetectIntentResponse>( []() - -> absl::variant< + -> std::variant< Status, google::cloud::dialogflow::cx::v3::DetectIntentResponse> { return Status(StatusCode::kUnimplemented, "not implemented"); }); diff --git a/google/cloud/discoveryengine/v1/conversational_search_connection.cc b/google/cloud/discoveryengine/v1/conversational_search_connection.cc index f156e709f3a01..385734d91e1e0 100644 --- a/google/cloud/discoveryengine/v1/conversational_search_connection.cc +++ b/google/cloud/discoveryengine/v1/conversational_search_connection.cc @@ -88,7 +88,7 @@ ConversationalSearchServiceConnection::StreamAnswerQuery( return google::cloud::internal::MakeStreamRange< google::cloud::discoveryengine::v1::AnswerQueryResponse>( []() - -> absl::variant< + -> std::variant< Status, google::cloud::discoveryengine::v1::AnswerQueryResponse> { return Status(StatusCode::kUnimplemented, "not implemented"); }); diff --git a/google/cloud/discoveryengine/v1/internal/conversational_search_connection_impl.cc b/google/cloud/discoveryengine/v1/internal/conversational_search_connection_impl.cc index a5b6a0c1284b8..6672492174adc 100644 --- a/google/cloud/discoveryengine/v1/internal/conversational_search_connection_impl.cc +++ b/google/cloud/discoveryengine/v1/internal/conversational_search_connection_impl.cc @@ -227,7 +227,7 @@ ConversationalSearchServiceConnectionImpl::StreamAnswerQuery( return internal::MakeStreamRange< google::cloud::discoveryengine::v1::AnswerQueryResponse>( [resumable = std::move(resumable)]() - -> absl::variant< + -> std::variant< Status, google::cloud::discoveryengine::v1::AnswerQueryResponse> { google::cloud::discoveryengine::v1::AnswerQueryResponse response; auto status = resumable->Read(&response); diff --git a/google/cloud/future_generic.h b/google/cloud/future_generic.h index 4c3049dd4d6c2..ad3a014d5787d 100644 --- a/google/cloud/future_generic.h +++ b/google/cloud/future_generic.h @@ -20,7 +20,6 @@ #include "google/cloud/internal/future_impl.h" #include "google/cloud/internal/invoke_result.h" #include "google/cloud/version.h" -#include "absl/meta/type_traits.h" #include #include @@ -64,7 +63,7 @@ class future final : private internal::future_base { * future's result type. */ template ::value>> + std::enable_if_t::value>> explicit future(future&& rhs); /** diff --git a/google/cloud/geminidataanalytics/v1/data_chat_connection.cc b/google/cloud/geminidataanalytics/v1/data_chat_connection.cc index 34b1384912545..a422c2d653bf1 100644 --- a/google/cloud/geminidataanalytics/v1/data_chat_connection.cc +++ b/google/cloud/geminidataanalytics/v1/data_chat_connection.cc @@ -43,8 +43,8 @@ DataChatServiceConnection::Chat( google::cloud::geminidataanalytics::v1::ChatRequest const&) { return google::cloud::internal::MakeStreamRange< google::cloud::geminidataanalytics::v1::Message>( - []() -> absl::variant { + []() -> std::variant { return Status(StatusCode::kUnimplemented, "not implemented"); }); } diff --git a/google/cloud/geminidataanalytics/v1/internal/data_chat_connection_impl.cc b/google/cloud/geminidataanalytics/v1/internal/data_chat_connection_impl.cc index d1757fe6feaf9..00fbd526610c4 100644 --- a/google/cloud/geminidataanalytics/v1/internal/data_chat_connection_impl.cc +++ b/google/cloud/geminidataanalytics/v1/internal/data_chat_connection_impl.cc @@ -89,8 +89,8 @@ DataChatServiceConnectionImpl::Chat( return internal::MakeStreamRange< google::cloud::geminidataanalytics::v1::Message>( [resumable = std::move(resumable)]() - -> absl::variant { + -> std::variant { google::cloud::geminidataanalytics::v1::Message response; auto status = resumable->Read(&response); if (status.has_value()) return *status; diff --git a/google/cloud/internal/future_impl.h b/google/cloud/internal/future_impl.h index 23fb11151f795..f7e28765293cc 100644 --- a/google/cloud/internal/future_impl.h +++ b/google/cloud/internal/future_impl.h @@ -18,7 +18,6 @@ #include "google/cloud/internal/future_fwd.h" #include "google/cloud/terminate_handler.h" #include "google/cloud/version.h" -#include "absl/types/variant.h" #include #include #include @@ -26,6 +25,7 @@ #include #include #include +#include namespace google { namespace cloud { @@ -49,7 +49,7 @@ class future_shared_state; /** * A monostate for `future`. * - * The implementation already uses `absl::monostate` to represent "future + * The implementation already uses `std::monostate` to represent "future * is **not** set". We need a distinct type to represent "`future` value * is set". */ @@ -159,7 +159,7 @@ class future_shared_state final { // NOLINT(readability-identifier-naming) /** * The different states of the shared state. * - * The shared state is initialized with `absl::monostate`, this represents + * The shared state is initialized with `std::monostate`, this represents * an unsatisfied future. * * The future may be satisfied with an exception, stored as a @@ -171,8 +171,8 @@ class future_shared_state final { // NOLINT(readability-identifier-naming) * Finally, the value and/or exception may be retrieved as part of invoking * any continuation. We store this as a `FutureValueRetrieved`. */ - using ValueType = absl::variant; + using ValueType = + std::variant; #if __clang__ #elif __GNUC__ @@ -212,7 +212,7 @@ class future_shared_state final { // NOLINT(readability-identifier-naming) ThrowFutureError(std::future_errc::no_state, "future::get() - already retrieved"); } - T operator()(absl::monostate) { + T operator()(std::monostate) { ThrowFutureError(std::future_errc::no_state, "future::get() - not set"); } @@ -222,7 +222,7 @@ class future_shared_state final { // NOLINT(readability-identifier-naming) // future, so new calls will fail. ValueType tmp(FutureValueRetrieved{}); tmp.swap(value_); - return absl::visit(Visitor{}, std::move(tmp)); + return std::visit(Visitor{}, std::move(tmp)); } /** @@ -421,7 +421,7 @@ class future_shared_state final { // NOLINT(readability-identifier-naming) protected: bool is_ready_unlocked() const { - return !absl::holds_alternative(value_); + return !std::holds_alternative(value_); } /// Satisfy the shared state using an exception. @@ -468,7 +468,7 @@ class future_shared_state final { // NOLINT(readability-identifier-naming) /// Synchronize changes to `value_` and `cv_`. mutable std::mutex mu_; - /// Used to wait until `value_` does not contain `absl::monostate`. + /// Used to wait until `value_` does not contain `std::monostate`. std::condition_variable cv_; /// The value of the shared state. ValueType value_; diff --git a/google/cloud/internal/future_then_impl.h b/google/cloud/internal/future_then_impl.h index a73fe09aa8752..d5497bcd89f4d 100644 --- a/google/cloud/internal/future_then_impl.h +++ b/google/cloud/internal/future_then_impl.h @@ -22,6 +22,7 @@ #include "absl/functional/function_ref.h" #include #include +#include namespace google { namespace cloud { @@ -97,14 +98,14 @@ struct FutureThenImpl { struct Visitor { std::shared_ptr> output; - void operator()(absl::monostate) { output->abandon(); } + void operator()(std::monostate) { output->abandon(); } void operator()(std::exception_ptr e) { output->set_exception(std::move(e)); } void operator()(FutureValueRetrieved) { output->abandon(); } void operator()(T v) { set_value(*output, std::move(v)); } }; - return absl::visit(Visitor{std::move(output_)}, s.value()); + return std::visit(Visitor{std::move(output_)}, s.value()); } private: @@ -131,7 +132,7 @@ struct FutureThenImpl { struct Visitor { std::shared_ptr> output; - void operator()(absl::monostate) { output->abandon(); } + void operator()(std::monostate) { output->abandon(); } void operator()(std::exception_ptr e) { output->set_exception(std::move(e)); } @@ -140,7 +141,7 @@ struct FutureThenImpl { unwrap(std::move(output), std::move(v.shared_state_)); } }; - return absl::visit(Visitor{std::move(output_)}, s.value()); + return std::visit(Visitor{std::move(output_)}, s.value()); } private: diff --git a/google/cloud/internal/streaming_read_rpc_logging_test.cc b/google/cloud/internal/streaming_read_rpc_logging_test.cc index a65b86a34990f..24effa865fbfa 100644 --- a/google/cloud/internal/streaming_read_rpc_logging_test.cc +++ b/google/cloud/internal/streaming_read_rpc_logging_test.cc @@ -16,7 +16,6 @@ #include "google/cloud/status.h" #include "google/cloud/testing_util/scoped_log.h" #include "google/cloud/tracing_options.h" -#include "absl/types/variant.h" #include "google/protobuf/duration.pb.h" #include diff --git a/google/cloud/internal/traced_stream_range.h b/google/cloud/internal/traced_stream_range.h index 8342febf24c72..6eff998cab890 100644 --- a/google/cloud/internal/traced_stream_range.h +++ b/google/cloud/internal/traced_stream_range.h @@ -39,7 +39,7 @@ class TracedStreamRange { (void)End(Status()); } - absl::variant Advance() { + std::variant Advance() { if (it_ == sr_.end()) return End(Status()); auto sor = *it_; ++it_; diff --git a/google/cloud/internal/type_list.h b/google/cloud/internal/type_list.h index caaa771e526f3..23100126dc9fe 100644 --- a/google/cloud/internal/type_list.h +++ b/google/cloud/internal/type_list.h @@ -16,7 +16,6 @@ #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_TYPE_LIST_H #include "google/cloud/version.h" -#include "absl/meta/type_traits.h" #include #include #include @@ -93,7 +92,7 @@ struct TypeListHasType; template struct TypeListHasType, T> - : absl::disjunction...> {}; + : std::disjunction...> {}; template