diff --git a/core/include/engine/common/Hamiltonian.hpp b/core/include/engine/common/Hamiltonian.hpp index fe648c826..452efc8ed 100644 --- a/core/include/engine/common/Hamiltonian.hpp +++ b/core/include/engine/common/Hamiltonian.hpp @@ -626,7 +626,8 @@ class HamiltonianVariant : public TypeTraits template [[nodiscard]] bool hasInteraction() { - return std::visit( []( auto & h ) { return h.template hasInteraction(); }, hamiltonian ); + return std::visit( + []( auto & h ) { return std::decay_t::template hasInteraction(); }, hamiltonian ); }; template @@ -641,7 +642,7 @@ class HamiltonianVariant : public TypeTraits return std::visit( []( const auto & h ) -> const typename T::Data * { - if constexpr( h.template hasInteraction() ) + if constexpr( std::decay_t::template hasInteraction() ) return &h.template data(); else return nullptr; @@ -655,7 +656,7 @@ class HamiltonianVariant : public TypeTraits return std::visit( []( const auto & h ) -> const typename T::Cache * { - if constexpr( h.template hasInteraction() ) + if constexpr( std::decay_t::template hasInteraction() ) return &h.template cache(); else return nullptr; @@ -670,7 +671,7 @@ class HamiltonianVariant : public TypeTraits [this, data = typename T::Data( std::forward( args )... )]( auto & h ) mutable -> std::optional { - if constexpr( h.template hasInteraction() ) + if constexpr( std::decay_t::template hasInteraction() ) return h.template set_data( std::move( data ) ); else return fmt::format(