| 347 | // Check whether index i is in the array. |
| 348 | template<typename Value> |
| 349 | bool SparseArray<Value>::has_index(int i) const { |
| 350 | assert(i >= 0); |
| 351 | assert(i < max_size()); |
| 352 | if (static_cast<uint32_t>(i) >= static_cast<uint32_t>(max_size())) { |
| 353 | return false; |
| 354 | } |
| 355 | // Unsigned comparison avoids checking sparse_[i] < 0. |
| 356 | return (uint32_t)sparse_[i] < (uint32_t)size_ && |
| 357 | dense_[sparse_[i]].index_ == i; |
| 358 | } |
| 359 | |
| 360 | template<typename Value> |
| 361 | void SparseArray<Value>::create_index(int i) { |
no test coverage detected