Sorted String Map¶
API Reference¶
-
template <typename _ValueT>
classsorted_string_map¶ sorted_string_map provides an efficient way to map string keys to arbitrary values, provided that the keys are known at compile time and are sorted in ascending order.
Public Functions
-
sorted_string_map(const entry *entries, size_type entry_size, value_type null_value)¶ Constructor.
- Parameters
entries: pointer to the array of key-value entries.entry_size: size of the key-value entry array.null_value: null value to return when the find method fails to find a matching entry.
-
value_type
find(const char *input, size_type len) const¶ Find a value associated with a specified string key.
- Return
- value associated with the key, or the null value in case the key is not found.
- Parameters
input: pointer to a C-style string whose value represents the key to match.len: length of the matching string value.
-
struct
entry¶ Single key-value entry. Caller must provide at compile time a static array of these entries.
-