| 378 | |
| 379 | template<typename T> |
| 380 | typename T::mapped_type findPrefixInMap( |
| 381 | const T &table, const std::string &key, |
| 382 | const typename T::mapped_type& defval = typename T::mapped_type() |
| 383 | ) { |
| 384 | auto it = table.lower_bound(key); |
| 385 | if (it != table.end() && it->first == key) |
| 386 | return it->second; |
| 387 | if (it != table.begin()) { |
| 388 | --it; |
| 389 | if (prefix_matches(it->first, key)) |
| 390 | return it->second; |
| 391 | } |
| 392 | return defval; |
| 393 | } |
| 394 | |
| 395 | #ifdef __GNUC__ |
| 396 | #define VARIABLE_IS_NOT_USED __attribute__ ((unused)) |
nothing calls this directly
no test coverage detected