const T &value() const { return const_cast<Variant *>(this)->get<T>(); }
template<typename T>
- bool check_type() const { return funcs==get_functions<typename std::remove_cv<T>::type>(); }
+ bool has_type() const { return funcs==get_functions<typename std::remove_cv<T>::type>(); }
- bool check_same_type(const Variant &v) const { return (funcs && funcs==v.funcs); }
+ bool has_same_type(const Variant &v) const { return (funcs && funcs==v.funcs); }
+
+ template<typename T>
+ DEPRECATED bool check_type() const { return has_type<T>(); }
+
+ DEPRECATED bool check_same_type(const Variant &v) const { return has_same_type(v); }
bool operator==(const Variant &v) const { return (has_same_type(v) && funcs->compare(storage, v.storage)); }
bool operator!=(const Variant &v) const { return !(operator==(v)); }
void VariantTests::types()
{
Variant var = 42U;
- EXPECT(!var.check_type<int>());
- EXPECT(var.check_type<unsigned>());
- EXPECT(!var.check_type<float>());
- EXPECT(!var.check_type<bool>());
- EXPECT(!var.check_type<string>());
+ EXPECT(!var.has_type<int>());
+ EXPECT(var.has_type<unsigned>());
+ EXPECT(!var.has_type<float>());
+ EXPECT(!var.has_type<bool>());
+ EXPECT(!var.has_type<string>());
}
void VariantTests::mismatch()