lemon/maps.h
changeset 143 c3b45bb643b0
parent 104 cdbba181b786
child 159 c7d30f7810e5
equal deleted inserted replaced
18:aa8a72f2780f 19:3ccafee98600
   114     ConstMap() {}
   114     ConstMap() {}
   115 
   115 
   116     /// Constructor with specified initial value
   116     /// Constructor with specified initial value
   117 
   117 
   118     /// Constructor with specified initial value.
   118     /// Constructor with specified initial value.
   119     /// \param v is the initial value of the map.
   119     /// \param v The initial value of the map.
   120     ConstMap(const Value &v) : _value(v) {}
   120     ConstMap(const Value &v) : _value(v) {}
   121 
   121 
   122     /// Gives back the specified value.
   122     /// Gives back the specified value.
   123     Value operator[](const Key&) const { return _value; }
   123     Value operator[](const Key&) const { return _value; }
   124 
   124 
   139   /// This function just returns a \ref ConstMap class.
   139   /// This function just returns a \ref ConstMap class.
   140   /// \relates ConstMap
   140   /// \relates ConstMap
   141   template<typename K, typename V>
   141   template<typename K, typename V>
   142   inline ConstMap<K, V> constMap(const V &v) {
   142   inline ConstMap<K, V> constMap(const V &v) {
   143     return ConstMap<K, V>(v);
   143     return ConstMap<K, V>(v);
       
   144   }
       
   145 
       
   146   template<typename K, typename V>
       
   147   inline ConstMap<K, V> constMap() {
       
   148     return ConstMap<K, V>();
   144   }
   149   }
   145 
   150 
   146 
   151 
   147   template<typename T, T v>
   152   template<typename T, T v>
   148   struct Const {};
   153   struct Const {};
   611   /// \sa MapToFunctor
   616   /// \sa MapToFunctor
   612   template<typename F,
   617   template<typename F,
   613 	   typename K = typename F::argument_type,
   618 	   typename K = typename F::argument_type,
   614 	   typename V = typename F::result_type>
   619 	   typename V = typename F::result_type>
   615   class FunctorToMap : public MapBase<K, V> {
   620   class FunctorToMap : public MapBase<K, V> {
   616     const F &_f;
   621     F _f;
   617   public:
   622   public:
   618     typedef MapBase<K, V> Parent;
   623     typedef MapBase<K, V> Parent;
   619     typedef typename Parent::Key Key;
   624     typedef typename Parent::Key Key;
   620     typedef typename Parent::Value Value;
   625     typedef typename Parent::Value Value;
   621 
   626