constructor with optional memory zeroing

This commit is contained in:
conrad
2023-02-14 01:29:26 +10:00
parent ff3fe560a1
commit fd437d41be
2 changed files with 22 additions and 0 deletions
@@ -53,6 +53,9 @@ class podarray
arma_inline explicit podarray(const uword new_N);
template<bool do_zeros>
inline explicit podarray(const uword new_N, const arma_initmode_indicator<do_zeros>&);
arma_inline explicit podarray(const eT* X, const uword new_N);
// template<typename T1>
+19
View File
@@ -94,6 +94,25 @@ podarray<eT>::podarray(const uword new_n_elem)
template<typename eT>
template<bool do_zeros>
inline
podarray<eT>::podarray(const uword new_n_elem, const arma_initmode_indicator<do_zeros>&)
: n_elem(new_n_elem)
{
arma_extra_debug_sigprint_this(this);
init_cold(new_n_elem);
if(do_zeros)
{
arma_extra_debug_print("podarray::constructor: zeroing memory");
arrayops::fill_zeros(memptr(), n_elem);
}
}
template<typename eT>
arma_inline
podarray<eT>::podarray(const eT* X, const uword new_n_elem)