<div dir="ltr">I would like to call a template function including the expression T::get_na() with a matrix Column as the T. The toy program below illustrates what I am trying to do.<div><br></div><div>Various error messages are generated by the compiler with, I think, the key one being:</div><div><br></div><div><div>column_get_na.cpp:11:2: error: 'get_na' is not a member of 'Rcpp::MatrixColumn<13>'</div></div><div><br></div><div>Is it deliberate that get_na is not a member of Column? If so, what is the appropriate workaround in the context of calling a template function? In not, any plans to implement Column::get_na()?</div><div><br></div><div>Thanks.</div><div><br></div><div>Toy program:</div><div><br></div><div><div>#include <Rcpp.h></div><div>using namespace Rcpp;</div><div>template<typename T></div><div>T set1na_vec(T vec) {</div><div><span class="" style="white-space:pre">  </span>vec[0] = T::get_na();</div><div><span class="" style="white-space:pre">      </span>return vec;</div><div>}</div><div>// [[Rcpp::export]]</div><div>IntegerMatrix set1na_mat(IntegerMatrix mat) {</div><div><span class="" style="white-space:pre">  </span>IntegerMatrix::Column col = mat(_, 0);</div><div><span class="" style="white-space:pre">     </span>set1na_vec(col);</div><div><span class="" style="white-space:pre">   </span>return mat;</div><div>}</div><div>/***R</div><div>mat = matrix(1:10, ncol=2)</div><div>set1na_mat(mat)</div><div>*/</div></div><div><br></div></div>