From df13cac1b04c81c45cb07c009d7cd3e8e6a82285 Mon Sep 17 00:00:00 2001 From: Thibault Hallouin <thibault.hallouin@inrae.fr> Date: Tue, 28 Jun 2022 15:59:38 +0200 Subject: [PATCH] bring back xexpression for templated class With xexpression, the compiler will complain if the type used does not implement the xexpression interface. Before the move to OO approach, it was present, but got lost along the way. --- src/determinist/evaluator.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/determinist/evaluator.hpp b/src/determinist/evaluator.hpp index d31abdd..800c128 100644 --- a/src/determinist/evaluator.hpp +++ b/src/determinist/evaluator.hpp @@ -1,6 +1,7 @@ #ifndef EVALHYD_DETERMINIST_EVALUATOR_HPP #define EVALHYD_DETERMINIST_EVALUATOR_HPP +#include <xtensor/xexpression.hpp> #include <xtensor/xtensor.hpp> namespace evalhyd @@ -19,7 +20,11 @@ namespace evalhyd public: // constructor method - Evaluator(const A& obs, const A& prd) : q_obs{obs}, q_prd{prd} { + Evaluator(const xt::xexpression<A>& obs, + const xt::xexpression<A>& prd) : + q_obs{obs.derived_cast()}, + q_prd{prd.derived_cast()} + { // check that data dimensions are compatible if (q_prd.dimension() != q_obs.dimension()) { -- GitLab