diff --git a/ReactCommon/yoga/yoga/YGLayout.cpp b/ReactCommon/yoga/yoga/YGLayout.cpp index dfd7be08b..03933ac9a 100644 --- a/ReactCommon/yoga/yoga/YGLayout.cpp +++ b/ReactCommon/yoga/yoga/YGLayout.cpp @@ -61,7 +61,3 @@ bool YGLayout::operator==(YGLayout layout) const { return isEqual; } - -bool YGLayout::operator!=(YGLayout layout) const { - return !(*this == layout); -} diff --git a/ReactCommon/yoga/yoga/YGLayout.h b/ReactCommon/yoga/yoga/YGLayout.h index ebd934333..1df905d0b 100644 --- a/ReactCommon/yoga/yoga/YGLayout.h +++ b/ReactCommon/yoga/yoga/YGLayout.h @@ -38,5 +38,7 @@ struct YGLayout { YGLayout(); bool operator==(YGLayout layout) const; - bool operator!=(YGLayout layout) const; + bool operator!=(YGLayout layout) const { + return !(*this == layout); + } }; diff --git a/ReactCommon/yoga/yoga/YGNode.cpp b/ReactCommon/yoga/yoga/YGNode.cpp index fc97e1728..a80484f16 100644 --- a/ReactCommon/yoga/yoga/YGNode.cpp +++ b/ReactCommon/yoga/yoga/YGNode.cpp @@ -254,29 +254,6 @@ void YGNode::setPosition( trailing[crossAxis]); } -YGNode::YGNode() - : context_(nullptr), - print_(nullptr), - hasNewLayout_(true), - nodeType_(YGNodeTypeDefault), - measure_(nullptr), - baseline_(nullptr), - dirtied_(nullptr), - style_(YGStyle()), - layout_(YGLayout()), - lineIndex_(0), - owner_(nullptr), - children_(YGVector()), - config_(nullptr), - isDirty_(false), - resolvedDimensions_({{YGValueUndefined, YGValueUndefined}}) {} - -YGNode::YGNode(const YGNode& node) = default; - -YGNode::YGNode(const YGConfigRef newConfig) : YGNode() { - config_ = newConfig; -} - YGNode& YGNode::operator=(const YGNode& node) { if (&node == this) { return *this; @@ -360,11 +337,6 @@ void YGNode::clearChildren() { children_.shrink_to_fit(); } -YGNode::~YGNode() { - // All the member variables are deallocated externally, so no need to - // deallocate here -} - // Other Methods void YGNode::cloneChildrenIfNeeded() { diff --git a/ReactCommon/yoga/yoga/YGNode.h b/ReactCommon/yoga/yoga/YGNode.h index b02c02cbf..7120846ef 100644 --- a/ReactCommon/yoga/yoga/YGNode.h +++ b/ReactCommon/yoga/yoga/YGNode.h @@ -14,31 +14,32 @@ struct YGNode { private: - void* context_; - YGPrintFunc print_; - bool hasNewLayout_; - YGNodeType nodeType_; - YGMeasureFunc measure_; - YGBaselineFunc baseline_; - YGDirtiedFunc dirtied_; - YGStyle style_; - YGLayout layout_; - uint32_t lineIndex_; - YGNodeRef owner_; - YGVector children_; - YGConfigRef config_; - bool isDirty_; - std::array resolvedDimensions_; + void* context_ = nullptr; + YGPrintFunc print_ = nullptr; + bool hasNewLayout_ = true; + YGNodeType nodeType_ = YGNodeTypeDefault; + YGMeasureFunc measure_ = nullptr; + YGBaselineFunc baseline_ = nullptr; + YGDirtiedFunc dirtied_ = nullptr; + YGStyle style_ = {}; + YGLayout layout_ = {}; + uint32_t lineIndex_ = 0; + YGNodeRef owner_ = nullptr; + YGVector children_ = {}; + YGConfigRef config_ = nullptr; + bool isDirty_ = false; + std::array resolvedDimensions_ = { + {YGValueUndefined, YGValueUndefined}}; YGFloatOptional relativePosition( const YGFlexDirection& axis, const float& axisSize) const; public: - YGNode(); - ~YGNode(); - explicit YGNode(const YGConfigRef newConfig); - YGNode(const YGNode& node); + YGNode() = default; + ~YGNode() = default; // cleanup of owner/children relationships in YGNodeFree + explicit YGNode(const YGConfigRef newConfig) : config_(newConfig){}; + YGNode(const YGNode& node) = default; YGNode& operator=(const YGNode& node); // Getters diff --git a/ReactCommon/yoga/yoga/YGStyle.cpp b/ReactCommon/yoga/yoga/YGStyle.cpp index 738d36fb0..06d0f2a4b 100644 --- a/ReactCommon/yoga/yoga/YGStyle.cpp +++ b/ReactCommon/yoga/yoga/YGStyle.cpp @@ -98,9 +98,3 @@ bool YGStyle::operator==(const YGStyle& style) { return areNonFloatValuesEqual; } - -bool YGStyle::operator!=(YGStyle style) { - return !(*this == style); -} - -YGStyle::~YGStyle() {} diff --git a/ReactCommon/yoga/yoga/YGStyle.h b/ReactCommon/yoga/yoga/YGStyle.h index b18ac0a6e..3f4bbd347 100644 --- a/ReactCommon/yoga/yoga/YGStyle.h +++ b/ReactCommon/yoga/yoga/YGStyle.h @@ -32,12 +32,14 @@ struct YGStyle { std::array dimensions; std::array minDimensions; std::array maxDimensions; + // Yoga specific properties, not compatible with flexbox specification YGFloatOptional aspectRatio; YGStyle(); - // Yoga specific properties, not compatible with flexbox specification bool operator==(const YGStyle& style); - bool operator!=(YGStyle style); - ~YGStyle(); + bool operator!=(YGStyle style) { + return !(*this == style); + } + ~YGStyle() = default; };