From db3397e3b7b9839714ce28d9df2a8f226f2e58b2 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 23 Dec 2022 14:27:44 +0200 Subject: [PATCH] Rename Variant's check_type function to has_type --- source/core/variant.h | 9 +++++++-- tests/variant.cpp | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/source/core/variant.h b/source/core/variant.h index 04c372b..934a9e5 100644 --- a/source/core/variant.h +++ b/source/core/variant.h @@ -61,9 +61,14 @@ public: const T &value() const { return const_cast(this)->get(); } template - bool check_type() const { return funcs==get_functions::type>(); } + bool has_type() const { return funcs==get_functions::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 + DEPRECATED bool check_type() const { return has_type(); } + + 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)); } diff --git a/tests/variant.cpp b/tests/variant.cpp index 99cacdf..8ec8972 100644 --- a/tests/variant.cpp +++ b/tests/variant.cpp @@ -99,11 +99,11 @@ void VariantTests::destruction() void VariantTests::types() { Variant var = 42U; - EXPECT(!var.check_type()); - EXPECT(var.check_type()); - EXPECT(!var.check_type()); - EXPECT(!var.check_type()); - EXPECT(!var.check_type()); + EXPECT(!var.has_type()); + EXPECT(var.has_type()); + EXPECT(!var.has_type()); + EXPECT(!var.has_type()); + EXPECT(!var.has_type()); } void VariantTests::mismatch() -- 2.43.0