logo       

Re: carrays: getitem to return a reference: msg#00120

programming.swig

Subject: Re: carrays: getitem to return a reference

Hello David,

Tuesday, November 18, 2003, 8:35:54 PM, you wrote:

DB> Kerim Borchaev writes:
DB> > Hello swig,
DB> >
DB> > today carrays getitem method returns copy of held object:
DB> > //carrays.i
DB> > TYPE getitem(int index) {
DB> > return self[index];
DB> > }
DB> >
DB> > what works for me is getitem returning reference:
DB> > TYPE* getitem(int index) {
DB> > return self+index;
DB> > }
DB> > Is it an acceptable change? I think it would be consistent with
DB> > how indexing works in c/c++ and python(don't know about other
DB> > languages).
DB> >

DB> No. The carrays module is not intended to be used with arrays of
DB> objects other than primitive types. Making this change will break
DB> all of the code that relies on this.

Yes. I see just before I saw you answer I've already tested it with
"int".
It's not a heart-break. I'll just copy'n'paste carrays.i code. But it
would be better to use "standard" library...

Best regards,
Kerim mailto:warkid@xxxxxxxxx


DB> -- Dave


_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise