diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-11 11:36:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-11 13:51:29 +0200 |
commit | db17a874af37350b3270932175854ee674447bc1 (patch) | |
tree | fecc983fb75d3a4072cc7bd344fc824d548deb0d /sd/source/ui/slidesorter | |
parent | dd8a400bbbb1b8d5592a870f2036a4df3d005a7d (diff) |
convert std::map::insert to std::map::emplace II
Change-Id: Ief8bd59c903625ba65b75114b7b52c3b7ecbd331
Reviewed-on: https://gerrit.libreoffice.org/41019
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/slidesorter')
-rw-r--r-- | sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx | 12 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx index b45c2ade3cd0..2a5b300410df 100644 --- a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx +++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx @@ -273,9 +273,9 @@ void BitmapCache::SetBitmap ( } else { - iEntry = mpBitmapContainer->insert(CacheBitmapContainer::value_type ( + iEntry = mpBitmapContainer->emplace( rKey, - CacheEntry(rPreview, mnCurrentAccessTime++, bIsPrecious)) + CacheEntry(rPreview, mnCurrentAccessTime++, bIsPrecious) ).first; } @@ -315,9 +315,9 @@ void BitmapCache::SetPrecious (const CacheKey& rKey, bool bIsPrecious) } else if (bIsPrecious) { - iEntry = mpBitmapContainer->insert(CacheBitmapContainer::value_type ( + iEntry = mpBitmapContainer->emplace( rKey, - CacheEntry(Bitmap(), mnCurrentAccessTime++, bIsPrecious)) + CacheEntry(Bitmap(), mnCurrentAccessTime++, bIsPrecious) ).first; UpdateCacheSize(iEntry->second, ADD); } @@ -354,9 +354,9 @@ void BitmapCache::Recycle (const BitmapCache& rCache) CacheBitmapContainer::iterator iEntry (mpBitmapContainer->find(iOtherEntry->first)); if (iEntry == mpBitmapContainer->end()) { - iEntry = mpBitmapContainer->insert(CacheBitmapContainer::value_type ( + iEntry = mpBitmapContainer->emplace( iOtherEntry->first, - CacheEntry(mnCurrentAccessTime++, true)) + CacheEntry(mnCurrentAccessTime++, true) ).first; UpdateCacheSize(iEntry->second, ADD); } diff --git a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx index fb733ce785b8..a2d93d23a48a 100644 --- a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx +++ b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx @@ -147,7 +147,8 @@ public: iterator end() { return maMap.end(); } void clear() { maMap.clear(); } iterator find(const key_type& key) { return maMap.find(key); } - std::pair<iterator,bool> insert(const value_type& value) { return maMap.insert(value); } + template<class... Args> + std::pair<iterator,bool> emplace(Args&&... args) { return maMap.emplace(std::forward<Args>(args)...); } }; class PageCacheManager::Deleter @@ -414,8 +415,8 @@ void PageCacheManager::PutRecentlyUsedCache( // Look up the list of recently used caches for the given document. RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument)); if (iQueue == mpRecentlyUsedPageCaches->end()) - iQueue = mpRecentlyUsedPageCaches->insert( - RecentlyUsedPageCaches::value_type(pDocument, RecentlyUsedQueue()) + iQueue = mpRecentlyUsedPageCaches->emplace( + pDocument, RecentlyUsedQueue() ).first; if (iQueue != mpRecentlyUsedPageCaches->end()) |