behaviour of find method.
Hello everybody, I found out that the behaviour of the find method is not quite as advertised in the tutorial. The tutorial says: @example bool ex::find(const ex & pattern, lst & found); @end example works a bit like @code{has()} but it doesn't stop upon finding the first match. Instead, it appends all found matches to the specified list. Appending means adding at the end. However, the code of the ex::find() method includes the lines if (match(pattern)) { found.append(*this); found.sort(); found.unique(); return true; } This sorts the found-list so that a match will most of the time not end up at the end, not to mention what happens to any ordering of elements the found list had before calling the find() method. I would guess that this is because this implementation comes with potentially huge memory savings at the cost of speed because of uniquing after every object found. If this is the case, I can understand the implementation, but still the tutorial should describe the true behaviour. Groetjes, Chris
Hi! On Mon, Dec 23, 2002 at 05:39:00PM +0000, Chris Dams wrote:
[list returned by find()] I can understand the implementation, but still the tutorial should describe the true behaviour.
Fixed. :) Bye, Christian -- / Coding on PowerPC and proud of it \/ http://www.uni-mainz.de/~bauec002/
participants (2)
-
Chris Dams
-
Christian Bauer