binaryurp/source/cache.hxx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
New commits: commit 23e32f46b169bf1ec69266c925dabf7c93ba8109 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed Dec 5 23:16:56 2018 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Thu Dec 6 08:19:25 2018 +0100 Use structured binding Change-Id: I8254d350320115be532c6d595dc56268c8de3ad2 Reviewed-on: https://gerrit.libreoffice.org/64653 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> 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; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits