From c856ef724896f37e8480e2ae8a7aadbe63ba6919 Mon Sep 17 00:00:00 2001 From: conrad Date: Fri, 16 Jul 2021 10:53:05 +1000 Subject: [PATCH] don't use constexpr functions here; C++17 inline variables would be required --- include/armadillo_bits/Proxy.hpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/include/armadillo_bits/Proxy.hpp b/include/armadillo_bits/Proxy.hpp index b22e4963..d412c774 100644 --- a/include/armadillo_bits/Proxy.hpp +++ b/include/armadillo_bits/Proxy.hpp @@ -89,9 +89,18 @@ struct Proxy_fixed arma_extra_debug_sigprint(); } - static constexpr uword get_n_rows() { return T1::n_rows; } - static constexpr uword get_n_cols() { return T1::n_cols; } - static constexpr uword get_n_elem() { return T1::n_elem; } + //// this may require T1::n_elem etc to be declared as static constexpr inline variables (C++17) + //// see also the notes in Mat::fixed + //// https://en.cppreference.com/w/cpp/language/static + //// https://en.cppreference.com/w/cpp/language/inline + // + // static constexpr uword get_n_rows() { return T1::n_rows; } + // static constexpr uword get_n_cols() { return T1::n_cols; } + // static constexpr uword get_n_elem() { return T1::n_elem; } + + arma_inline uword get_n_rows() const { return is_row ? 1 : T1::n_rows; } + arma_inline uword get_n_cols() const { return is_col ? 1 : T1::n_cols; } + arma_inline uword get_n_elem() const { return T1::n_elem; } arma_inline elem_type operator[] (const uword i) const { return Q[i]; } arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }