Added operators == and != for two JsonVariants (issue #436)

This commit is contained in:
Benoit Blanchon
2017-02-11 15:06:17 +01:00
parent 7bcdf3e722
commit 31827d03f9
9 changed files with 249 additions and 59 deletions

View File

@@ -63,6 +63,11 @@ class JsonVariantBase : public Internals::JsonPrintable<TImpl> {
return impl()->template as<T>();
}
template <typename T>
FORCE_INLINE bool is() const {
return impl()->template is<T>();
}
// Mimics an array or an object.
// Returns the size of the array or object if the variant has that type.
// Returns 0 if the variant is neither an array nor an object
@@ -126,4 +131,9 @@ class JsonVariantBase : public Internals::JsonPrintable<TImpl> {
return static_cast<const TImpl *>(this);
}
};
namespace TypeTraits {
template <typename T>
struct IsVariant : IsBaseOf<JsonVariantBase<T>, T> {};
}
}