diff --git a/ReactCommon/yoga/yoga/YGFloatOptional.cpp b/ReactCommon/yoga/yoga/YGFloatOptional.cpp index 380e7880c..1947e9f17 100644 --- a/ReactCommon/yoga/yoga/YGFloatOptional.cpp +++ b/ReactCommon/yoga/yoga/YGFloatOptional.cpp @@ -14,7 +14,7 @@ YGFloatOptional::YGFloatOptional(const float& value) : value_(value), isUndefined_(false) {} YGFloatOptional::YGFloatOptional() : value_(0), isUndefined_(true) {} -float YGFloatOptional::getValue() const { +const float& YGFloatOptional::getValue() const { if (isUndefined_) { // Abort, accessing a value of an undefined float optional std::cerr << "Tried to get value of an undefined YGFloatOptional\n"; @@ -28,7 +28,7 @@ void YGFloatOptional::setValue(const float& val) { isUndefined_ = false; } -bool YGFloatOptional::isUndefined() const { +const bool& YGFloatOptional::isUndefined() const { return isUndefined_; } diff --git a/ReactCommon/yoga/yoga/YGFloatOptional.h b/ReactCommon/yoga/yoga/YGFloatOptional.h index 1f633c365..9894e40eb 100644 --- a/ReactCommon/yoga/yoga/YGFloatOptional.h +++ b/ReactCommon/yoga/yoga/YGFloatOptional.h @@ -17,12 +17,12 @@ struct YGFloatOptional { // Program will terminate if the value of an undefined is accessed. Please // make sure to check if the optional is defined before calling this function. // To check if float optional is defined, use `isUndefined()`. - float getValue() const; + const float& getValue() const; // Sets the value of float optional, and thus isUndefined is assigned false. void setValue(const float& val); - bool isUndefined() const; + const bool& isUndefined() const; bool operator==(const YGFloatOptional& op) const; bool operator!=(const YGFloatOptional& op) const;