mdds
|
#include <sorted_string_map.hpp>
Classes | |
struct | entry |
Public Types | |
typedef _ValueT | value_type |
typedef size_t | size_type |
Public Member Functions | |
sorted_string_map (const entry *entries, size_type entry_size, value_type null_value) | |
value_type | find (const char *input, size_type len) const |
size_type | size () const |
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.
mdds::sorted_string_map< _ValueT >::sorted_string_map | ( | const entry * | entries, |
size_type | entry_size, | ||
value_type | null_value | ||
) |
Constructor.
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 mdds::sorted_string_map< _ValueT >::find | ( | const char * | input, |
size_type | len | ||
) | const |
Find a value associated with a specified string key.
input | pointer to a C-style string whose value represents the key to match. |
len | length of the matching string value. |
size_type mdds::sorted_string_map< _ValueT >::size | ( | ) | const |
Return the number of entries in the map. Since the number of entries is statically defined at compile time, this method always returns the same value.