lookupSorted()

Fast (binary) lookup in a sorted dyn_string.

Synopsis

bool lookupSorted(dyn_string &values, const string &value, bool insertIfNotFound = true, bool removeIfFound = false)

Parameters

Parameters Meaning
values Sorted dynamic array of strings where /p value should be looked up. Must be sorted ascending.
value String to look up in /p values.
insertIfNotFound If true (default) and value is not found in values, it is inserted at the correct (sorted) location.
removeIfFound If true (default is false) and value is found in values, it will be removed.

Return value

  • true - if value was found
  • false - if value was not found (before inserting or removing it)

Description

Should also be used to add and/or remove strings (using the insertIfNotFound and removeIfFound flags). The default behavior is to add strings that are not yet included, which is the most common use case: keep a list of things that have already been processed in order to not process them again.

Anmerkung: If this functionality is needed for a different value type, it needs to be re-implemented for that data type.

Assignment

Miscellaneous functions

Availability

UI, CTRL