Skip to content

Commit c2fba5b

Browse files
jckingcopybara-github
authored andcommitted
Remove assignment operators
PiperOrigin-RevId: 738086887
1 parent bbc41e4 commit c2fba5b

File tree

6 files changed

+3
-51
lines changed

6 files changed

+3
-51
lines changed

common/values/bool_value.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
#include <ostream>
2222
#include <string>
23-
#include <type_traits>
2423

2524
#include "absl/base/nullability.h"
2625
#include "absl/status/status.h"
@@ -50,13 +49,7 @@ class BoolValue final : private common_internal::ValueMixin<BoolValue> {
5049
BoolValue& operator=(const BoolValue&) = default;
5150
BoolValue& operator=(BoolValue&&) = default;
5251

53-
constexpr explicit BoolValue(bool value) noexcept : value_(value) {}
54-
55-
template <typename T, typename = std::enable_if_t<std::is_same_v<T, bool>>>
56-
BoolValue& operator=(T value) noexcept {
57-
value_ = value;
58-
return *this;
59-
}
52+
explicit BoolValue(bool value) noexcept : value_(value) {}
6053

6154
// NOLINTNEXTLINE(google-explicit-constructor)
6255
operator bool() const noexcept { return value_; }
@@ -110,9 +103,9 @@ inline std::ostream& operator<<(std::ostream& out, BoolValue value) {
110103
return out << value.DebugString();
111104
}
112105

113-
constexpr BoolValue FalseValue() { return BoolValue(false); }
106+
inline BoolValue FalseValue() noexcept { return BoolValue(false); }
114107

115-
constexpr BoolValue TrueValue() { return BoolValue(true); }
108+
inline BoolValue TrueValue() noexcept { return BoolValue(true); }
116109

117110
} // namespace cel
118111

common/values/double_value.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
#include <ostream>
2222
#include <string>
23-
#include <type_traits>
2423

2524
#include "absl/base/nullability.h"
2625
#include "absl/status/status.h"
@@ -45,14 +44,6 @@ class DoubleValue final : private common_internal::ValueMixin<DoubleValue> {
4544

4645
explicit DoubleValue(double value) noexcept : value_(value) {}
4746

48-
template <typename T,
49-
typename = std::enable_if_t<std::conjunction_v<
50-
std::is_floating_point<T>, std::is_convertible<T, double>>>>
51-
DoubleValue& operator=(T value) noexcept {
52-
value_ = value;
53-
return *this;
54-
}
55-
5647
DoubleValue() = default;
5748
DoubleValue(const DoubleValue&) = default;
5849
DoubleValue(DoubleValue&&) = default;

common/values/duration_value.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ class DurationValue final : private common_internal::ValueMixin<DurationValue> {
5555
ABSL_DCHECK_OK(internal::ValidateDuration(value));
5656
}
5757

58-
DurationValue& operator=(absl::Duration value) noexcept {
59-
ABSL_DCHECK_OK(internal::ValidateDuration(value));
60-
value_ = value;
61-
return *this;
62-
}
63-
6458
DurationValue() = default;
6559
DurationValue(const DurationValue&) = default;
6660
DurationValue(DurationValue&&) = default;

common/values/int_value.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <cstdint>
2222
#include <ostream>
2323
#include <string>
24-
#include <type_traits>
2524

2625
#include "absl/base/nullability.h"
2726
#include "absl/status/status.h"
@@ -47,15 +46,6 @@ class IntValue final : private common_internal::ValueMixin<IntValue> {
4746

4847
explicit IntValue(int64_t value) noexcept : value_(value) {}
4948

50-
template <typename T,
51-
typename = std::enable_if_t<std::conjunction_v<
52-
std::is_integral<T>, std::negation<std::is_same<T, bool>>,
53-
std::is_convertible<T, int64_t>>>>
54-
IntValue& operator=(T value) noexcept {
55-
value_ = value;
56-
return *this;
57-
}
58-
5949
IntValue() = default;
6050
IntValue(const IntValue&) = default;
6151
IntValue(IntValue&&) = default;

common/values/timestamp_value.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ class TimestampValue final
5656
ABSL_DCHECK_OK(internal::ValidateTimestamp(value));
5757
}
5858

59-
TimestampValue& operator=(absl::Time value) noexcept {
60-
ABSL_DCHECK_OK(internal::ValidateTimestamp(value));
61-
value_ = value;
62-
return *this;
63-
}
64-
6559
TimestampValue() = default;
6660
TimestampValue(const TimestampValue&) = default;
6761
TimestampValue(TimestampValue&&) = default;

common/values/uint_value.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <cstdint>
2222
#include <ostream>
2323
#include <string>
24-
#include <type_traits>
2524

2625
#include "absl/base/nullability.h"
2726
#include "absl/status/status.h"
@@ -47,15 +46,6 @@ class UintValue final : private common_internal::ValueMixin<UintValue> {
4746

4847
explicit UintValue(uint64_t value) noexcept : value_(value) {}
4948

50-
template <typename T,
51-
typename = std::enable_if_t<std::conjunction_v<
52-
std::is_integral<T>, std::negation<std::is_same<T, bool>>,
53-
std::is_convertible<T, int64_t>>>>
54-
UintValue& operator=(T value) noexcept {
55-
value_ = value;
56-
return *this;
57-
}
58-
5949
UintValue() = default;
6050
UintValue(const UintValue&) = default;
6151
UintValue(UintValue&&) = default;

0 commit comments

Comments
 (0)