Made the acccessors method to return const references

Summary: Made the acccessors method to return const references

Reviewed By: emilsjolander

Differential Revision: D7321801

fbshipit-source-id: 9fc4da724bc2f58a0d95824ca3c0b5bf1690bccf
This commit is contained in:
Pritesh Nandgaonkar
2018-04-04 07:55:23 -07:00
committed by Facebook Github Bot
parent cb6e76973d
commit 08743a42e2
2 changed files with 4 additions and 4 deletions

View File

@@ -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_;
}