> Rcpp::IntegerMatrix m = l["m"];; > ... > This seems to work just fine. > ... the seemingly equivalent statement in the body of a class > constructor fails with a compilation error: > ... > CCC(Rcpp::List l){ > m = l["m"]; > }
In C++, the left side can sometimes give a hint about how the right-side should be interpreted. When I changed the constructor body to this it worked: Rcpp::IntegerMatrix tmp=l["m"]; m = tmp; I tried a few ideas to get a one-liner that does the same... and couldn't; perhaps someone else knows the magic syntax? (For reference these were what I tried: m =Rcpp::IntegerMatrix(l["m"]); m =(Rcpp::IntegerMatrix)l["m"]; m.operator=<Rcpp::IntegerMatrix>(l["m"]); ) > [...] > private: > Rcpp::IntegerMatrix m; > } <-- NEED SEMI-COLON HERE > ' BTW, you are missing a semi-colon after the closing bracket for your class. Darren -- Darren Cook, Software Researcher/Developer http://dcook.org/work/ (About me and my work) http://dcook.org/blogs.html (My blogs and articles) _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel