| 358 | T *data() { return reinterpret_cast<T *>(Data()); } |
| 359 | |
| 360 | template<typename K> return_type LookupByKey(K key) const { |
| 361 | void *search_result = std::bsearch( |
| 362 | &key, Data(), size(), IndirectHelper<T>::element_stride, KeyCompare<K>); |
| 363 | |
| 364 | if (!search_result) { |
| 365 | return nullptr; // Key not found. |
| 366 | } |
| 367 | |
| 368 | const uint8_t *element = reinterpret_cast<const uint8_t *>(search_result); |
| 369 | |
| 370 | return IndirectHelper<T>::Read(element, 0); |
| 371 | } |
| 372 | |
| 373 | protected: |
| 374 | // This class is only used to access pre-existing data. Don't ever |