From 05cd41fb0310430792e60dea8ab6942c016f59ab Mon Sep 17 00:00:00 2001 From: Differential Privacy Team Date: Tue, 4 Jun 2024 08:53:30 -0700 Subject: [PATCH] Use std::optional and std::make_unique in favor of absl::* in C++ Change-Id: Ia6bdcdd058d7aeb8e17e71a20c5c4e86a003c58a GitOrigin-RevId: 549aaa2bf32936824b027b2481d710eb801cb6d8 --- cc/algorithms/bounded-sum.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cc/algorithms/bounded-sum.h b/cc/algorithms/bounded-sum.h index 9c619327..784ad2c0 100644 --- a/cc/algorithms/bounded-sum.h +++ b/cc/algorithms/bounded-sum.h @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -476,14 +477,14 @@ class BoundedSum::Builder { } private: - absl::optional epsilon_; + std::optional epsilon_; double delta_ = 0; - absl::optional upper_; - absl::optional lower_; + std::optional upper_; + std::optional lower_; int max_partitions_contributed_ = 1; int max_contributions_per_partition_ = 1; std::unique_ptr mechanism_builder_ = - absl::make_unique(); + std::make_unique(); std::unique_ptr> approx_bounds_; absl::StatusOr>> BuildSumWithFixedBounds() { @@ -495,7 +496,7 @@ class BoundedSum::Builder { upper_.value())); return absl::StatusOr>>( - absl::make_unique>( + std::make_unique>( epsilon_.value(), delta_, lower_.value(), upper_.value(), std::move(mechanism))); } @@ -520,7 +521,7 @@ class BoundedSum::Builder { } return absl::StatusOr>>( - absl::make_unique>( + std::make_unique>( epsilon_.value(), delta_, max_partitions_contributed_, max_contributions_per_partition_, mechanism_builder_->Clone(), std::move(approx_bounds_)));