What happened to this site? And what's that frog about?

Search() in 0-row views.

F124 - Failure Feedback Forum 

Status: review Severity: minor Category: Metakit C++ Created: 2007-01-11 Updated: 2007-01-11

Currently, Search() returns 0 if the view is of size 0. This behavior is odd because you can't therefore use Search() to check if an entry exists and add it if it doesn't on a 0-row view. You will get 0, the check for -1 will return false, and then you call SetAt(0,row) and it crashes.

Summary

This is not quite the case, I think - the docs in view.cpp say:

  Search for a key, using the native sort order of the view
  Return position where found, or where it may be inserted,
    this position can also be just past the last row

So returning 0 on an empty view would seem to be consistent with that: it's the position where one inserts new items, if the row at the returned position does not match or is past the end.



2007-01-11 coppro

Imported

Add a comment:

Tip: add empty lines between paragraphs and indent lines to prevent reformatting.

Your name or initials:  

Powered by Mavrig