86 const Slab_&
find(Id_
id, Cfunction_ create, Pfunction_ populate) {
87 if (
id == my_last_id && my_last_slab) {
92 auto it = my_cache_exists.find(
id);
93 if (it != my_cache_exists.end()) {
94 auto chosen = it->second;
95 my_cache_data.splice(my_cache_data.end(), my_cache_data, chosen);
96 my_last_slab = &(chosen->first);
100 typename std::list<Element>::iterator location;
101 if (my_cache_data.size() < my_max_slabs) {
102 my_cache_data.emplace_back(create(),
id);
103 location = std::prev(my_cache_data.end());
105 location = my_cache_data.begin();
106 my_cache_exists.erase(location->second);
107 location->second = id;
108 my_cache_data.splice(my_cache_data.end(), my_cache_data, location);
110 my_cache_exists[id] = location;
112 auto& slab = location->first;
114 my_last_slab = &slab;