From: Rob S. <rob...@si...> - 2007-05-02 15:22:49
|
From: "Eric Mahurin" <eri...@gm...> > > I have a series of hacks to the swig 1.3.31 python .i and .swg files that > gives the following STL functionality: > > * containers (vector, list, deque, set, map, multiset, multimap) of python > objects that even use custom python compare functions. > > * read/write random-access iterators in those containers. > > * functors from callable python objects (i.e. lambdas, functions, methods). > These can operator on normal python objects or those that swig wrapped (i.e. > C++ objects in a container). > > * ability to easily wrap most(all?) algorithms to operate on iterators from > any container (and use the above functors). I don't know how this differs from what had been present, but I'm sure we'll find that functionality useful. I wonder if you know how to extend the iterator logic to work with any class that provides STL-compatible iteration. Suppose I have a class that provides a nested typedef for const_iterator plus these public member functions: const_iterator begin const; const_iterator end const; I'd like to be able to specify feature("iterable") MyClass and have SWIG auto-generate iterator support. (In this case, the iteration would be read-only.) Do you know how to do that? Can you extend your work to support that? -- Rob Stewart rob...@si... Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer; |