Skip to content

Commit

Permalink
Better to use template specialization
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Dec 4, 2023
1 parent 27c14a5 commit 1260e1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 2 additions & 0 deletions avogadro/core/variant-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
6 changes: 0 additions & 6 deletions avogadro/core/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ class AVOGADROCORE_EXPORT Variant
template <typename T>
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);

Expand Down

0 comments on commit 1260e1a

Please sign in to comment.