Return the longest matching key prefix with an associated value.

Synopsis

Declared in <ball_categorymanager_radixtree.h>

std::string_view
findLongestCommonPrefix(
    OptValueRef* value,
    std::string_view const& key);

Description

Return the longest prefix of the specified key that has an associated value in this tree, or an empty string view if no such prefix exists. If the optionally specified value is not null, load into *value a reference to the value associated with the returned prefix. Note that an empty return value can mean either that no matching prefix exists, or that the empty string itself is the longest matching prefix (when the tree contains a value for the empty key). Also note that the returned reference (if set) remains valid until the tree is modified.

Return Value

longest matching prefix, or an empty string view if none

Parameters

Name

Description

value

optional out‐parameter for the matched value

key

key whose longest matching prefix is sought

Created with MrDocs