-Werror=shadow (GCC 8)
> include/o3tl/lru_map.hxx:70:24: error: declaration of ‘iterator’ shadows a previous local [-Werror=shadow] > map_iterator_t iterator = mLruMap.find(rPair.first); > ^~~~~~~~ > include/o3tl/lru_map.hxx:61:29: note: shadowed declaration is here > typedef list_iterator_t iterator; > ^~~~~~~~ Change-Id: Ic0f8ab4609a06b713ffa6e8e9fdd04f0c42869d7
This commit is contained in:
parent
c44d9f9e62
commit
538c649f79
1 changed files with 12 additions and 12 deletions
|
@ -67,9 +67,9 @@ public:
|
||||||
|
|
||||||
void insert(key_value_pair_t& rPair)
|
void insert(key_value_pair_t& rPair)
|
||||||
{
|
{
|
||||||
map_iterator_t iterator = mLruMap.find(rPair.first);
|
map_iterator_t i = mLruMap.find(rPair.first);
|
||||||
|
|
||||||
if (iterator == mLruMap.end()) // doesn't exist -> add to queue and map
|
if (i == mLruMap.end()) // doesn't exist -> add to queue and map
|
||||||
{
|
{
|
||||||
// add to front of the list
|
// add to front of the list
|
||||||
mLruList.push_front(rPair);
|
mLruList.push_front(rPair);
|
||||||
|
@ -80,17 +80,17 @@ public:
|
||||||
else // already exists -> replace value
|
else // already exists -> replace value
|
||||||
{
|
{
|
||||||
// replace value
|
// replace value
|
||||||
iterator->second->second = rPair.second;
|
i->second->second = rPair.second;
|
||||||
// bring to front of the lru list
|
// bring to front of the lru list
|
||||||
mLruList.splice(mLruList.begin(), mLruList, iterator->second);
|
mLruList.splice(mLruList.begin(), mLruList, i->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void insert(key_value_pair_t&& rPair)
|
void insert(key_value_pair_t&& rPair)
|
||||||
{
|
{
|
||||||
map_iterator_t iterator = mLruMap.find(rPair.first);
|
map_iterator_t i = mLruMap.find(rPair.first);
|
||||||
|
|
||||||
if (iterator == mLruMap.end()) // doesn't exist -> add to list and map
|
if (i == mLruMap.end()) // doesn't exist -> add to list and map
|
||||||
{
|
{
|
||||||
// add to front of the list
|
// add to front of the list
|
||||||
mLruList.push_front(std::move(rPair));
|
mLruList.push_front(std::move(rPair));
|
||||||
|
@ -101,16 +101,16 @@ public:
|
||||||
else // already exists -> replace value
|
else // already exists -> replace value
|
||||||
{
|
{
|
||||||
// replace value
|
// replace value
|
||||||
iterator->second->second = std::move(rPair.second);
|
i->second->second = std::move(rPair.second);
|
||||||
// push to back of the lru list
|
// push to back of the lru list
|
||||||
mLruList.splice(mLruList.begin(), mLruList, iterator->second);
|
mLruList.splice(mLruList.begin(), mLruList, i->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const list_const_iterator_t find(const Key& key)
|
const list_const_iterator_t find(const Key& key)
|
||||||
{
|
{
|
||||||
const map_iterator_t iterator = mLruMap.find(key);
|
const map_iterator_t i = mLruMap.find(key);
|
||||||
if (iterator == mLruMap.cend()) // can't find entry for the key
|
if (i == mLruMap.cend()) // can't find entry for the key
|
||||||
{
|
{
|
||||||
// return empty iterator
|
// return empty iterator
|
||||||
return mLruList.cend();
|
return mLruList.cend();
|
||||||
|
@ -118,8 +118,8 @@ public:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// push to back of the lru list
|
// push to back of the lru list
|
||||||
mLruList.splice(mLruList.begin(), mLruList, iterator->second);
|
mLruList.splice(mLruList.begin(), mLruList, i->second);
|
||||||
return iterator->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue