From 1260e1a03fa72ae0b3b3b6fa9323e5084dfde313 Mon Sep 17 00:00:00 2001 From: Geoff Hutchison Date: Mon, 4 Dec 2023 12:39:29 -0500 Subject: [PATCH] Better to use template specialization Signed-off-by: Geoff Hutchison --- avogadro/core/variant-inline.h | 2 ++ avogadro/core/variant.h | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/avogadro/core/variant-inline.h b/avogadro/core/variant-inline.h index 6706e4cf5e..16836f4dcb 100644 --- a/avogadro/core/variant-inline.h +++ b/avogadro/core/variant-inline.h @@ -21,11 +21,13 @@ inline Variant::Variant(T v) : m_type(Null) setValue(v); } +template <> inline Variant::Variant(const char* v) : m_type(String) { m_value.string = new std::string(v); } +template <> inline Variant::Variant(const MatrixXf& v) : m_type(Matrix) { MatrixX* m = new MatrixX(v.rows(), v.cols()); diff --git a/avogadro/core/variant.h b/avogadro/core/variant.h index c2b08bd56c..84eda3186d 100644 --- a/avogadro/core/variant.h +++ b/avogadro/core/variant.h @@ -48,12 +48,6 @@ class AVOGADROCORE_EXPORT Variant template Variant(T value); - /** Creates a std::string variant to store @p value */ - Variant(const char* value); - - /** Creates a MatrixX variant to store @p value */ - Variant(const MatrixXf& value); - /** Creates a new copy of @p variant. */ inline Variant(const Variant& variant);