Hello,
I've have an XS module that exports a C++ class.
Following example EX7 in Dean Roehrich's CookBookA [1], my class/package
compiles and works fine.
Now,
In the XS/CPP class, I use an STL container to store some information.
What would be the most perl-like way to allow the Perl programmer to iterate
over all the elements in my CPP class ?
For the sake of this argument,
Let's assume the container is a simple "std::list<int>" - how do expose this to
the Perl programmer ?
I couldn't find a perl typemap that would go with
std::list<int>::const_itearator, so exposing begin()/end() doesn't work
(perhaps I missed something, online examples are scarce with XS+CPP+STL).
Another complication:
I can't return an perl list/array containing all the elements (there are too
many elements) - I need to iterate them in a perl loop.
I'd imagine something like:
===
my $obj = MyClass->new();
my $iter = $obj->begin();
while ( my $value = $obj->get_next($iter) ) {
# Do something with $value
}
===
I realize it's not a very perlish style, so any ideas and suggestion would be
appropriated.
Thanks,
-gordon
[1]
http://search.cpan.org/~dmr/CookBookA-19960430/
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl