mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
Tidy up YGFloatOptional further
Summary: I missed these two things: inline default ctor, getValue() should return a float. Reviewed By: priteshrnandgaonkar Differential Revision: D8826640 fbshipit-source-id: e6324dea0268ef276e6fa1722e72dffb5241e676
This commit is contained in:
parent
e589595bc9
commit
727ee92de5
@ -20,9 +20,7 @@ YGFloatOptional::YGFloatOptional(float value) {
|
||||
}
|
||||
}
|
||||
|
||||
YGFloatOptional::YGFloatOptional() : value_(0), isUndefined_(true) {}
|
||||
|
||||
const float& YGFloatOptional::getValue() 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";
|
||||
|
@ -14,12 +14,12 @@ struct YGFloatOptional {
|
||||
|
||||
public:
|
||||
explicit YGFloatOptional(float value);
|
||||
explicit YGFloatOptional();
|
||||
explicit YGFloatOptional() : value_(0), isUndefined_(true) {}
|
||||
|
||||
// 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()`.
|
||||
const float& getValue() const;
|
||||
float getValue() const;
|
||||
|
||||
// Sets the value of float optional, and thus isUndefined is assigned false.
|
||||
void setValue(float val) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user