logo       

carrays: getitem to return a reference: msg#00118

programming.swig

Subject: carrays: getitem to return a reference

Hello swig,

today carrays getitem method returns copy of held object:
//carrays.i
TYPE getitem(int index) {
return self[index];
}

what works for me is getitem returning reference:
TYPE* getitem(int index) {
return self+index;
}
Is it an acceptable change? I think it would be consistent with
how indexing works in c/c++ and python(don't know about other
languages).


Best regards,
Kerim mailto:warkid@xxxxxxxxx


_______________________________________________
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