[core] Inline friend equality operators
This commit is contained in:
@@ -20,22 +20,18 @@ public:
|
||||
float getBase() const { return base; }
|
||||
const std::vector<std::pair<float, T>>& getStops() const { return stops; }
|
||||
|
||||
friend bool operator==(const Function& lhs, const Function& rhs) {
|
||||
return lhs.base == rhs.base && lhs.stops == rhs.stops;
|
||||
}
|
||||
|
||||
friend bool operator!=(const Function& lhs, const Function& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
private:
|
||||
float base = 1;
|
||||
std::vector<std::pair<float, T>> stops;
|
||||
|
||||
template <class S> friend bool operator==(const Function<S>&, const Function<S>&);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
bool operator==(const Function<T>& lhs, const Function<T>& rhs) {
|
||||
return lhs.base == rhs.base && lhs.stops == rhs.stops;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool operator!=(const Function<T>& lhs, const Function<T>& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -17,7 +17,13 @@ private:
|
||||
using Value = variant<Undefined, T, Function<T>>;
|
||||
Value value;
|
||||
|
||||
template <class S> friend bool operator==(const PropertyValue<S>&, const PropertyValue<S>&);
|
||||
friend bool operator==(const PropertyValue& lhs, const PropertyValue& rhs) {
|
||||
return lhs.value == rhs.value;
|
||||
}
|
||||
|
||||
friend bool operator!=(const PropertyValue& lhs, const PropertyValue& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
public:
|
||||
PropertyValue() : value() {}
|
||||
@@ -39,15 +45,5 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
bool operator==(const PropertyValue<T>& lhs, const PropertyValue<T>& rhs) {
|
||||
return lhs.value == rhs.value;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool operator!=(const PropertyValue<T>& lhs, const PropertyValue<T>& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
Reference in New Issue
Block a user