| 109 | } |
| 110 | |
| 111 | std::vector<StringBox> StringCache::all() const { |
| 112 | std::vector<StringBox> out; |
| 113 | |
| 114 | std::lock_guard<Mutex> guard(_mutex); |
| 115 | out.reserve(_table.size()); |
| 116 | |
| 117 | for (const auto& it : _table) { |
| 118 | auto locked = it.impl->lock(); |
| 119 | if (locked != nullptr) { |
| 120 | out.emplace_back(Ref<InternedStringImpl>(std::move(locked))); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | return out; |
| 125 | } |
| 126 | |
| 127 | StringCache::StringTable::const_iterator StringCache::findEntry(const std::string_view& str, size_t hash) const { |
| 128 | return _table.find(str, makePHMapHash(hash)); |