From dce4fa2543ab9e30d918dfd716b60a30a3158f67 Mon Sep 17 00:00:00 2001 From: conradsnicta <1735473-conradsnicta@users.noreply.gitlab.com> Date: Sun, 21 Feb 2021 06:31:00 +0000 Subject: [PATCH] Revert "use std::invalid_argument for bad arguments" This reverts commit d931550db20d44e0811df1e74a4e8fc5a39219b3 --- include/armadillo_bits/Mat_meat.hpp | 12 +++++------ include/armadillo_bits/debug.hpp | 31 ----------------------------- 2 files changed, 6 insertions(+), 37 deletions(-) diff --git a/include/armadillo_bits/Mat_meat.hpp b/include/armadillo_bits/Mat_meat.hpp index 938dee72..1ebc6b5a 100644 --- a/include/armadillo_bits/Mat_meat.hpp +++ b/include/armadillo_bits/Mat_meat.hpp @@ -4277,7 +4277,7 @@ Mat::shed_rows(const Base& indices) const unwrap_check_mixed U(indices.get_ref(), *this); const Mat& tmp1 = U.M; - arma_debug_check_arg( ((tmp1.is_vec() == false) && (tmp1.is_empty() == false)), "Mat::shed_rows(): list of indices must be a vector" ); + arma_debug_check( ((tmp1.is_vec() == false) && (tmp1.is_empty() == false)), "Mat::shed_rows(): list of indices must be a vector" ); if(tmp1.is_empty()) { return; } @@ -4347,7 +4347,7 @@ Mat::shed_cols(const Base& indices) const unwrap_check_mixed U(indices.get_ref(), *this); const Mat& tmp1 = U.M; - arma_debug_check_arg( ((tmp1.is_vec() == false) && (tmp1.is_empty() == false)), "Mat::shed_cols(): list of indices must be a vector" ); + arma_debug_check( ((tmp1.is_vec() == false) && (tmp1.is_empty() == false)), "Mat::shed_cols(): list of indices must be a vector" ); if(tmp1.is_empty()) { return; } @@ -6149,7 +6149,7 @@ Mat::is_sorted(const char* direction, const uword dim) const // "strictascend" // "strictdescend" - arma_debug_check_arg( ((sig1 != 'a') && (sig1 != 'd') && (sig1 != 's')), "Mat::is_sorted(): unknown sort direction" ); + arma_debug_check( ((sig1 != 'a') && (sig1 != 'd') && (sig1 != 's')), "Mat::is_sorted(): unknown sort direction" ); // "strictascend" // "strictdescend" @@ -6157,9 +6157,9 @@ Mat::is_sorted(const char* direction, const uword dim) const const char sig2 = (sig1 == 's') ? direction[6] : char(0); - if(sig1 == 's') { arma_debug_check_arg( ((sig2 != 'a') && (sig2 != 'd')), "Mat::is_sorted(): unknown sort direction" ); } + if(sig1 == 's') { arma_debug_check( ((sig2 != 'a') && (sig2 != 'd')), "Mat::is_sorted(): unknown sort direction" ); } - arma_debug_check_arg( (dim > 1), "Mat::is_sorted(): parameter 'dim' must be 0 or 1" ); + arma_debug_check( (dim > 1), "Mat::is_sorted(): parameter 'dim' must be 0 or 1" ); if(sig1 == 'a') { @@ -6603,7 +6603,7 @@ Mat::reshape(const uword in_rows, const uword in_cols, const uword dim) // arma_debug_warn("this form of reshape() is deprecated and will be removed"); - arma_debug_check_arg( (dim > 1), "reshape(): parameter 'dim' must be 0 or 1" ); + arma_debug_check( (dim > 1), "reshape(): parameter 'dim' must be 0 or 1" ); if(dim == 0) { diff --git a/include/armadillo_bits/debug.hpp b/include/armadillo_bits/debug.hpp index c92e8ca3..54f91378 100644 --- a/include/armadillo_bits/debug.hpp +++ b/include/armadillo_bits/debug.hpp @@ -165,25 +165,6 @@ arma_stop_bounds_error(const T1& x) -//! print a message to get_cerr_stream() and throw invalid_argument exception -template -arma_cold -arma_noinline -static -void -arma_stop_arg_error(const T1& x) - { - #if defined(ARMA_PRINT_ERRORS) - { - get_cerr_stream() << "\nerror: " << x << std::endl; - } - #endif - - throw std::invalid_argument( std::string(x) ); - } - - - //! print a message to get_cerr_stream() and throw bad_alloc exception template arma_cold @@ -441,16 +422,6 @@ arma_check_bounds(const bool state, const T1& x) } -template -arma_hot -inline -void -arma_check_arg(const bool state, const T1& x) - { - if(state) { arma_stop_arg_error(arma_str::str_wrapper(x)); } - } - - template arma_hot inline @@ -1322,7 +1293,6 @@ arma_assert_atlas_size(const T1& A, const T2& B) #define arma_debug_warn true ? (void)0 : arma_warn #define arma_debug_check true ? (void)0 : arma_check #define arma_debug_check_bounds true ? (void)0 : arma_check_bounds - #define arma_debug_check_arg true ? (void)0 : arma_check_arg #define arma_debug_set_error true ? (void)0 : arma_set_error #define arma_debug_assert_same_size true ? (void)0 : arma_assert_same_size #define arma_debug_assert_mul_size true ? (void)0 : arma_assert_mul_size @@ -1337,7 +1307,6 @@ arma_assert_atlas_size(const T1& A, const T2& B) #define arma_debug_warn arma_warn #define arma_debug_check arma_check #define arma_debug_check_bounds arma_check_bounds - #define arma_debug_check_arg arma_check_arg #define arma_debug_set_error arma_set_error #define arma_debug_assert_same_size arma_assert_same_size #define arma_debug_assert_mul_size arma_assert_mul_size