diff --git a/packages/react-native/ReactCommon/react/renderer/components/scrollview/primitives.h b/packages/react-native/ReactCommon/react/renderer/components/scrollview/primitives.h index d97dbfffdcd..cb75ebb7ac1 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/scrollview/primitives.h +++ b/packages/react-native/ReactCommon/react/renderer/components/scrollview/primitives.h @@ -25,11 +25,7 @@ class ScrollViewMaintainVisibleContentPosition final { int minIndexForVisible{0}; std::optional autoscrollToTopThreshold{}; - bool operator==(const ScrollViewMaintainVisibleContentPosition &rhs) const - { - return std::tie(this->minIndexForVisible, this->autoscrollToTopThreshold) == - std::tie(rhs.minIndexForVisible, rhs.autoscrollToTopThreshold); - } + bool operator==(const ScrollViewMaintainVisibleContentPosition &rhs) const = default; }; } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/primitives.h b/packages/react-native/ReactCommon/react/renderer/components/view/primitives.h index e242eb7adec..0bcd3ca6f8b 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/primitives.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/primitives.h @@ -178,35 +178,7 @@ struct CascadedRectangleEdges { }; } - bool operator==(const CascadedRectangleEdges &rhs) const - { - return std::tie( - this->left, - this->top, - this->right, - this->bottom, - this->start, - this->end, - this->horizontal, - this->vertical, - this->all, - this->block, - this->blockStart, - this->blockEnd) == - std::tie( - rhs.left, - rhs.top, - rhs.right, - rhs.bottom, - rhs.start, - rhs.end, - rhs.horizontal, - rhs.vertical, - rhs.all, - rhs.block, - rhs.blockStart, - rhs.blockEnd); - } + bool operator==(const CascadedRectangleEdges &rhs) const = default; }; template @@ -251,37 +223,7 @@ struct CascadedRectangleCorners { }; } - bool operator==(const CascadedRectangleCorners &rhs) const - { - return std::tie( - this->topLeft, - this->topRight, - this->bottomLeft, - this->bottomRight, - this->topStart, - this->topEnd, - this->bottomStart, - this->bottomEnd, - this->all, - this->endEnd, - this->endStart, - this->startEnd, - this->startStart) == - std::tie( - rhs.topLeft, - rhs.topRight, - rhs.bottomLeft, - rhs.bottomRight, - rhs.topStart, - rhs.topEnd, - rhs.bottomStart, - rhs.bottomEnd, - rhs.all, - rhs.endEnd, - rhs.endStart, - rhs.startEnd, - rhs.startStart); - } + bool operator==(const CascadedRectangleCorners &rhs) const = default; }; using BorderWidths = RectangleEdges; @@ -303,12 +245,7 @@ struct BorderMetrics { BorderCurves borderCurves{}; BorderStyles borderStyles{}; - bool operator==(const BorderMetrics &rhs) const - { - return std::tie( - this->borderColors, this->borderWidths, this->borderRadii, this->borderCurves, this->borderStyles) == - std::tie(rhs.borderColors, rhs.borderWidths, rhs.borderRadii, rhs.borderCurves, rhs.borderStyles); - } + bool operator==(const BorderMetrics &rhs) const = default; }; } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/css/CSSBackgroundImage.h b/packages/react-native/ReactCommon/react/renderer/css/CSSBackgroundImage.h index 5f11cfaf83f..6df7eee43df 100644 --- a/packages/react-native/ReactCommon/react/renderer/css/CSSBackgroundImage.h +++ b/packages/react-native/ReactCommon/react/renderer/css/CSSBackgroundImage.h @@ -169,10 +169,7 @@ static_assert(CSSDataType); struct CSSColorHint { std::variant position{}; // Support both lengths and percentages - bool operator==(const CSSColorHint &rhs) const - { - return position == rhs.position; - } + bool operator==(const CSSColorHint &rhs) const = default; }; template <> @@ -423,10 +420,7 @@ struct CSSRadialGradientPosition { std::optional> left{}; std::optional> right{}; - bool operator==(const CSSRadialGradientPosition &rhs) const - { - return top == rhs.top && bottom == rhs.bottom && left == rhs.left && right == rhs.right; - } + bool operator==(const CSSRadialGradientPosition &rhs) const = default; }; struct CSSRadialGradientFunction { diff --git a/packages/react-native/ReactCommon/react/renderer/graphics/LinearGradient.h b/packages/react-native/ReactCommon/react/renderer/graphics/LinearGradient.h index 6e105009d1f..c761cdbf726 100644 --- a/packages/react-native/ReactCommon/react/renderer/graphics/LinearGradient.h +++ b/packages/react-native/ReactCommon/react/renderer/graphics/LinearGradient.h @@ -31,10 +31,7 @@ struct GradientDirection { GradientDirectionType type; std::variant value; - bool operator==(const GradientDirection &other) const - { - return type == other.type && value == other.value; - } + bool operator==(const GradientDirection &other) const = default; #ifdef RN_SERIALIZABLE_STATE folly::dynamic toDynamic() const; @@ -45,10 +42,7 @@ struct LinearGradient { GradientDirection direction; std::vector colorStops; - bool operator==(const LinearGradient &other) const - { - return direction == other.direction && colorStops == other.colorStops; - } + bool operator==(const LinearGradient &other) const = default; #ifdef RN_SERIALIZABLE_STATE folly::dynamic toDynamic() const; diff --git a/packages/react-native/ReactCommon/react/renderer/graphics/RadialGradient.h b/packages/react-native/ReactCommon/react/renderer/graphics/RadialGradient.h index 6a221785d6a..8e70761b893 100644 --- a/packages/react-native/ReactCommon/react/renderer/graphics/RadialGradient.h +++ b/packages/react-native/ReactCommon/react/renderer/graphics/RadialGradient.h @@ -31,10 +31,7 @@ struct RadialGradientSize { ValueUnit x; ValueUnit y; - bool operator==(const Dimensions &other) const - { - return x == other.x && y == other.y; - } + bool operator==(const Dimensions &other) const = default; #ifdef RN_SERIALIZABLE_STATE folly::dynamic toDynamic() const; @@ -43,10 +40,7 @@ struct RadialGradientSize { std::variant value; - bool operator==(const RadialGradientSize &other) const - { - return value == other.value; - } + bool operator==(const RadialGradientSize &other) const = default; #ifdef RN_SERIALIZABLE_STATE folly::dynamic toDynamic() const; @@ -59,10 +53,7 @@ struct RadialGradientPosition { std::optional right; std::optional bottom; - bool operator==(const RadialGradientPosition &other) const - { - return top == other.top && left == other.left && right == other.right && bottom == other.bottom; - } + bool operator==(const RadialGradientPosition &other) const = default; #ifdef RN_SERIALIZABLE_STATE folly::dynamic toDynamic() const; @@ -75,10 +66,7 @@ struct RadialGradient { RadialGradientPosition position; std::vector colorStops; - bool operator==(const RadialGradient &other) const - { - return shape == other.shape && size == other.size && position == other.position && colorStops == other.colorStops; - } + bool operator==(const RadialGradient &other) const = default; #ifdef RN_SERIALIZABLE_STATE folly::dynamic toDynamic() const; diff --git a/packages/react-native/ReactCommon/react/renderer/graphics/Rect.h b/packages/react-native/ReactCommon/react/renderer/graphics/Rect.h index 2f373343fe1..a9a4dcb9057 100644 --- a/packages/react-native/ReactCommon/react/renderer/graphics/Rect.h +++ b/packages/react-native/ReactCommon/react/renderer/graphics/Rect.h @@ -24,10 +24,7 @@ struct Rect { Point origin{.x = 0, .y = 0}; Size size{.width = 0, .height = 0}; - bool operator==(const Rect &rhs) const noexcept - { - return std::tie(this->origin, this->size) == std::tie(rhs.origin, rhs.size); - } + bool operator==(const Rect &rhs) const noexcept = default; Float getMaxX() const noexcept { diff --git a/packages/react-native/ReactCommon/react/renderer/graphics/RectangleCorners.h b/packages/react-native/ReactCommon/react/renderer/graphics/RectangleCorners.h index 88bf8799d97..00b3f9a109e 100644 --- a/packages/react-native/ReactCommon/react/renderer/graphics/RectangleCorners.h +++ b/packages/react-native/ReactCommon/react/renderer/graphics/RectangleCorners.h @@ -25,11 +25,7 @@ struct RectangleCorners { T bottomLeft{}; T bottomRight{}; - bool operator==(const RectangleCorners &rhs) const noexcept - { - return std::tie(this->topLeft, this->topRight, this->bottomLeft, this->bottomRight) == - std::tie(rhs.topLeft, rhs.topRight, rhs.bottomLeft, rhs.bottomRight); - } + bool operator==(const RectangleCorners &rhs) const noexcept = default; bool isUniform() const noexcept { diff --git a/packages/react-native/ReactCommon/react/renderer/graphics/RectangleEdges.h b/packages/react-native/ReactCommon/react/renderer/graphics/RectangleEdges.h index da9461dacf6..cccfcbd909a 100644 --- a/packages/react-native/ReactCommon/react/renderer/graphics/RectangleEdges.h +++ b/packages/react-native/ReactCommon/react/renderer/graphics/RectangleEdges.h @@ -26,11 +26,7 @@ struct RectangleEdges { T right{}; T bottom{}; - bool operator==(const RectangleEdges &rhs) const noexcept - { - return std::tie(this->left, this->top, this->right, this->bottom) == - std::tie(rhs.left, rhs.top, rhs.right, rhs.bottom); - } + bool operator==(const RectangleEdges &rhs) const noexcept = default; bool isUniform() const noexcept { diff --git a/packages/react-native/ReactCommon/react/renderer/graphics/Transform.h b/packages/react-native/ReactCommon/react/renderer/graphics/Transform.h index bced6bca883..2f3a6902142 100644 --- a/packages/react-native/ReactCommon/react/renderer/graphics/Transform.h +++ b/packages/react-native/ReactCommon/react/renderer/graphics/Transform.h @@ -49,10 +49,7 @@ struct TransformOrigin { std::array xy = {ValueUnit(0.0f, UnitType::Undefined), ValueUnit(0.0f, UnitType::Undefined)}; float z = 0.0f; - bool operator==(const TransformOrigin &other) const - { - return xy[0] == other.xy[0] && xy[1] == other.xy[1] && z == other.z; - } + bool operator==(const TransformOrigin &other) const = default; bool isSet() const { return xy[0].value != 0.0f || xy[0].unit != UnitType::Undefined || xy[1].value != 0.0f || diff --git a/packages/react-native/ReactCommon/react/renderer/graphics/ValueUnit.h b/packages/react-native/ReactCommon/react/renderer/graphics/ValueUnit.h index 8ce975ec411..ff654387062 100644 --- a/packages/react-native/ReactCommon/react/renderer/graphics/ValueUnit.h +++ b/packages/react-native/ReactCommon/react/renderer/graphics/ValueUnit.h @@ -29,10 +29,7 @@ struct ValueUnit { constexpr ValueUnit() = default; constexpr ValueUnit(float v, UnitType u) : value(v), unit(u) {} - constexpr bool operator==(const ValueUnit &other) const - { - return value == other.value && unit == other.unit; - } + constexpr bool operator==(const ValueUnit &other) const = default; constexpr float resolve(float referenceLength) const { diff --git a/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageRequestParams.h b/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageRequestParams.h index 1cb6170b557..e960e01b5b5 100644 --- a/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageRequestParams.h +++ b/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageRequestParams.h @@ -62,37 +62,7 @@ class ImageRequestParams { std::string analyticTag{}; Size size{}; - bool operator==(const ImageRequestParams &rhs) const - { - return std::tie( - this->blurRadius, - this->defaultSource, - this->resizeMode, - this->resizeMethod, - this->resizeMultiplier, - this->shouldNotifyLoadEvents, - this->overlayColor, - this->tintColor, - this->fadeDuration, - this->progressiveRenderingEnabled, - this->loadingIndicatorSource, - this->analyticTag, - this->size) == - std::tie( - rhs.blurRadius, - rhs.defaultSource, - rhs.resizeMode, - rhs.resizeMethod, - rhs.resizeMultiplier, - rhs.shouldNotifyLoadEvents, - rhs.overlayColor, - rhs.tintColor, - rhs.fadeDuration, - rhs.progressiveRenderingEnabled, - rhs.loadingIndicatorSource, - rhs.analyticTag, - rhs.size); - } + bool operator==(const ImageRequestParams &rhs) const = default; }; struct ImageRequestItem { diff --git a/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequestParams.h b/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequestParams.h index 581d9b25221..a30f0103dda 100644 --- a/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequestParams.h +++ b/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequestParams.h @@ -18,10 +18,7 @@ class ImageRequestParams { Float blurRadius{}; - bool operator==(const ImageRequestParams &rhs) const - { - return this->blurRadius == rhs.blurRadius; - } + bool operator==(const ImageRequestParams &rhs) const = default; }; } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/ImageRequestParams.h b/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/ImageRequestParams.h index 834facd115b..389f950ed31 100644 --- a/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/ImageRequestParams.h +++ b/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/ImageRequestParams.h @@ -18,10 +18,7 @@ class ImageRequestParams { Float blurRadius{}; - bool operator==(const ImageRequestParams &rhs) const - { - return this->blurRadius == rhs.blurRadius; - } + bool operator==(const ImageRequestParams &rhs) const = default; }; } // namespace facebook::react