On a related note to the question on derived classes I sent yesterday, here is another interesting idea. Assume I have classes<br><br>class Foo {<br> ...<br>};<br><br>class Bar {<br> ...<br><br> //pass Foo pointer as parameter<br>
void myMethod(Foo* X) {<br> ...<br> }<br> //or Foo reference<br> void myMethod2(Foo& X) {<br> ...<br> }<br><br> //or return Foo pointer<br> Foo* getFoo() {<br> ...<br> }<br>
};<br><br>Now, when exposing both classes to R using modules, it would be great to be able to do something like<br><br>FooVar <- new( Mod$Foo )<br>BarVar <- new( Mod$Bar )<br><br>//pass Bar as parameter<br>BarVar$myMethod(FooVar)<br>
<br>//get Bar back<br>FooVar2 = BarVar$getFoo()<br><br>Since the C++ part of Rcpp Modules has to have a pointer to the underlying object (i.e. of type Foo*) somewhere anyway, this seems possible. But since I am no expert in C++ meta programming, I don't know if e.g. Bar needs to know at compile time that Foo is exposed as well or what it looks like or if this can be handled dynamically at runtime. <br>
<br>Best regards,<br>Jonas<br><br>