In Perl, I'm accustomed to passing arrays to and from subs
sub abc {
foreach my $x (@_) { print $x; }
return (0, 1, 2);
}
How can I achieve similar behavior with SWIG'ed functions?
SWIG'ing this:
std::vector<int> print_list(std::vector<int> l)
{
std::vector<int>::iterator iter;
for(iter=l.begin(); iter!=l.end(); iter++) {
printf("int %d\n", *iter);
}
return l;
}
Yields a sub that expects an array reference and returns an array reference? I'm using the stl templates that come with SWIG.
Do I need to write a typemap for this? Seems this would already be covered somewhere.