Index: src/lemon/concept/maps.h
===================================================================
--- src/lemon/concept/maps.h	(revision 987)
+++ src/lemon/concept/maps.h	(revision 989)
@@ -41,9 +41,26 @@
       typedef T Value;
 
+      // \bug Value don't need to be default constructible.
       /// Returns the value associated with a key.
-      Value operator[](const Key &k) const {return Value();}
+      Value operator[](const Key &) const {return Value();}
 
-      ///Default constructor
-      ReadMap() {}
+      template<typename _ReadMap>
+      struct Constraints {
+
+	void constraints() {
+	  Value val = m[key];
+	  val = m[key];
+	  typename _ReadMap::Value own_val = m[own_key]; 
+	  own_val = m[own_key]; 
+
+	  ignore_unused_variable_warning(val);
+	  ignore_unused_variable_warning(own_val);
+	  ignore_unused_variable_warning(key);
+	}
+	Key& key;
+	typename _ReadMap::Key& own_key;
+	_ReadMap& m;
+      };
+      
     };
 
@@ -64,4 +81,24 @@
       ///Default constructor
       WriteMap() {}
+
+      template <typename _WriteMap>
+      struct Constraints {
+	void constraints() {
+	  // No constraints for constructor.
+	  m.set(key, val);
+	  m.set(own_key, own_val);
+	  ignore_unused_variable(key);
+	  ignore_unused_variable(val);
+	  ignore_unused_variable(own_key);
+	  ignore_unused_variable(own_val);
+	}
+
+	Value& val;
+	typename _WriteMap::Value own_val;
+	Key& key;
+	typename _WriteMap::Key& own_key;
+	WriteMap& m;
+
+      };
     };
 
@@ -82,11 +119,16 @@
       void set(const Key &k,const Value &t) {}
 
-      ///Default constructor
-      ReadWriteMap() {}
+      template<typename _ReadWriteMap>
+      struct Constraints {
+	void constraints() {
+	  checkConcept<ReadMap<K, T>, _ReadWriteMap >();
+	  checkConcept<ReadMap<K, T>, _ReadWriteMap >();
+	}
+      };
     };
   
   
     ///Dereferable map concept
-    template<typename K, typename T>
+    template<typename K, typename T, typename R, typename CR>
     class ReferenceMap : public ReadWriteMap<K,T>
     {
@@ -96,11 +138,12 @@
       /// Map's value type. (The type of objects associated with the keys).
       typedef T Value;
+      /// Map's reference type.
+      typedef R Reference;
+      /// Map's const reference type.
+      typedef CR ConstReference;
 
     protected:
       Value tmp;
     public:
-      typedef Value& Reference;
-      /// Map's const reference type.
-      typedef const Value& ConstReference;
 
       ///Returns a reference to the value associated to a key.
@@ -112,131 +155,29 @@
       void set(const Key &k,const Value &t) { operator[](k)=t; }
 
-      ///Default constructor
-      ReferenceMap() {}
+      // \todo rethink this concept
+      template<typename _ReferenceMap>
+      struct ReferenceMapConcept {
+
+	void constraints() {
+	  checkConcept<ReadWriteMap, _ReferenceMap >();
+	  m[key] = val;
+	  val  = m[key];
+	  m[key] = ref;
+	  ref = m[key];
+	  m[own_key] = own_val;
+	  own_val  = m[own_key];
+	  m[own_key] = own_ref;
+	  own_ref = m[own_key];	  	  
+	}
+
+	typename _ReferenceMap::Key& own_key;
+	typename _ReferenceMap::Value& own_val;
+	typename _ReferenceMap::Reference& own_ref;
+	Key& key;
+	Value& val;
+	Reference& ref;
+	ReferenceMap& m;
+      };
     };
-
-
-    template<typename Item, typename T, typename Graph>
-    class GraphMap : public ReadWriteMap<Item, T> {
-      // I really, really don't like the idea that every graph should have
-      // reference maps! --klao
-
-    private:
-      // We state explicitly that graph maps have no default constructor?
-      GraphMap();
-
-    public:
-      explicit GraphMap(Graph const&) {}
-      // value for initializing
-      GraphMap(Graph const&, T) {}
-
-      // this probably should be required:
-      GraphMap(GraphMap const&) {}
-      GraphMap& operator=(GraphMap const&) { return *this; }
-
-      // but this is a absolute no-op! We should provide a more generic
-      // graph-map-copy operation.
-      //
-      // template<typename TT>
-      // GraphMap(GraphMap<TT> const&);
-      //
-      // template<typename TT>
-      // GraphMap& operator=(const GraphMap<TT>&);
-    };
-
-
-    /****************  Concept-checking classes  ****************/
-
-    template<typename ReadMap>
-    struct ReadMapConcept {
-      typedef typename ReadMap::Key Key;
-      typedef typename ReadMap::Value Value;
-
-      void constraints() {
-	// No constraints for constructor.
-
-	// What are the requirement for the Value?
-	// CopyConstructible? Assignable? None of these?
-	Value v = m[k];
-	v = m[k];
-
-	// FIXME:
-	ignore_unused_variable_warning(v);
-      }
-
-      ReadMap m;
-      Key k;
-    };
-
-    template<typename WriteMap>
-    struct WriteMapConcept {
-      typedef typename WriteMap::Key Key;
-      typedef typename WriteMap::Value Value;
-
-      void constraints() {
-	// No constraints for constructor.
-
-	m.set(k, v);
-      }
-
-      WriteMap m;
-      Key k;
-      Value v;
-    };
-
-    template<typename ReadWriteMap>
-    struct ReadWriteMapConcept {
-      void constraints() {
-	function_requires< ReadMapConcept<ReadWriteMap> >();
-	function_requires< WriteMapConcept<ReadWriteMap> >();
-      }
-    };
-
-    template<typename ReferenceMap>
-    struct ReferenceMapConcept {
-      typedef typename ReferenceMap::Key Key;
-      typedef typename ReferenceMap::Value Value;
-      typedef typename ReferenceMap::Reference Reference;
-
-      // What for is this?
-      typedef typename ReferenceMap::ConstReference ConstReference;
-
-      void constraints() {
-	function_requires< ReadWriteMapConcept<ReferenceMap> >();
-
-	m[k] = v;
-	// Or should we require real reference?
-	// Like this:
-	// Value &vv = m[k];
-	// ignore_unused_variable_warning(vv);
-      }
-
-      ReferenceMap m;
-      Key k;
-      Value v;
-    };
-
-    /// \todo GraphMapConceptCheck
-
-    template<typename GraphMap, typename Graph>
-    struct GraphMapConcept {
-      void constraints() {
-	function_requires< ReadWriteMapConcept<GraphMap> >();
-	// Construction with a graph parameter
-	GraphMap a(g);
-	// Ctor with a graph and a default value parameter
-	GraphMap a2(g,t);
-	// Copy ctor. Do we need it?
-	GraphMap b=c;
-	// Copy operator. Do we need it?
-	a=b;
-
-	ignore_unused_variable_warning(a2);
-      }
-      const GraphMap &c;
-      const Graph &g;
-      const typename GraphMap::Value &t;
-    };
-    
 
     // @}
