lemon/concept/maps.h
changeset 1746 874e4bc21435
parent 1435 8e85e6bbefdf
child 1875 98698b69a902
equal deleted inserted replaced
0:07b284d4d839 1:48b83ab68b23
    15  */
    15  */
    16 
    16 
    17 #ifndef LEMON_CONCEPT_MAPS_H
    17 #ifndef LEMON_CONCEPT_MAPS_H
    18 #define LEMON_CONCEPT_MAPS_H
    18 #define LEMON_CONCEPT_MAPS_H
    19 
    19 
       
    20 #include <lemon/utility.h>
    20 #include <lemon/concept_check.h>
    21 #include <lemon/concept_check.h>
    21 
    22 
    22 ///\ingroup concept
    23 ///\ingroup concept
    23 ///\file
    24 ///\file
    24 ///\brief Map concepts checking classes for testing and documenting.
    25 ///\brief Map concepts checking classes for testing and documenting.
    95 
    96 
    96 	Value& val;
    97 	Value& val;
    97 	typename _WriteMap::Value own_val;
    98 	typename _WriteMap::Value own_val;
    98 	Key& key;
    99 	Key& key;
    99 	typename _WriteMap::Key& own_key;
   100 	typename _WriteMap::Key& own_key;
   100 	WriteMap& m;
   101 	_WriteMap& m;
   101 
   102 
   102       };
   103       };
   103     };
   104     };
   104 
   105 
   105     ///Read/Writable map concept
   106     ///Read/Writable map concept
   120 
   121 
   121       template<typename _ReadWriteMap>
   122       template<typename _ReadWriteMap>
   122       struct Constraints {
   123       struct Constraints {
   123 	void constraints() {
   124 	void constraints() {
   124 	  checkConcept<ReadMap<K, T>, _ReadWriteMap >();
   125 	  checkConcept<ReadMap<K, T>, _ReadWriteMap >();
   125 	  checkConcept<ReadMap<K, T>, _ReadWriteMap >();
   126 	  checkConcept<WriteMap<K, T>, _ReadWriteMap >();
   126 	}
   127 	}
   127       };
   128       };
   128     };
   129     };
   129   
   130   
   130   
   131   
   131     ///Dereferable map concept
   132     ///Dereferable map concept
   132     template<typename K, typename T, typename R, typename CR>
   133     template<typename K, typename T, typename R, typename CR>
   133     class ReferenceMap : public ReadWriteMap<K,T>
   134     class ReferenceMap : public ReadWriteMap<K,T>
   134     {
   135     {
   135     public:
   136     public:
       
   137       /// Tag for reference maps.
       
   138       typedef True ReferenceMapTag;
   136       /// Map's key type.
   139       /// Map's key type.
   137       typedef K Key;    
   140       typedef K Key;    
   138       /// Map's value type. (The type of objects associated with the keys).
   141       /// Map's value type. (The type of objects associated with the keys).
   139       typedef T Value;
   142       typedef T Value;
   140       /// Map's reference type.
   143       /// Map's reference type.
   174 	typename _ReferenceMap::Value& own_val;
   177 	typename _ReferenceMap::Value& own_val;
   175 	typename _ReferenceMap::Reference& own_ref;
   178 	typename _ReferenceMap::Reference& own_ref;
   176 	Key& key;
   179 	Key& key;
   177 	Value& val;
   180 	Value& val;
   178 	Reference& ref;
   181 	Reference& ref;
   179 	ReferenceMap& m;
   182 	_ReferenceMap& m;
   180       };
   183       };
   181     };
   184     };
   182 
   185 
   183     // @}
   186     // @}
   184 
   187