lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master cc4b3eb 01/10: Expunge superfluous typenames


From: Greg Chicares
Subject: [lmi-commits] [lmi] master cc4b3eb 01/10: Expunge superfluous typenames
Date: Tue, 2 Aug 2016 12:35:18 +0000 (UTC)

branch: master
commit cc4b3ebb70be7dd14fc3550e1cf6694619c15135
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Expunge superfluous typenames
    
    'value_type' and 'map_type::value_type' are used on two successive lines
    of code; they're too easily confused. Furthermore, 'value_type' is just
    'T' and would never be anything else; similarly, 'key_type' is simply
    'std::string' and cannot be changed without altering client code.
---
 cache_file_reads.hpp |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/cache_file_reads.hpp b/cache_file_reads.hpp
index a8f64a6..00c4a51 100644
--- a/cache_file_reads.hpp
+++ b/cache_file_reads.hpp
@@ -55,9 +55,7 @@ class file_cache
     :private lmi::uncopyable<file_cache<T> >
 {
   public:
-    typedef T value_type;
-    typedef boost::shared_ptr<value_type const> value_ptr_type;
-    typedef std::string key_type;
+    typedef boost::shared_ptr<T const> value_ptr_type;
 
     static file_cache<T>& instance()
         {
@@ -65,7 +63,7 @@ class file_cache
         return z;
         }
 
-    value_ptr_type retrieve_or_reload(key_type const& filename)
+    value_ptr_type retrieve_or_reload(std::string const& filename)
         {
         // Throws if !exists(filename).
         std::time_t const write_time = fs::last_write_time(filename);
@@ -81,7 +79,7 @@ class file_cache
             }
 
         // Construction may throw, so do it before updating the cache.
-        value_ptr_type value(new value_type(filename));
+        value_ptr_type value(new T(filename));
 
         // insert() doesn't update the value if the key is already
         // present, so insert a dummy value and then modify it--this
@@ -101,7 +99,7 @@ class file_cache
         std::time_t    write_time;
     };
 
-    typedef std::map<key_type,record> map_type;
+    typedef std::map<std::string,record> map_type;
     map_type cache_;
 };
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]