<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear Rcpp::Devels and Rcpp::Users,<div><br></div><div>I am temporarily experiencing with a delayed assignment of auxiliary memory in RcppArmadillo:</div><div><br></div><div>Declare a matrix from which you know you may need it</div><div><br></div><div>arma::mat maybeM;</div><div><br></div><div>(In C++ a declaration makes only known the type and name but allocates no storage yet).</div><div><br></div><div>Now you check a condition and if it is true, you will need the matrix, so you initialize it </div><div><br></div><div>if(mycondition) {</div><div><span class="Apple-tab-span" style="white-space: pre; ">   </span>maybeM = arma::<span style="background-color: rgb(255, 255, 255); font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif; text-align: left; ">mat(aux_mem*, n_rows, n_cols, copy_aux_mem = false, strict = true)</span><span style="background-color: rgb(255, 255, 255); font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif; text-align: left; "> </span></div><div>}</div><div><br></div><div>(for simplicity I only printed here the default constructor for using auxiliary memory; please assume that all values are presented)</div><div><br></div><div>The resulting matrix maybeM does not use the auxiliary memory. I tried to access in some way the 'mem' member in the Armadillo class, but this member is constant and can not be</div><div>manipulated after first construction. A primer declaration and later initialization is a very common pattern in C++, but it seems not be possible in case of reusing memory. </div><div><br></div><div>I conclude, that a delayed assignment of auxiliary memory is not possible.</div><div><br></div><div><br></div><div>Best</div><div><br></div><div>Simon</div></body></html>