<html><body><div style="color:#000; background-color:#fff; font-family:lucida console, sans-serif;font-size:12pt"><div><span>Thanks, Darren. &nbsp;That worked well.</span></div><div><span><br></span></div><div><span>-- Mike</span></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-size: 12pt; font-family: 'lucida console', sans-serif; "><div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "><font size="2" face="Arial"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Darren Cook &lt;darren@dcook.org&gt;<br><b><span style="font-weight: bold;">To:</span></b> rcpp-devel@r-forge.wu-wien.ac.at<br><b><span style="font-weight: bold;">Sent:</span></b> Sunday, October 23, 2011 1:20 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [Rcpp-devel] Picking off a matrix-valued list element inside a class
 constructor?<br></font><br>
&gt;&nbsp; &nbsp; &nbsp; &nbsp;  Rcpp::IntegerMatrix m = l["m"];;<br>&gt; ...<br>&gt; This seems to work just fine.<br>&gt; ... the seemingly equivalent statement in the body of a class<br>&gt; constructor fails with a compilation error:<br>&gt; ...<br>&gt;&nbsp; &nbsp;  CCC(Rcpp::List l){<br>&gt;&nbsp; &nbsp; &nbsp;  m = l["m"];<br>&gt;&nbsp; &nbsp;  }<br><br><br>In C++, the left side can sometimes give a hint about how the right-side<br>should be interpreted. When I changed the constructor body to this it<br>worked:<br>&nbsp;  Rcpp::IntegerMatrix tmp=l["m"];<br>&nbsp;  m = tmp;<br><br>I tried a few ideas to get a one-liner that does the same... and<br>couldn't; perhaps someone else knows the magic syntax?<br><br>(For reference these were what I tried:<br>&nbsp;  m =Rcpp::IntegerMatrix(l["m"]);<br>&nbsp;  m =(Rcpp::IntegerMatrix)l["m"];<br>&nbsp;  m.operator=&lt;Rcpp::IntegerMatrix&gt;(l["m"]);<br>)<br><br>&gt;&nbsp;  [...]<br>&gt;&nbsp; 
 private:<br>&gt;&nbsp; &nbsp;  Rcpp::IntegerMatrix m;<br>&gt;&nbsp;  }&nbsp;  &lt;-- NEED SEMI-COLON HERE<br>&gt;&nbsp;  '<br><br>BTW, you are missing a semi-colon after the closing bracket for your class.<br><br>Darren<br><br>-- <br>Darren Cook, Software Researcher/Developer<br><br>http://dcook.org/work/ (About me and my work)<br>http://dcook.org/blogs.html (My blogs and articles)<br>_______________________________________________<br>Rcpp-devel mailing list<br><a ymailto="mailto:Rcpp-devel@lists.r-forge.r-project.org" href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br><br><br></div></div></blockquote></div></div></body></html>