Changeset 362:6c2e8a1f380a in lemon0.x for src/work/klao/iter_map.h
 Timestamp:
 04/21/04 18:09:42 (20 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@490
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/klao/iter_map.h
r361 r362 56 56 half_swap(a, bounds[m]++); 57 57 } 58 // FIXME: range check ide? 58 59 while(m < n) { 59 60 half_swap(a, bounds[m]); … … 80 81 81 82 void set(const KeyType& k, Val n) { 82 // FIXME: n < N ???83 // FIXME: range check? 83 84 size_t a = base[k]; 84 if(a < bounds[N1] && n < N) {85 if(a < bounds[N1]) { 85 86 base.set(k, move(a, find(a), n)); 87 } 88 else { 89 insert(k, n); 86 90 } 87 91 } 88 92 89 93 void insert(const KeyType& k, Val n) { 90 if(n < N) { 91 data.push_back(k); 92 base.set(k, move(bounds[N1]++, N1, n)); 93 } 94 data.push_back(k); 95 base.set(k, move(bounds[N1]++, N1, n)); 94 96 } 95 97 96 98 iterator begin(Val n) const { 97 if(n < N) 98 return data.begin() + (n ? bounds[n1] : 0); 99 else 100 return data.end(); 99 return data.begin() + (n ? bounds[n1] : 0); 101 100 } 102 101 103 102 iterator end(Val n) const { 104 if(n < N) 105 return data.begin() + bounds[n]; 106 else 107 return data.end(); 103 return data.begin() + bounds[n]; 108 104 } 109 105 110 106 size_t size(Val n) const { 111 if(n < N) 112 return bounds[n]  (n ? bounds[n1] : 0); 113 else 114 return 0; 107 return bounds[n]  (n ? bounds[n1] : 0); 115 108 } 116 109
Note: See TracChangeset
for help on using the changeset viewer.