D - experience with associative arrays?
- "Ivan Senji" <ivan.senji public.srce.hr> Apr 22 2004
- "Ivan Senji" <ivan.senji public.srce.hr> Apr 23 2004
- "Walter" <walter digitalmars.com> Apr 23 2004
- "Ivan Senji" <ivan.senji public.srce.hr> Apr 24 2004
Has anyone had any strange and unexplainable experiences
using associative arrays in a little more complex ways:
like
FirstClass[SecondClass] name
I get code that doesn't behave the same in debug and release
mode, it allways crashes with acces exception but in different
places in these two modes.
Then another interesting thing: i have code with a foreach
in a foreach and in the inner foreach i do something with the
associative array and it causes acces violation but
if i add a simple printf("."); in the beginning of the inner foreach
everything works ok.
Maybe i have gone totally crazy (my head is going to explode
from this) but i can't see what am i doing wrong!
The code is too complex to post it here but i will try to
find a simpler strange-behaving scenario, i was just wondering
if simillar things happened to anyone else?
Apr 22 2004
I tried and i tried but i couldn't recreate in a new project the problems i was having. I tried int[class] class[class] struct[class] and it all worked great. I gues i was doing something else wrong. After this little playing with associative arrays i like them even more! If only they worked for structs :) "Ivan Senji" <ivan.senji public.srce.hr> wrote in message news:c698ic$d0b$1 digitaldaemon.com...Has anyone had any strange and unexplainable experiences using associative arrays in a little more complex ways: like FirstClass[SecondClass] name I get code that doesn't behave the same in debug and release mode, it allways crashes with acces exception but in different places in these two modes. Then another interesting thing: i have code with a foreach in a foreach and in the inner foreach i do something with the associative array and it causes acces violation but if i add a simple printf("."); in the beginning of the inner foreach everything works ok. Maybe i have gone totally crazy (my head is going to explode from this) but i can't see what am i doing wrong! The code is too complex to post it here but i will try to find a simpler strange-behaving scenario, i was just wondering if simillar things happened to anyone else?
Apr 23 2004
"Ivan Senji" <ivan.senji public.srce.hr> wrote in message news:c6bm4h$1en0$1 digitaldaemon.com...After this little playing with associative arrays i like them even more!
The more I use them, the more I like them too!If only they worked for structs :)
They will if you write a Typeinfo for the particular struct.
Apr 23 2004
"Walter" <walter digitalmars.com> wrote in message news:c6c8e7$2dhl$1 digitaldaemon.com..."Ivan Senji" <ivan.senji public.srce.hr> wrote in message news:c6bm4h$1en0$1 digitaldaemon.com...After this little playing with associative arrays i like them even more!
The more I use them, the more I like them too!If only they worked for structs :)
They will if you write a Typeinfo for the particular struct.
I remember that someone said something about this, but how do i write a Typeinfo for a struct, what needs to be done?? Why isn't the approach the same as with classes (that you have to write opCmp, opEquals, toHash) that seams a lot simpler.
Apr 24 2004








"Ivan Senji" <ivan.senji public.srce.hr>