Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Naplavkov committed Jun 1, 2023
1 parent c594591 commit af0790a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions least_frequently_used.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ class cache {

public:
explicit cache(std::size_t capacity) : capacity_(capacity) {}
cache(cache&&) = default;
cache& operator=(cache&&) = default;
cache(const cache&) = delete;
cache& operator=(const cache&) = delete;
virtual ~cache() = default;

/// @return nullptr if key is not found
const T* find(const Key& key)
Expand Down
12 changes: 11 additions & 1 deletion least_recently_used.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ class linked_hash_map {
using value_type = std::pair<const Key, T>;
using list_type = std::list<value_type>;
using iterator = typename list_type::iterator;

linked_hash_map() = default;
linked_hash_map(linked_hash_map&&) = default;
linked_hash_map& operator=(linked_hash_map&&) = default;
linked_hash_map(const linked_hash_map&) = delete;
linked_hash_map& operator=(const linked_hash_map&) = delete;
virtual ~linked_hash_map() = default;
auto size() const { return list_.size(); }
iterator begin() { return list_.begin(); }
iterator end() { return list_.end(); }
Expand Down Expand Up @@ -70,6 +75,11 @@ class cache {

public:
explicit cache(std::size_t capacity) : capacity_(capacity) {}
cache(cache&&) = default;
cache& operator=(cache&&) = default;
cache(const cache&) = delete;
cache& operator=(const cache&) = delete;
virtual ~cache() = default;

/// @return nullptr if key is not found
const T* find(const Key& key)
Expand Down

0 comments on commit af0790a

Please sign in to comment.