[Lemon-commits] [lemon_svn] alpar: r974 - hugo/trunk/src/hugo

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:42:31 CET 2006


Author: alpar
Date: Wed Jul 21 19:38:02 2004
New Revision: 974

Modified:
   hugo/trunk/src/hugo/maps.h

Log:
MapBase added


Modified: hugo/trunk/src/hugo/maps.h
==============================================================================
--- hugo/trunk/src/hugo/maps.h	(original)
+++ hugo/trunk/src/hugo/maps.h	Wed Jul 21 19:38:02 2004
@@ -12,17 +12,27 @@
 
 namespace hugo {
 
+  /// Base class of maps.
+
+  template<typename K, typename T>
+  class MapBase
+  {
+  public:
+    ///
+    typedef K KeyType;
+    ///
+    typedef T ValueType;
+  };
+
   /// Null map. (aka DoNothingMap)
 
   /// If you have to provide a map only for its type definitions,
   /// or if you have to provide a writable map, but will not use the
   /// data written to it...
   template<typename K, typename T>
-  class NullMap
+  class NullMap : public MapBase<K,T>
   {
   public:
-    typedef K KeyType;
-    typedef T ValueType;
 
     T operator[](const K&) const { return T(); }
     void set(const K&, const T&) {}
@@ -37,12 +47,10 @@
   /// This is a readable map which assignes a specified value to each key.
   /// In other aspects it is equivalent to the \ref NullMap
   template<typename K, typename T>
-  class ConstMap
+  class ConstMap : public MapBase<K,T>
   {
     T v;
   public:
-    typedef K KeyType;
-    typedef T ValueType;
 
     ConstMap() {}
     ConstMap(const T &_v) : v(_v) {}



More information about the Lemon-commits mailing list