diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-12-05 23:16:56 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-12-06 08:19:25 +0100 |
commit | 23e32f46b169bf1ec69266c925dabf7c93ba8109 (patch) | |
tree | 289b4f99ca92d3519041d9397d9b394375f47c88 /binaryurp/source | |
parent | fcc76610649a9830859f9e2efe2a06dbc6db74da (diff) |
Use structured binding
Change-Id: I8254d350320115be532c6d595dc56268c8de3ad2
Reviewed-on: https://gerrit.libreoffice.org/64653
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'binaryurp/source')
-rw-r--r-- | binaryurp/source/cache.hxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/binaryurp/source/cache.hxx b/binaryurp/source/cache.hxx index d1c1df7e32bf..722e7494bd8e 100644 --- a/binaryurp/source/cache.hxx +++ b/binaryurp/source/cache.hxx @@ -55,26 +55,25 @@ public: } // try to insert into the map list_.push_front( rContent); // create a temp entry - typedef std::pair<typename LruItMap::iterator,bool> MapPair; - MapPair aMP = map_.emplace( list_.begin(), 0 ); - *pbFound = !aMP.second; + auto const [it, inserted] = map_.emplace( list_.begin(), 0 ); + *pbFound = !inserted; - if( !aMP.second) { // insertion not needed => found the entry + if( !inserted) { // insertion not needed => found the entry list_.pop_front(); // remove the temp entry - list_.splice( list_.begin(), list_, aMP.first->first); // the found entry is moved to front - return aMP.first->second; + list_.splice( list_.begin(), list_, it->first); // the found entry is moved to front + return it->second; } // test insertion successful => it was new so we keep it IdxType n = static_cast<IdxType>( map_.size() - 1); if( n >= size_) { // cache full => replace the LRU entry // find the least recently used element in the map - typename LruItMap::iterator it = map_.find( --list_.end()); - n = it->second; - map_.erase( it); // remove it from the map + typename LruItMap::iterator lru = map_.find( --list_.end()); + n = lru->second; + map_.erase( lru); // remove it from the map list_.pop_back(); // remove from the list } - aMP.first->second = n; + it->second = n; return n; } |