Revert "use std::invalid_argument for bad arguments"
This reverts commit d931550db2
This commit is contained in:
@@ -4277,7 +4277,7 @@ Mat<eT>::shed_rows(const Base<uword, T1>& indices)
|
||||
const unwrap_check_mixed<T1> U(indices.get_ref(), *this);
|
||||
const Mat<uword>& 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<eT>::shed_cols(const Base<uword, T1>& indices)
|
||||
const unwrap_check_mixed<T1> U(indices.get_ref(), *this);
|
||||
const Mat<uword>& 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<eT>::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<eT>::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<eT>::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)
|
||||
{
|
||||
|
||||
@@ -165,25 +165,6 @@ arma_stop_bounds_error(const T1& x)
|
||||
|
||||
|
||||
|
||||
//! print a message to get_cerr_stream() and throw invalid_argument exception
|
||||
template<typename T1>
|
||||
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<typename T1>
|
||||
arma_cold
|
||||
@@ -441,16 +422,6 @@ arma_check_bounds(const bool state, const T1& x)
|
||||
}
|
||||
|
||||
|
||||
template<typename T1>
|
||||
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<typename T1>
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user