<html><body><div style="color:#000; background-color:#fff; font-family:lucida console, sans-serif;font-size:12pt"><div>>> the seemingly equivalent statement in the body of a class constructor fails</div><div>>> with a compilation error:</div><div>>> </div><div>>> includes = '</div><div>>> class CCC{</div><div>>> public:</div><div>>> CCC(Rcpp::List l){</div><div>>> m = l["m"];</div><div>>> }</div><div>>> [...]</div><div>>> private:</div><div>>> Rcpp::IntegerMatrix m;</div><div>>> }</div><div>>> '</div><div><br></div><div>> Here you are trying to use the assignment operator, we could not manage to</div><div>> remove the ambiguity. </div><div>> </div><div>> In the first example, you use the ctor, and in this case we managed
the</div><div>> disambiguation. </div><div>> </div><div>> i would advise using this as the ctor of CCC :</div><div>> </div><div>> CCC(Rcpp::List l) : m( l["m"] ) {}</div><div><br></div><div>Thanks, Romain. Pardon my ignorance, but did you mean that I should use that</div><div>declaration literally, or was it merely intended to suggest the approach? I</div><div>don't have much experience with C++.</div><div><br></div><div>I tried using it literally and still got a compilation error. Details are in</div><div>the appended.</div><div><br></div><div>-- Mike</div><div><br></div><div><br></div><div>$ R --vanilla < junk.R</div><div><br></div><div>R version 2.13.1 (2011-07-08)</div><div>Copyright (C) 2011 The R Foundation for Statistical Computing</div><div>ISBN 3-900051-07-0</div><div>Platform: x86_64-redhat-linux-gnu (64-bit)</div><div><br></div><div>R is free software and comes with ABSOLUTELY NO
WARRANTY.</div><div>You are welcome to redistribute it under certain conditions.</div><div>Type 'license()' or 'licence()' for distribution details.</div><div><br></div><div> Natural language support but running in an English locale</div><div><br></div><div>R is a collaborative project with many contributors.</div><div>Type 'contributors()' for more information and</div><div>'citation()' on how to cite R or R packages in publications.</div><div><br></div><div>Type 'demo()' for some demos, 'help()' for on-line help, or</div><div>'help.start()' for an HTML browser interface to help.</div><div>Type 'q()' to quit R.</div><div><br></div><div>> library(Rcpp)</div><div>> library(inline)</div><div>> </div><div>> includes = '</div><div>+ class CCC{</div><div>+ public:</div><div>+ CCC(Rcpp::List l) { m( l["m"] ) }</div><div>+ </div><div>+ Rcpp::IntegerMatrix
mGet(){</div><div>+ return m;</div><div>+ }</div><div>+ private:</div><div>+ Rcpp::IntegerMatrix m;</div><div>+ };</div><div>+ '</div><div>> ccode = '</div><div>+ Rcpp::List l(l_R);</div><div>+ CCC ccc(l_R);</div><div>+ return Rcpp::wrap(ccc.mGet());</div><div>+ '</div><div>> fn = cxxfunction(</div><div>+ sig = signature(l_R = "list"),</div><div>+ body = ccode,</div><div>+ includes = includes,</div><div>+ plugin = "Rcpp")</div><div>file1781a7ea.cpp: In constructor ‘CCC::CCC(Rcpp::List)’:</div><div>file1781a7ea.cpp:22:35: error: no match for call to ‘(Rcpp::IntegerMatrix {aka</div><div>Rcpp::Matrix<13>})
(Rcpp::Vector<19>::NameProxy)’</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:26:7: note: candidates</div><div>are:</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:126:18: note:</div><div>Rcpp::Matrix<RTYPE>::Proxy Rcpp::Matrix<RTYPE>::operator()(const size_t&,</div><div>const size_t&) [with int RTYPE = 13, Rcpp::Matrix<RTYPE>::Proxy = int&, size_t</div><div>= long unsigned int]</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:126:18: note:</div><div>candidate expects 2 arguments, 1 provided</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:132:18: note:</div><div>Rcpp::Matrix<RTYPE>::Proxy Rcpp::Matrix<RTYPE>::operator()(const size_t&,</div><div>const size_t&) const [with int RTYPE = 13, Rcpp::Matrix<RTYPE>::Proxy = int&,</div><div>size_t = long unsigned
int]</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:132:18: note:</div><div>candidate expects 2 arguments, 1 provided</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:142:16: note:</div><div>Rcpp::Matrix<RTYPE>::Row Rcpp::Matrix<RTYPE>::operator()(int,</div><div>Rcpp::internal::NamedPlaceHolder) [with int RTYPE = 13,</div><div>Rcpp::Matrix<RTYPE>::Row = Rcpp::MatrixRow<13>]</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:142:16: note:</div><div>candidate expects 2 arguments, 1 provided</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:146:19: note:</div><div>Rcpp::Matrix<RTYPE>::Column</div><div>Rcpp::Matrix<RTYPE>::operator()(Rcpp::internal::NamedPlaceHolder, int) [with</div><div>int RTYPE = 13, Rcpp::Matrix<RTYPE>::Column = Rcpp::MatrixColumn<13>]</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:146:19:
note:</div><div>candidate expects 2 arguments, 1 provided</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:150:16: note:</div><div>Rcpp::Matrix<RTYPE>::Sub Rcpp::Matrix<RTYPE>::operator()(const Rcpp::Range&,</div><div>const Rcpp::Range&) [with int RTYPE = 13, Rcpp::Matrix<RTYPE>::Sub =</div><div>Rcpp::SubMatrix<13>]</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:150:16: note:</div><div>candidate expects 2 arguments, 1 provided</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:154:16: note:</div><div>Rcpp::Matrix<RTYPE>::Sub</div><div>Rcpp::Matrix<RTYPE>::operator()(Rcpp::internal::NamedPlaceHolder, const</div><div>Rcpp::Range&) [with int RTYPE = 13, Rcpp::Matrix<RTYPE>::Sub =</div><div>Rcpp::SubMatrix<13>]</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:154:16: note:</div><div>candidate expects 2 arguments, 1
provided</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:158:16: note:</div><div>Rcpp::Matrix<RTYPE>::Sub Rcpp::Matrix<RTYPE>::operator()(const Rcpp::Range&,</div><div>Rcpp::internal::NamedPlaceHolder) [with int RTYPE = 13,</div><div>Rcpp::Matrix<RTYPE>::Sub = Rcpp::SubMatrix<13>]</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:158:16: note:</div><div>candidate expects 2 arguments, 1 provided</div><div>file1781a7ea.cpp:22:37: error: expected ‘;’ before ‘}’ token</div><div>make: *** [file1781a7ea.o] Error 1</div><div><br></div><div>ERROR(s) during compilation: source code errors or compiler configuration</div><div>errors!</div><div><br></div><div>Program source:</div><div> 1: </div><div> 2: // includes from the plugin</div><div> 3: </div><div> 4: #include <Rcpp.h></div><div> 5: </div><div> 6: </div><div> 7: #ifndef
BEGIN_RCPP</div><div> 8: #define BEGIN_RCPP</div><div> 9: #endif</div><div> 10: </div><div> 11: #ifndef END_RCPP</div><div> 12: #define END_RCPP</div><div> 13: #endif</div><div> 14: </div><div> 15: using namespace Rcpp;</div><div> 16: </div><div> 17: </div><div> 18: // user includes</div><div> 19: </div><div> 20: class CCC{</div><div> 21: public:</div><div> 22: CCC(Rcpp::List l) { m( l["m"] ) }</div><div> 23: </div><div> 24: Rcpp::IntegerMatrix mGet(){</div><div> 25: return m;</div><div> 26: }</div><div> 27: private:</div><div> 28: Rcpp::IntegerMatrix m;</div><div> 29: };</div><div> 30: </div><div> 31: </div><div> 32: // declarations</div><div> 33: extern "C"
{</div><div> 34: SEXP file1781a7ea( SEXP l_R) ;</div><div> 35: }</div><div> 36: </div><div> 37: // definition</div><div> 38: </div><div> 39: SEXP file1781a7ea( SEXP l_R ){</div><div> 40: BEGIN_RCPP</div><div> 41: </div><div> 42: Rcpp::List l(l_R);</div><div> 43: CCC ccc(l_R);</div><div> 44: return Rcpp::wrap(ccc.mGet());</div><div> 45: </div><div> 46: END_RCPP</div><div> 47: }</div><div> 48: </div><div> 49: </div><div>Error in compileCode(f, code, language = language, verbose = verbose) : </div><div> Compilation ERROR, function(s)/method(s) not created! file1781a7ea.cpp: In</div><div>constructor ‘CCC::CCC(Rcpp::List)’:</div><div>file1781a7ea.cpp:22:35: error: no match for call to ‘(Rcpp::IntegerMatrix {aka</div><div>Rcpp::Matrix<13>})
(Rcpp::Vector<19>::NameProxy)’</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:26:7: note: candidates</div><div>are:</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:126:18: note:</div><div>Rcpp::Matrix<RTYPE>::Proxy Rcpp::Matrix<RTYPE>::operator()(const size_t&,</div><div>const size_t&) [with int RTYPE = 13, Rcpp::Matrix<RTYPE>::Proxy = int&, size_t</div><div>= long unsigned int]</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:126:18: note:</div><div>candidate expects 2 arguments, 1 provided</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h:132:18: note:</div><div>Rcpp::Matrix<RTYPE>::Proxy Rcpp::Matrix<RTYPE>::operator()(const size_t&,</div><div>const size_t&) const [with int RTYPE = 13, Rcpp::Matrix<RTYPE>::Proxy = int&,</div><div>size_t = long unsigned
int]</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h</div><div>Calls: cxxfunction -> compileCode</div><div>In addition: Warning message:</div><div>running command '/usr/lib64/R/bin/R CMD SHLIB file1781a7ea.cpp 2></div><div>file1781a7ea.cpp.err.txt' had status 1 </div><div>Execution halted</div><div style="font-size: 12pt; "><br></div></div></body></html>