Remove cast from detail::Values
to std::array<YGValue
Summary: @public When switching to `CompactValue`, casting edges or dimensions to `std::array<YGValue, ...>` will do actual work. In order to avoid that from happening implicitely, we remove the casting operator. Reviewed By: SidharthGuglani Differential Revision: D13464292 fbshipit-source-id: 217065b001a63cfa8adde715063682c583007a4d
This commit is contained in:
committed by
Facebook Github Bot
parent
3df41aefdb
commit
8461aeaef0
@@ -20,7 +20,8 @@ static void indent(string& base, uint32_t level) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool areFourValuesEqual(const std::array<YGValue, YGEdgeCount>& four) {
|
static bool areFourValuesEqual(
|
||||||
|
const facebook::yoga::detail::Values<YGEdgeCount>& four) {
|
||||||
return YGValueEqual(four[0], four[1]) && YGValueEqual(four[0], four[2]) &&
|
return YGValueEqual(four[0], four[1]) && YGValueEqual(four[0], four[2]) &&
|
||||||
YGValueEqual(four[0], four[3]);
|
YGValueEqual(four[0], four[3]);
|
||||||
}
|
}
|
||||||
@@ -81,7 +82,7 @@ appendNumberIfNotZero(string& base, const string& str, const YGValue number) {
|
|||||||
static void appendEdges(
|
static void appendEdges(
|
||||||
string& base,
|
string& base,
|
||||||
const string& key,
|
const string& key,
|
||||||
const std::array<YGValue, YGEdgeCount>& edges) {
|
const facebook::yoga::detail::Values<YGEdgeCount>& edges) {
|
||||||
if (areFourValuesEqual(edges)) {
|
if (areFourValuesEqual(edges)) {
|
||||||
appendNumberIfNotZero(base, key, edges[YGEdgeLeft]);
|
appendNumberIfNotZero(base, key, edges[YGEdgeLeft]);
|
||||||
} else {
|
} else {
|
||||||
@@ -95,7 +96,7 @@ static void appendEdges(
|
|||||||
static void appendEdgeIfNotUndefined(
|
static void appendEdgeIfNotUndefined(
|
||||||
string& base,
|
string& base,
|
||||||
const string& str,
|
const string& str,
|
||||||
const std::array<YGValue, YGEdgeCount>& edges,
|
const facebook::yoga::detail::Values<YGEdgeCount>& edges,
|
||||||
const YGEdge edge) {
|
const YGEdge edge) {
|
||||||
appendNumberIfNotUndefined(
|
appendNumberIfNotUndefined(
|
||||||
base, str, *YGComputedEdgeValue(edges, edge, &YGValueUndefined));
|
base, str, *YGComputedEdgeValue(edges, edge, &YGValueUndefined));
|
||||||
|
@@ -103,12 +103,6 @@ class Values {
|
|||||||
values_.fill(defaultValue);
|
values_.fill(defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
operator const std::array<YGValue, Size>&() const noexcept {
|
|
||||||
return values_;
|
|
||||||
}
|
|
||||||
operator std::array<YGValue, Size>&() noexcept {
|
|
||||||
return values_;
|
|
||||||
}
|
|
||||||
const YGValue& operator[](size_t i) const noexcept {
|
const YGValue& operator[](size_t i) const noexcept {
|
||||||
return values_[i];
|
return values_[i];
|
||||||
}
|
}
|
||||||
@@ -136,10 +130,6 @@ class Values {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Values& operator=(const Values& other) = default;
|
Values& operator=(const Values& other) = default;
|
||||||
Values& operator=(const std::array<YGValue, Size>& other) noexcept {
|
|
||||||
values_ = other;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
@@ -153,6 +143,6 @@ static const float kWebDefaultFlexShrink = 1.0f;
|
|||||||
extern bool YGFloatsEqual(const float a, const float b);
|
extern bool YGFloatsEqual(const float a, const float b);
|
||||||
extern bool YGValueEqual(const YGValue a, const YGValue b);
|
extern bool YGValueEqual(const YGValue a, const YGValue b);
|
||||||
extern const YGValue* YGComputedEdgeValue(
|
extern const YGValue* YGComputedEdgeValue(
|
||||||
const std::array<YGValue, YGEdgeCount>& edges,
|
const facebook::yoga::detail::Values<YGEdgeCount>& edges,
|
||||||
const YGEdge edge,
|
const YGEdge edge,
|
||||||
const YGValue* const defaultValue);
|
const YGValue* const defaultValue);
|
||||||
|
@@ -103,7 +103,7 @@ bool YGFloatIsUndefined(const float value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const YGValue* YGComputedEdgeValue(
|
const YGValue* YGComputedEdgeValue(
|
||||||
const std::array<YGValue, YGEdgeCount>& edges,
|
const facebook::yoga::detail::Values<YGEdgeCount>& edges,
|
||||||
const YGEdge edge,
|
const YGEdge edge,
|
||||||
const YGValue* const defaultValue) {
|
const YGValue* const defaultValue) {
|
||||||
if (edges[edge].unit != YGUnitUndefined) {
|
if (edges[edge].unit != YGUnitUndefined) {
|
||||||
|
Reference in New Issue
Block a user