From 62d98e78c8ee9054c4b822d1ee43a4cb914f2afb Mon Sep 17 00:00:00 2001 From: jakob lovhall Date: Thu, 19 Aug 2021 10:56:03 +0200 Subject: [PATCH 1/2] lru_cache, remove redundant copy when updating queue position --- include/boost/compute/detail/lru_cache.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/boost/compute/detail/lru_cache.hpp b/include/boost/compute/detail/lru_cache.hpp index fe1a56f74..58098483d 100644 --- a/include/boost/compute/detail/lru_cache.hpp +++ b/include/boost/compute/detail/lru_cache.hpp @@ -97,9 +97,7 @@ class lru_cache m_list.push_front(key); // update iterator in map - j = m_list.begin(); - const value_type &value = i->second.first; - m_map[key] = std::make_pair(value, j); + i->second.second = m_list.begin(); // return the value return value; From 5f09d4f98331432329fead9716afe0d686e63319 Mon Sep 17 00:00:00 2001 From: jakob lovhall Date: Tue, 5 Oct 2021 15:32:50 +0200 Subject: [PATCH 2/2] review update 1. fix return to reference iterator rather than the no longer existing variable --- include/boost/compute/detail/lru_cache.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/compute/detail/lru_cache.hpp b/include/boost/compute/detail/lru_cache.hpp index 58098483d..932216af9 100644 --- a/include/boost/compute/detail/lru_cache.hpp +++ b/include/boost/compute/detail/lru_cache.hpp @@ -100,7 +100,7 @@ class lru_cache i->second.second = m_list.begin(); // return the value - return value; + return i->second.first; } else { // the item is already at the front of the most recently