swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Question] using Map, setCompareFunction, ordering lists


From: Norberto Eiji Nawa
Subject: Re: [Question] using Map, setCompareFunction, ordering lists
Date: Wed, 16 Jun 1999 09:17:44 +0900

Hello Marcus,

NEN> The problem is that I am getting a segmentation fault in [c1 getPrice],
NEN> when sellList contains already one element.

Marcus> Are you using objects or integers as your Map key?

Your question helped me clarify how the at:insert: Map method
works. Needless to say, I was missing the point here.

For your reference of what a imaginative mind of a new user can think,
here follows my mistake (mea culpa :-)

When inserting an object in a list, I was doing:

[sellList at: (id)auxPrice insert: bo]; 

Somehow, after reading the documentation, I imagined that I should
pass the value of object bo's "key" (int auxPrice) in at:insert:

The problem was that I was trying to retrieve the value of the key
from inside the compare function, calling my method from one int
casted into one id!!!

The correct way (I guess) should be: 

[sellList at: (id)bo insert: bo]; 

Thanks a lot,

Eiji

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]