|
Re: SWIG-PERL-Vector of pointers: msg#00126programming.swig
On 2003.11.18 22:37, "Nair, Sanjay S" wrote: Types generated by const and non const vectors are different When a function takes a const vector&, it is possible to pass it either a wrapped std::vector or a Perl array. When it takes a vector&, it will probably want to modify it, therefore only a wrapped std::vector can be passed (conversion from Perl array to std::vector would pass a *copy* of the original array to the function.) If you want to make them the same, just cheat and declare the function in your SWIG interface file as: int ABC(std::vector<unsigned char>& pvReadArray, std::vector<unsigned char>& pvWriteArray); The generated wrappers won't break const-correctness for the compiler. (incidentally, I was about to suggest you a better method of specifying which code to generate, but I just found out it doesn't work. I'll have to check with someone working with SWIG internals. But in the meantime, the above should work well enough.) Cheers, Luigi _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: SWIG-PERL-Vector of pointers: 00126, Nair, Sanjay S |
|---|---|
| Next by Date: | Re[2]: Directors and passing args by value.: 00126, Kerim Borchaev |
| Previous by Thread: | RE: SWIG-PERL-Vector of pointersi: 00126, Nair, Sanjay S |
| Next by Thread: | RE: SWIG-PERL-Vector of pointers: 00126, Nair, Sanjay S |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |