gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Removed ConstMap::rebind and StdMap::rebind + doc improvements.
0 1 0
default
1 file changed with 4 insertions and 13 deletions:
↑ Collapse diff ↑
Show white space 24 line context
... ...
@@ -106,29 +106,24 @@
106 106
    /// \param _v is the initial value of the map.
107 107
    ConstMap(const T &_v) : v(_v) {}
108 108
    
109 109
    ///\e
110 110
    T operator[](const K&) const { return v; }
111 111

	
112 112
    ///\e
113 113
    void setAll(const T &t) {
114 114
      v = t;
115 115
    }    
116 116

	
117 117
    template<typename T1>
118
    struct rebind {
119
      typedef ConstMap<K, T1> other;
120
    };
121

	
122
    template<typename T1>
123 118
    ConstMap(const ConstMap<K, T1> &, const T &_v) : v(_v) {}
124 119
  };
125 120

	
126 121
  ///Returns a \c ConstMap class
127 122

	
128 123
  ///This function just returns a \c ConstMap class.
129 124
  ///\relates ConstMap
130 125
  template<typename K, typename V> 
131 126
  inline ConstMap<K, V> constMap(const V &v) {
132 127
    return ConstMap<K, V>(v);
133 128
  }
134 129

	
... ...
@@ -234,28 +229,24 @@
234 229
      if (it != _map.end() && !_map.key_comp()(k, it->first))
235 230
	it->second = t;
236 231
      else
237 232
	_map.insert(it, std::make_pair(k, t));
238 233
    }
239 234

	
240 235
    /// \e
241 236
    void setAll(const T &t) {
242 237
      _value = t;
243 238
      _map.clear();
244 239
    }    
245 240

	
246
    template <typename T1, typename C1 = std::less<T1> >
247
    struct rebind {
248
      typedef StdMap<Key, T1, C1> other;
249
    };
250 241
  };
251 242

	
252 243
  /// \brief Map for storing values for keys from the range <tt>[0..size-1]</tt>
253 244
  ///
254 245
  /// The current map has the <tt>[0..size-1]</tt> keyset and the values
255 246
  /// are stored in a \c std::vector<T>  container. It can be used with
256 247
  /// some data structures, for example \c UnionFind, \c BinHeap, when 
257 248
  /// the used items are small integer numbers. 
258 249
  ///
259 250
  /// \todo Revise its name
260 251
  template <typename T>
261 252
  class IntegerMap {
... ...
@@ -383,50 +374,50 @@
383 374
  
384 375
  ///Returns a \c ConvertMap class
385 376

	
386 377
  ///This function just returns a \c ConvertMap class.
387 378
  ///\relates ConvertMap
388 379
  template<typename T, typename M>
389 380
  inline ConvertMap<M, T> convertMap(const M &m) {
390 381
    return ConvertMap<M, T>(m);
391 382
  }
392 383

	
393 384
  ///Simple wrapping of a map
394 385

	
395
  ///This \c concepts::ReadMap "read only map" returns the simple
386
  ///This \ref concepts::ReadMap "read only map" returns the simple
396 387
  ///wrapping of the given map. Sometimes the reference maps cannot be
397 388
  ///combined with simple read maps. This map adaptor wraps the given
398 389
  ///map to simple read map.
399 390
  ///
400 391
  ///\sa SimpleWriteMap
401 392
  ///
402 393
  /// \todo Revise the misleading name 
403 394
  template<typename M> 
404 395
  class SimpleMap : public MapBase<typename M::Key, typename M::Value> {
405 396
    const M& m;
406 397

	
407 398
  public:
408 399
    typedef MapBase<typename M::Key, typename M::Value> Parent;
409 400
    typedef typename Parent::Key Key;
410 401
    typedef typename Parent::Value Value;
411 402

	
412 403
    ///Constructor
413 404
    SimpleMap(const M &_m) : m(_m) {};
414 405
    ///\e
415 406
    Value operator[](Key k) const {return m[k];}
416 407
  };
417 408

	
418
  ///Simple writable wrapping of the map
409
  ///Simple writable wrapping of a map
419 410

	
420
  ///This \c concepts::WriteMap "write map" returns the simple
411
  ///This \ref concepts::WriteMap "write map" returns the simple
421 412
  ///wrapping of the given map. Sometimes the reference maps cannot be
422 413
  ///combined with simple read-write maps. This map adaptor wraps the
423 414
  ///given map to simple read-write map.
424 415
  ///
425 416
  ///\sa SimpleMap
426 417
  ///
427 418
  /// \todo Revise the misleading name
428 419
  template<typename M> 
429 420
  class SimpleWriteMap : public MapBase<typename M::Key, typename M::Value> {
430 421
    M& m;
431 422

	
432 423
  public:
... ...
@@ -1544,25 +1535,25 @@
1544 1535
    typedef typename Map::Key Key;
1545 1536
    typedef bool Value;
1546 1537

	
1547 1538
    /// Constructor
1548 1539
    SettingOrderBoolMap(Map& _map) 
1549 1540
      : map(_map), counter(0) {}
1550 1541

	
1551 1542
    /// Number of set operations.
1552 1543
    int num() const {
1553 1544
      return counter;
1554 1545
    }
1555 1546

	
1556
    /// Setter function of the map
1547
    /// The \c set function of the map
1557 1548
    void set(const Key& key, Value value) {
1558 1549
      if (value) {
1559 1550
	map.set(key, counter++);
1560 1551
      }
1561 1552
    }
1562 1553
    
1563 1554
  private:
1564 1555
    Map& map;
1565 1556
    int counter;
1566 1557
  };
1567 1558

	
1568 1559
  /// @}
0 comments (0 inline)