summaryrefslogtreecommitdiff
path: root/include/mbgl/style
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-11-30 10:21:28 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-12-06 15:05:45 -0800
commit0adf830b9a008f5c5b5a386a152a7a2dbc0c79c4 (patch)
treec9c587fd6e2fa79f4aad42d5ba652f2324fabfab /include/mbgl/style
parente7c30de021c3a6f50b5ebaed2ebc436af2f3a697 (diff)
downloadqtlocation-mapboxgl-0adf830b9a008f5c5b5a386a152a7a2dbc0c79c4.tar.gz
[core] Inline friend equality operators
Diffstat (limited to 'include/mbgl/style')
-rw-r--r--include/mbgl/style/function.hpp20
-rw-r--r--include/mbgl/style/property_value.hpp18
2 files changed, 15 insertions, 23 deletions
diff --git a/include/mbgl/style/function.hpp b/include/mbgl/style/function.hpp
index 3aefba6600..6103f85e35 100644
--- a/include/mbgl/style/function.hpp
+++ b/include/mbgl/style/function.hpp
@@ -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
diff --git a/include/mbgl/style/property_value.hpp b/include/mbgl/style/property_value.hpp
index 859b683d5e..83c4b4cf1b 100644
--- a/include/mbgl/style/property_value.hpp
+++ b/include/mbgl/style/property_value.hpp
@@ -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