Accumulator* PivotTable::getAccumulatorForKeyAndEntry(const char* key, const char* entryKey) { //std::cout << "Key " << key << std::endl; Container::const_iterator finder = mDocumentMap.find(key); EntriesMap* entries = 0; if (finder == mDocumentMap.end()) { entries = new EntriesMap(); #ifndef NO_GOOGLE_HASH entries->set_empty_key(0); #endif size_t theSize = strlen(key); char* newKey = new char[theSize]; newKey[0] = '\0'; strcpy(newKey, key); mDocumentMap[newKey] = entries; } else { entries = finder->second; } EntriesMap::const_iterator finderEntry = entries->find(entryKey); Accumulator* result = 0; if (finderEntry == entries->end()) { result = new Accumulator(); entries->insert(std::make_pair(entryKey,result)); } else result = finderEntry->second; return result; }