From 6f445771098d73b8930516a1bb2fc022059dce56 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 12 Nov 2012 13:56:26 -0800 Subject: [PATCH] Be more explicity about make_pair types. --- src/cpp/ripple/TaggedCache.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/cpp/ripple/TaggedCache.h b/src/cpp/ripple/TaggedCache.h index aee675042f..fa3c6541aa 100644 --- a/src/cpp/ripple/TaggedCache.h +++ b/src/cpp/ripple/TaggedCache.h @@ -29,9 +29,10 @@ public: typedef c_Key key_type; typedef c_Data data_type; - typedef boost::weak_ptr weak_data_ptr; - typedef boost::shared_ptr data_ptr; - typedef std::pair cache_entry; + typedef boost::weak_ptr weak_data_ptr; + typedef boost::shared_ptr data_ptr; + typedef std::pair cache_entry; + typedef std::pair cache_pair; protected: mutable boost::recursive_mutex mLock; @@ -156,7 +157,7 @@ template bool TaggedCache::touch } // In map but not cache, put in cache - mCache.insert(std::make_pair(key, std::make_pair(time(NULL), weak_data_ptr(cit->second.second)))); + mCache.insert(cache_pair(key, cache_entry(time(NULL), weak_data_ptr(cit->second.second)))); return true; } @@ -180,7 +181,7 @@ bool TaggedCache::canonicalize(const key_type& key, boost::shared typename boost::unordered_map::iterator mit = mMap.find(key); if (mit == mMap.end()) { // not in map - mCache.insert(std::make_pair(key, std::make_pair(time(NULL), data))); + mCache.insert(cache_pair(key, cache_entry(time(NULL), data))); mMap.insert(std::make_pair(key, data)); return false; } @@ -189,7 +190,7 @@ bool TaggedCache::canonicalize(const key_type& key, boost::shared if (!cachedData) { // in map, but expired. Update in map, insert in cache mit->second = data; - mCache.insert(std::make_pair(key, std::make_pair(time(NULL), data))); + mCache.insert(cache_pair(key, cache_entry(time(NULL), data))); return true; } @@ -208,7 +209,7 @@ bool TaggedCache::canonicalize(const key_type& key, boost::shared cit->second.second = data; } else // no, add to cache - mCache.insert(std::make_pair(key, std::make_pair(time(NULL), data))); + mCache.insert(cache_pair(key, cache_entry(time(NULL), data))); return true; } @@ -235,7 +236,7 @@ boost::shared_ptr TaggedCache::fetch(const key_type& key) if (cit != mCache.end()) cit->second.first = time(NULL); // Yes, refresh else // No, add to cache - mCache.insert(std::make_pair(key, std::make_pair(time(NULL), cachedData))); + mCache.insert(cache_pair(key, cache_entry(time(NULL), cachedData))); return cachedData; }