diff options
Diffstat (limited to 'include/mbgl/style/property_value.hpp')
-rw-r--r-- | include/mbgl/style/property_value.hpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/mbgl/style/property_value.hpp b/include/mbgl/style/property_value.hpp index d8f83a0fb3..d7e160fdca 100644 --- a/include/mbgl/style/property_value.hpp +++ b/include/mbgl/style/property_value.hpp @@ -8,12 +8,17 @@ namespace style { class Undefined {}; +inline bool operator==(const Undefined&, const Undefined&) { return true; } +inline bool operator!=(const Undefined&, const Undefined&) { return false; } + template <class T> class PropertyValue { private: using Value = variant<Undefined, T, Function<T>>; Value value; + template <class S> friend bool operator==(const PropertyValue<S>&, const PropertyValue<S>&); + public: PropertyValue() : value() {} PropertyValue( T constant) : value(constant) {} @@ -34,5 +39,15 @@ 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 |