lemon/bits/array_map.h
changeset 2386 81b47fc5c444
parent 2384 805c5a2a36dd
child 2391 14a343be7a5a
     1.1 --- a/lemon/bits/array_map.h	Fri Mar 02 17:56:22 2007 +0000
     1.2 +++ b/lemon/bits/array_map.h	Fri Mar 02 18:04:28 2007 +0000
     1.3 @@ -81,10 +81,10 @@
     1.4      explicit ArrayMap(const Graph& graph) {
     1.5        Parent::attach(graph.notifier(Item()));
     1.6        allocate_memory();
     1.7 -      Notifier* notifier = Parent::notifier();
     1.8 +      Notifier* nf = Parent::notifier();
     1.9        Item it;
    1.10 -      for (notifier->first(it); it != INVALID; notifier->next(it)) {
    1.11 -	int id = notifier->id(it);;
    1.12 +      for (nf->first(it); it != INVALID; nf->next(it)) {
    1.13 +	int id = nf->id(it);;
    1.14  	allocator.construct(&(values[id]), Value());
    1.15        }								
    1.16      }
    1.17 @@ -95,10 +95,10 @@
    1.18      ArrayMap(const Graph& graph, const Value& value) {
    1.19        Parent::attach(graph.notifier(Item()));
    1.20        allocate_memory();
    1.21 -      Notifier* notifier = Parent::notifier();
    1.22 +      Notifier* nf = Parent::notifier();
    1.23        Item it;
    1.24 -      for (notifier->first(it); it != INVALID; notifier->next(it)) {
    1.25 -	int id = notifier->id(it);;
    1.26 +      for (nf->first(it); it != INVALID; nf->next(it)) {
    1.27 +	int id = nf->id(it);;
    1.28  	allocator.construct(&(values[id]), value);
    1.29        }								
    1.30      }
    1.31 @@ -113,10 +113,10 @@
    1.32        capacity = copy.capacity;
    1.33        if (capacity == 0) return;
    1.34        values = allocator.allocate(capacity);
    1.35 -      Notifier* notifier = Parent::notifier();
    1.36 +      Notifier* nf = Parent::notifier();
    1.37        Item it;
    1.38 -      for (notifier->first(it); it != INVALID; notifier->next(it)) {
    1.39 -	int id = notifier->id(it);;
    1.40 +      for (nf->first(it); it != INVALID; nf->next(it)) {
    1.41 +	int id = nf->id(it);;
    1.42  	allocator.construct(&(values[id]), copy.values[id]);
    1.43        }
    1.44      }
    1.45 @@ -142,9 +142,9 @@
    1.46      template <typename CMap>
    1.47      ArrayMap& operator=(const CMap& cmap) {
    1.48        checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
    1.49 -      const typename Parent::Notifier* notifier = Parent::notifier();
    1.50 +      const typename Parent::Notifier* nf = Parent::notifier();
    1.51        Item it;
    1.52 -      for (notifier->first(it); it != INVALID; notifier->next(it)) {
    1.53 +      for (nf->first(it); it != INVALID; nf->next(it)) {
    1.54          set(it, cmap[it]);
    1.55        }
    1.56        return *this;
    1.57 @@ -201,8 +201,8 @@
    1.58      /// It adds a new key to the map. It called by the observer notifier
    1.59      /// and it overrides the add() member function of the observer base.     
    1.60      virtual void add(const Key& key) {
    1.61 -      Notifier* notifier = Parent::notifier();
    1.62 -      int id = notifier->id(key);
    1.63 +      Notifier* nf = Parent::notifier();
    1.64 +      int id = nf->id(key);
    1.65        if (id >= capacity) {
    1.66  	int new_capacity = (capacity == 0 ? 1 : capacity);
    1.67  	while (new_capacity <= id) {
    1.68 @@ -210,8 +210,8 @@
    1.69  	}
    1.70  	Value* new_values = allocator.allocate(new_capacity);
    1.71  	Item it;
    1.72 -	for (notifier->first(it); it != INVALID; notifier->next(it)) {
    1.73 -	  int jd = notifier->id(it);;
    1.74 +	for (nf->first(it); it != INVALID; nf->next(it)) {
    1.75 +	  int jd = nf->id(it);;
    1.76  	  if (id != jd) {
    1.77  	    allocator.construct(&(new_values[jd]), values[jd]);
    1.78  	    allocator.destroy(&(values[jd]));
    1.79 @@ -229,10 +229,10 @@
    1.80      /// It adds more new keys to the map. It called by the observer notifier
    1.81      /// and it overrides the add() member function of the observer base.     
    1.82      virtual void add(const std::vector<Key>& keys) {
    1.83 -      Notifier* notifier = Parent::notifier();
    1.84 +      Notifier* nf = Parent::notifier();
    1.85        int max_id = -1;
    1.86 -      for (int i = 0; i < (int)keys.size(); ++i) {
    1.87 -	int id = notifier->id(keys[i]);
    1.88 +      for (int i = 0; i < int(keys.size()); ++i) {
    1.89 +	int id = nf->id(keys[i]);
    1.90  	if (id > max_id) {
    1.91  	  max_id = id;
    1.92  	}
    1.93 @@ -244,11 +244,11 @@
    1.94  	}
    1.95  	Value* new_values = allocator.allocate(new_capacity);
    1.96  	Item it;
    1.97 -	for (notifier->first(it); it != INVALID; notifier->next(it)) {
    1.98 -	  int id = notifier->id(it);
    1.99 +	for (nf->first(it); it != INVALID; nf->next(it)) {
   1.100 +	  int id = nf->id(it);
   1.101  	  bool found = false;
   1.102 -	  for (int i = 0; i < (int)keys.size(); ++i) {
   1.103 -	    int jd = notifier->id(keys[i]);
   1.104 +	  for (int i = 0; i < int(keys.size()); ++i) {
   1.105 +	    int jd = nf->id(keys[i]);
   1.106  	    if (id == jd) {
   1.107  	      found = true;
   1.108  	      break;
   1.109 @@ -262,8 +262,8 @@
   1.110  	values = new_values;
   1.111  	capacity = new_capacity;
   1.112        }
   1.113 -      for (int i = 0; i < (int)keys.size(); ++i) {
   1.114 -	int id = notifier->id(keys[i]);
   1.115 +      for (int i = 0; i < int(keys.size()); ++i) {
   1.116 +	int id = nf->id(keys[i]);
   1.117  	allocator.construct(&(values[id]), Value());
   1.118        }
   1.119      }
   1.120 @@ -282,7 +282,7 @@
   1.121      /// Erase more keys from the map. It called by the observer notifier
   1.122      /// and it overrides the erase() member function of the observer base.     
   1.123      virtual void erase(const std::vector<Key>& keys) {
   1.124 -      for (int i = 0; i < (int)keys.size(); ++i) {
   1.125 +      for (int i = 0; i < int(keys.size()); ++i) {
   1.126  	int id = Parent::notifier()->id(keys[i]);
   1.127  	allocator.destroy(&(values[id]));
   1.128        }
   1.129 @@ -293,11 +293,11 @@
   1.130      /// It buildes the map. It called by the observer notifier
   1.131      /// and it overrides the build() member function of the observer base. 
   1.132      virtual void build() {
   1.133 -      Notifier* notifier = Parent::notifier();
   1.134 +      Notifier* nf = Parent::notifier();
   1.135        allocate_memory();
   1.136        Item it;
   1.137 -      for (notifier->first(it); it != INVALID; notifier->next(it)) {
   1.138 -	int id = notifier->id(it);;
   1.139 +      for (nf->first(it); it != INVALID; nf->next(it)) {
   1.140 +	int id = nf->id(it);;
   1.141  	allocator.construct(&(values[id]), Value());
   1.142        }								
   1.143      }
   1.144 @@ -307,11 +307,11 @@
   1.145      /// It erase all items from the map. It called by the observer notifier
   1.146      /// and it overrides the clear() member function of the observer base.     
   1.147      virtual void clear() {	
   1.148 -      Notifier* notifier = Parent::notifier();
   1.149 +      Notifier* nf = Parent::notifier();
   1.150        if (capacity != 0) {
   1.151  	Item it;
   1.152 -	for (notifier->first(it); it != INVALID; notifier->next(it)) {
   1.153 -	  int id = notifier->id(it);
   1.154 +	for (nf->first(it); it != INVALID; nf->next(it)) {
   1.155 +	  int id = nf->id(it);
   1.156  	  allocator.destroy(&(values[id]));
   1.157  	}								
   1.158  	allocator.deallocate(values, capacity);