void TraceCollection::_IterateEvents(Visitor& visitor, KeyTokenCache& cache, const TraceThreadId& threadIndex, I begin, I end) const { for (I iter = begin; iter != end; ++iter){ const TraceEvent& e = *iter; if (visitor.AcceptsCategory(e.GetCategory())) { // Create the token from the hash using a cache because there // are likely to be many duplicate keys. KeyTokenCache::const_iterator it = cache.find(e.GetKey()); if (it == cache.end()) { it = cache.insert( std::make_pair(e.GetKey(), TfToken(e.GetKey()._ptr->GetString()))).first; } visitor.OnEvent(threadIndex, it->second, e); } } }