Hi Matthias,

My iterator works perfectly now!  I don't fully understand what your code snippet is doing, is there any documentation on this?

Thanks so much for your help,
Greg

On Wed, Feb 27, 2008 at 5:53 PM, Nitro <nitro@dr-code.org> wrote:
Am 27.02.2008, 23:23 Uhr, schrieb Gregory Bayard
<gregory.bayard@gmail.com>:

> Hi,
>
> I am running SWIG 1.3.29 (I can't upgrade because an apparent bug where
> my
> virtual functions in director classes go into infinite recursion loops in
> 1.3.30+) with Python 2.4.4.  I am trying to wrap a class which provides a
> custom iterator to access price elements.  I tried cloning the std_map.i
> behavior which I found in the examples/library code, but I'm getting the
> following error:

...

> My wrapping code is as follows where the MyOrderBook class has two
> methods
> "const_iterator begin()" and "const_iterator end()":

...

> Sadly, I can't use a standard library container for wrapping. Does anyone
> see anything obvious I'm doing wrong or even better, does anyone have any
> custom iterator example code outside of the std_*.i and
> pycontainer.swgfiles included in the distribution?  Any help would be
> greatly appreciated.

The compile error you get can probably be fixed by something like

%define %emit_swig_traits(_Type...)
%traits_swigtype(_Type);
%fragment(SWIG_Traits_frag(_Type));
%enddef

%emit_swig_traits(MyPrice)

I am not sure if this fixes your whole iterator thing, but at least it
should fix the immediate compile error.

-Matthias