From 7c681ce59f1e905838bac68b525f99a59145d7cd Mon Sep 17 00:00:00 2001 From: Yannick Stade <100073938+ystade@users.noreply.github.com> Date: Wed, 5 Mar 2025 07:51:17 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Test=20trait=20setup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/mqt-core/na/operations/Op.hpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/include/mqt-core/na/operations/Op.hpp b/include/mqt-core/na/operations/Op.hpp index ec1bab25a..a2cc96743 100644 --- a/include/mqt-core/na/operations/Op.hpp +++ b/include/mqt-core/na/operations/Op.hpp @@ -11,9 +11,11 @@ #include #include +#include namespace na { -class Op { +template class... Traits> +class Op : public Traits... { public: Op() = default; virtual ~Op() = default; @@ -21,8 +23,16 @@ class Op { friend auto operator<<(std::ostream& os, const Op& obj) -> std::ostream& { return os << obj.toString(); // Using toString() method } - template [[nodiscard]] auto is() const -> bool { - return dynamic_cast(this) != nullptr; + /// Checks whether the object has the template parameter as a trait. + template