if( !inserted) { // insertion not needed => found the entry
list_.pop_front(); // remove the temp entry
list_.splice( list_.begin(), list_, it->first); // the found entry is moved to front return it->second;
}
// test insertion successful => it was new so we keep it
IdxType n = static_cast<IdxType>( map_.size() - 1); if( n >= size_) { // cache full => replace the LRU entry // find the least recently used element in the map typename LruItMap::iterator lru = map_.find( --list_.end());
n = lru->second;
map_.erase( lru); // remove it from the map
list_.pop_back(); // remove from the list
}
it->second = n; return n;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.