<html><body><div style="color:#000; background-color:#fff; font-family:lucida console, sans-serif;font-size:12pt"><div>&gt;&gt; the seemingly equivalent statement in the body of a class constructor fails</div><div>&gt;&gt; with a compilation error:</div><div>&gt;&gt;&nbsp;</div><div>&gt;&gt; &nbsp; includes = '</div><div>&gt;&gt; &nbsp; class CCC{</div><div>&gt;&gt; &nbsp; public:</div><div>&gt;&gt; &nbsp; &nbsp; CCC(Rcpp::List l){</div><div>&gt;&gt; &nbsp; &nbsp; &nbsp; m = l["m"];</div><div>&gt;&gt; &nbsp; &nbsp; }</div><div>&gt;&gt; &nbsp; [...]</div><div>&gt;&gt; &nbsp; private:</div><div>&gt;&gt; &nbsp; &nbsp; Rcpp::IntegerMatrix m;</div><div>&gt;&gt; &nbsp; }</div><div>&gt;&gt; &nbsp; '</div><div><br></div><div>&gt; Here you are trying to use the assignment operator, we could not manage to</div><div>&gt; remove the ambiguity.&nbsp;</div><div>&gt;&nbsp;</div><div>&gt; In the first example, you use the ctor, and in this case we managed
 the</div><div>&gt; disambiguation.&nbsp;</div><div>&gt;&nbsp;</div><div>&gt; i would advise using this as the ctor of CCC :</div><div>&gt;&nbsp;</div><div>&gt; &nbsp;CCC(Rcpp::List l) : m( l["m"] ) {}</div><div><br></div><div>Thanks, Romain. &nbsp;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? &nbsp;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. &nbsp;Details are in</div><div>the appended.</div><div><br></div><div>-- Mike</div><div><br></div><div><br></div><div>$ R --vanilla &lt; 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>&nbsp; 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>&gt; &nbsp; library(Rcpp)</div><div>&gt; &nbsp; library(inline)</div><div>&gt; &nbsp;&nbsp;</div><div>&gt; &nbsp; includes = '</div><div>+ &nbsp; class CCC{</div><div>+ &nbsp; public:</div><div>+ &nbsp; &nbsp; CCC(Rcpp::List l) { m( l["m"] ) }</div><div>+&nbsp;</div><div>+ &nbsp; &nbsp; Rcpp::IntegerMatrix
 mGet(){</div><div>+ &nbsp; &nbsp; &nbsp; return m;</div><div>+ &nbsp; &nbsp; }</div><div>+ &nbsp; private:</div><div>+ &nbsp; &nbsp; Rcpp::IntegerMatrix m;</div><div>+ &nbsp; };</div><div>+ &nbsp; '</div><div>&gt; &nbsp; ccode = '</div><div>+ &nbsp; &nbsp; &nbsp; Rcpp::List l(l_R);</div><div>+ &nbsp; &nbsp; &nbsp; CCC ccc(l_R);</div><div>+ &nbsp; &nbsp; &nbsp; return Rcpp::wrap(ccc.mGet());</div><div>+ &nbsp; &nbsp; '</div><div>&gt; &nbsp; fn = cxxfunction(</div><div>+ &nbsp; &nbsp; sig &nbsp; &nbsp; &nbsp;= signature(l_R = "list"),</div><div>+ &nbsp; &nbsp; body &nbsp; &nbsp; = ccode,</div><div>+ &nbsp; &nbsp; includes = includes,</div><div>+ &nbsp; &nbsp; plugin &nbsp; = "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&lt;13&gt;})
 (Rcpp::Vector&lt;19&gt;::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&lt;RTYPE&gt;::Proxy Rcpp::Matrix&lt;RTYPE&gt;::operator()(const size_t&amp;,</div><div>const size_t&amp;) [with int RTYPE = 13, Rcpp::Matrix&lt;RTYPE&gt;::Proxy = int&amp;, 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&lt;RTYPE&gt;::Proxy Rcpp::Matrix&lt;RTYPE&gt;::operator()(const size_t&amp;,</div><div>const size_t&amp;) const [with int RTYPE = 13, Rcpp::Matrix&lt;RTYPE&gt;::Proxy = int&amp;,</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&lt;RTYPE&gt;::Row Rcpp::Matrix&lt;RTYPE&gt;::operator()(int,</div><div>Rcpp::internal::NamedPlaceHolder) [with int RTYPE = 13,</div><div>Rcpp::Matrix&lt;RTYPE&gt;::Row = Rcpp::MatrixRow&lt;13&gt;]</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&lt;RTYPE&gt;::Column</div><div>Rcpp::Matrix&lt;RTYPE&gt;::operator()(Rcpp::internal::NamedPlaceHolder, int) [with</div><div>int RTYPE = 13, Rcpp::Matrix&lt;RTYPE&gt;::Column = Rcpp::MatrixColumn&lt;13&gt;]</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&lt;RTYPE&gt;::Sub Rcpp::Matrix&lt;RTYPE&gt;::operator()(const Rcpp::Range&amp;,</div><div>const Rcpp::Range&amp;) [with int RTYPE = 13, Rcpp::Matrix&lt;RTYPE&gt;::Sub =</div><div>Rcpp::SubMatrix&lt;13&gt;]</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&lt;RTYPE&gt;::Sub</div><div>Rcpp::Matrix&lt;RTYPE&gt;::operator()(Rcpp::internal::NamedPlaceHolder, const</div><div>Rcpp::Range&amp;) [with int RTYPE = 13, Rcpp::Matrix&lt;RTYPE&gt;::Sub =</div><div>Rcpp::SubMatrix&lt;13&gt;]</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&lt;RTYPE&gt;::Sub Rcpp::Matrix&lt;RTYPE&gt;::operator()(const Rcpp::Range&amp;,</div><div>Rcpp::internal::NamedPlaceHolder) [with int RTYPE = 13,</div><div>Rcpp::Matrix&lt;RTYPE&gt;::Sub = Rcpp::SubMatrix&lt;13&gt;]</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>&nbsp; 1:&nbsp;</div><div>&nbsp; 2: // includes from the plugin</div><div>&nbsp; 3:&nbsp;</div><div>&nbsp; 4: #include &lt;Rcpp.h&gt;</div><div>&nbsp; 5:&nbsp;</div><div>&nbsp; 6:&nbsp;</div><div>&nbsp; 7: #ifndef
 BEGIN_RCPP</div><div>&nbsp; 8: #define BEGIN_RCPP</div><div>&nbsp; 9: #endif</div><div>&nbsp;10:&nbsp;</div><div>&nbsp;11: #ifndef END_RCPP</div><div>&nbsp;12: #define END_RCPP</div><div>&nbsp;13: #endif</div><div>&nbsp;14:&nbsp;</div><div>&nbsp;15: using namespace Rcpp;</div><div>&nbsp;16:&nbsp;</div><div>&nbsp;17:&nbsp;</div><div>&nbsp;18: // user includes</div><div>&nbsp;19:&nbsp;</div><div>&nbsp;20: &nbsp; class CCC{</div><div>&nbsp;21: &nbsp; public:</div><div>&nbsp;22: &nbsp; &nbsp; CCC(Rcpp::List l) { m( l["m"] ) }</div><div>&nbsp;23:&nbsp;</div><div>&nbsp;24: &nbsp; &nbsp; Rcpp::IntegerMatrix mGet(){</div><div>&nbsp;25: &nbsp; &nbsp; &nbsp; return m;</div><div>&nbsp;26: &nbsp; &nbsp; }</div><div>&nbsp;27: &nbsp; private:</div><div>&nbsp;28: &nbsp; &nbsp; Rcpp::IntegerMatrix m;</div><div>&nbsp;29: &nbsp; };</div><div>&nbsp;30: &nbsp;&nbsp;</div><div>&nbsp;31:&nbsp;</div><div>&nbsp;32: // declarations</div><div>&nbsp;33: extern "C"
 {</div><div>&nbsp;34: SEXP file1781a7ea( SEXP l_R) ;</div><div>&nbsp;35: }</div><div>&nbsp;36:&nbsp;</div><div>&nbsp;37: // definition</div><div>&nbsp;38:&nbsp;</div><div>&nbsp;39: SEXP file1781a7ea( SEXP l_R ){</div><div>&nbsp;40: BEGIN_RCPP</div><div>&nbsp;41:&nbsp;</div><div>&nbsp;42: &nbsp; &nbsp; &nbsp; Rcpp::List l(l_R);</div><div>&nbsp;43: &nbsp; &nbsp; &nbsp; CCC ccc(l_R);</div><div>&nbsp;44: &nbsp; &nbsp; &nbsp; return Rcpp::wrap(ccc.mGet());</div><div>&nbsp;45: &nbsp; &nbsp;&nbsp;</div><div>&nbsp;46: END_RCPP</div><div>&nbsp;47: }</div><div>&nbsp;48:&nbsp;</div><div>&nbsp;49:&nbsp;</div><div>Error in compileCode(f, code, language = language, verbose = verbose) :&nbsp;</div><div>&nbsp; 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&lt;13&gt;})
 (Rcpp::Vector&lt;19&gt;::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&lt;RTYPE&gt;::Proxy Rcpp::Matrix&lt;RTYPE&gt;::operator()(const size_t&amp;,</div><div>const size_t&amp;) [with int RTYPE = 13, Rcpp::Matrix&lt;RTYPE&gt;::Proxy = int&amp;, 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&lt;RTYPE&gt;::Proxy Rcpp::Matrix&lt;RTYPE&gt;::operator()(const size_t&amp;,</div><div>const size_t&amp;) const [with int RTYPE = 13, Rcpp::Matrix&lt;RTYPE&gt;::Proxy = int&amp;,</div><div>size_t = long unsigned
 int]</div><div>/usr/lib64/R/library/Rcpp/include/Rcpp/vector/Matrix.h</div><div>Calls: cxxfunction -&gt; compileCode</div><div>In addition: Warning message:</div><div>running command '/usr/lib64/R/bin/R CMD SHLIB file1781a7ea.cpp 2&gt;</div><div>file1781a7ea.cpp.err.txt' had status 1&nbsp;</div><div>Execution halted</div><div style="font-size: 12pt; "><br></div></div></body></html>