[Rcpp-devel] Fwd: Wrapping copy constructor in rcpp?
Tama Ma
pingnang at phys.ethz.ch
Fri Nov 4 23:44:45 CET 2011
(Sorry that I forgot to cc to the list... Here is my message... I just came back from dinner...)
Begin forwarded message:
> From: Tama Ma <pingnang at phys.ethz.ch>
> Date: November 4, 2011 5:59:53 PM GMT+01:00
> To: Dirk Eddelbuettel <edd at debian.org>
> Subject: Re: [Rcpp-devel] Wrapping copy constructor in rcpp?
>
> Dear Dirk,
>
> Yes, if b = a.clone(); copies a into b.
> In the C++ language, the following is what I mean:
>
> typedef <my/favourite/class> object_type;
>
> object_type a;
> object_type b(a);
>
> Ultimately, what I desire in the R interface will be something like that:
>
> a <- new(my/favorite/Rcpp/Module , ... );
> b <- new(my/favorite/Rcpp/Module , a);
>
> But, if there exists such a clone() function that does the copying of Rcpp objects in the R interface, I am just as satisfied.
>
> Best regards,
> Tama Ma
>
>
>
>
>
> On Nov 4, 2011, at 5:51 PM, Dirk Eddelbuettel wrote:
>
>>
>> On 4 November 2011 at 17:08, Tama Ma wrote:
>> | Dear Dirk,
>> |
>> | Thanks for the reply. I am pretty sure that it has not been implemented yet, and I will try to look into it. From a practical point of view, I would want to copy a "Rcpp" object in the R interface, and not a "copy-by-pointer" approach now.
>>
>> You mean just like what clone() does?
>>
>> Dirk
>>
>> | Thank you once again.
>> |
>> | Best regards,
>> | Tama Ma
>> |
>> |
>> | On Nov 4, 2011, at 4:48 PM, Dirk Eddelbuettel wrote:
>> |
>> | >
>> | > On 4 November 2011 at 16:08, Tama Ma wrote:
>> | > | Dear Rcpp developers,
>> | > |
>> | > | Maybe my previous email has been ignored. I am asking whether there is a possibility to wrap the copy constructor in a C++ class via Rcpp?
>> | >
>> | > You get a firm "maybe" and even an additional "why not" from me.
>> | >
>> | > I am a little unsure exactly what you are after. Basic Rcpp functions _all_
>> | > have to conform to the .Call()-required interface
>> | >
>> | > extern "C" SEXP foo(SEXP a, SEXP b)
>> | >
>> | > signature (for a variable number of arguments).
>> | >
>> | > So no ctor or copy ctor here.
>> | >
>> | > So I presume you are talking about Rcpp Modules? We have some documentation
>> | > on what is possible. If you don't see an explicit mention or example or unit
>> | > test doing it, then maybe it hasn't been implemented yet. But this is Open
>> | > Source and you have already contributed a patch so you know the drill, right :)
>> | >
>> | > Dirk
>> | >
>> | > --
>> | > "Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
>> | > dark to read." -- Groucho Marx
>> | >
>> |
>> |
>> | Best regards,
>> | Tama Ma
>> | (+41 78 640 50 15)
>> |
>> | pingnang at phys.ethz.ch
>> | www.phys.ethz.ch/~pingnang
>> |
>> | HIT K 31.3
>> | Institut für Theoretische Physik
>> | Wolfgang-Pauli-Strasse 27
>> | ETH Hönggerberg
>> | 8093 Zürich
>> | Switzerland
>> |
>>
>> --
>> "Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
>> dark to read." -- Groucho Marx
>>
>
>
> Best regards,
> Tama Ma
> (+41 78 640 50 15)
>
> pingnang at phys.ethz.ch
> www.phys.ethz.ch/~pingnang
>
> HIT K 31.3
> Institut für Theoretische Physik
> Wolfgang-Pauli-Strasse 27
> ETH Hönggerberg
> 8093 Zürich
> Switzerland
>
Best regards,
Tama Ma
(+41 78 640 50 15)
pingnang at phys.ethz.ch
www.phys.ethz.ch/~pingnang
HIT K 31.3
Institut für Theoretische Physik
Wolfgang-Pauli-Strasse 27
ETH Hönggerberg
8093 Zürich
Switzerland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20111104/404f7550/attachment-0001.htm>
More information about the Rcpp-devel
mailing list