| 115 | // Search for an element with the specified value and return true if it was found, false otherwise. |
| 116 | template <typename Container, typename T> |
| 117 | bool ContainsElement(const Container& container, const T& value, size_t start_pos = 0u) { |
| 118 | DCHECK_LE(start_pos, container.size()); |
| 119 | auto start = container.begin(); |
| 120 | std::advance(start, start_pos); |
| 121 | auto it = std::find(start, container.end(), value); |
| 122 | return it != container.end(); |
| 123 | } |
| 124 | |
| 125 | // 32-bit FNV-1a hash function suitable for std::unordered_map. |
| 126 | // It can be used with any container which works with range-based for loop. |