Skip to content

Commit f404549

Browse files
committed
some comments
1 parent f9dbf6d commit f404549

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lru_container/src/implements/lru_boost_list_container.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ class LRUCacheContainer_BoostList {
9696
}
9797

9898
auto result = container.emplace(std::forward<Args>(args)...);
99+
100+
// здесь и далее - данные гарантировано не "испортятся" - const_cast
101+
// нужен потому, что итератор константный, а intrusive::list должен поменять хуки
99102
auto &value = const_cast<ValueWithHook<Value>&>(*result.first);
100103
if (result.second) {
101104
usage_list.push_back(value);

lru_container/src/lru_container_concept.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ concept LRUCacheType = requires(T cache, size_t size, const Key &key, Args&&...
2828
{cache.emplace(std::forward<Args>(args)...)} -> std::same_as<bool>;
2929
};
3030

31+
// проверка концептом вместо наследования от абстрактного класса кэша
3132
#define lru_concept_assert_for_one_tag(CahceType, Tag, IndexType, ValueType) \
3233
static_assert((LRUCacheType<CahceType, Tag, IndexType, const ValueType&>, "LRUCacheType concept")); \
3334
static_assert((LRUCacheType<CahceType, Tag, IndexType, ValueType&&>, "LRUCacheType concept"));

0 commit comments

Comments
 (0)