Remove YGUnwrapFloatOptional

Summary:
Replaces `YGUnwrapFloatOptional` with `YGFloatOptional::unwrap`.

This leads to more idiomatic C++, and to less function call nesting, thus increasing readability.

Reviewed By: SidharthGuglani

Differential Revision: D13439604

fbshipit-source-id: 33b43c08d725c253c359959e7cbbd83fd6bd9ba4
This commit is contained in:
David Aurelio
2018-12-13 07:09:30 -08:00
committed by Facebook Github Bot
parent 6bdd39d0ed
commit aaa018bbea
6 changed files with 211 additions and 201 deletions

View File

@@ -22,6 +22,11 @@ struct YGFloatOptional {
// To check if float optional is defined, use `isUndefined()`.
float getValue() const;
// returns the wrapped value, or a value x with YGIsUndefined(x) == true
float unwrap() const {
return value_;
}
bool isUndefined() const {
return std::isnan(value_);
}