Changeset 3:272a5677bd6d in lemon0.x for src/include/bfs.h
 Timestamp:
 12/13/03 16:44:50 (20 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@15
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/include/bfs.h
r2 r3 39 39 40 40 41 // Nem jo! Osszeakad a masik Settel41 // Nem jo! Osszeakad a masik Puttel 42 42 // class do_nothing_map {}; 43 43 // template <typename V,typename T> 44 // void Set(const do_nothing_map &p,const V &v,const T &t) {}44 // void Put(const do_nothing_map &p,const V &v,const T &t) {} 45 45 46 46 struct do_nothing_map { 47 47 template <typename V,typename T> 48 static void Set(V v,T t) {}48 static void Put(V v,T t) {} 49 49 }; 50 50 … … 54 54 public: 55 55 typedef T value_type; 56 static void Set(const I &i, const T &t) {(*i).*M=t;}56 static void Put(const I &i, const T &t) {(*i).*M=t;} 57 57 static T Get(const I i) {return (*i).*M;} 58 58 T &operator[](I i) {return (*i).*M;} … … 61 61 /* 62 62 template <typename C,typename I,typename T, T C::*M> 63 void Set(class_element_map<C,T,M> p,I i, T t)63 void Put(class_element_map<C,T,M> p,I i, T t) 64 64 { 65 65 i>*M=t; … … 68 68 69 69 template <typename P,typename I,typename T> 70 inline void Set(P &p,const I &i, const T &t)71 { 72 p. Set(i,t);70 inline void Put(P &p,const I &i, const T &t) 71 { 72 p.Put(i,t); 73 73 }; 74 74 template <typename P,typename I> … … 126 126 bfs_node_data<G> NodeType::*d; 127 127 typedef bool value_type; 128 void Set(typename G::NodeIterator &i, const value_type &t)128 void Put(typename G::NodeIterator &i, const value_type &t) 129 129 {((*i).*d).visited=t;} 130 130 value_type Get(const typename G::NodeIterator &i) const … … 137 137 bfs_node_data<G> NodeType::*d; 138 138 typedef typename G::EdgeIterator value_type; 139 void Set(typename G::NodeIterator &i, const value_type &t)139 void Put(typename G::NodeIterator &i, const value_type &t) 140 140 {((*i).*d).tree=t;} 141 141 value_type Get(const typename G::NodeIterator &i) const … … 148 148 bfs_node_data<G> NodeType::*d; 149 149 typedef int value_type; 150 void Set(typename G::NodeIterator &i, const value_type &t)150 void Put(typename G::NodeIterator &i, const value_type &t) 151 151 {((*i).*d).dist=t;} 152 152 value_type Get(const typename G::NodeIterator &i) const … … 159 159 bfs_node_data<G> NodeType::*d; 160 160 typedef int value_type; 161 void Set(typename G::NodeIterator &i, const value_type &t)161 void Put(typename G::NodeIterator &i, const value_type &t) 162 162 {((*i).*d).priority=t;} 163 163 value_type Get(const typename G::NodeIterator &i) const … … 176 176 bfs_static_maps(const bfs_node_data<G> NodeType::*dd) 177 177 { 178 SetDataField(dd);178 PutDataField(dd); 179 179 } 180 180 … … 211 211 212 212 for(Gr.GetFirst(n);n.isValid();++n) 213 Set(maps.visited,n,false);213 Put(maps.visited,n,false); 214 214 215 215 queue<Q_T> Q; … … 218 218 q.dist=0; 219 219 Q.push(q); 220 Set(maps.visited,start_node,true);221 // Set(maps::tree,start_node,?????);222 Set(maps.dist,start_node,0);223 Set(maps.priority,start_node,pr++);220 Put(maps.visited,start_node,true); 221 // Put(maps::tree,start_node,?????); 222 Put(maps.dist,start_node,0); 223 Put(maps.priority,start_node,pr++); 224 224 225 225 do { … … 231 231 q.dist=d; 232 232 Q.push(q); 233 Set(maps.visited,m,true);234 Set(maps.tree,m,e);235 Set(maps.dist,m,d);236 Set(maps.priority,m,pr++);233 Put(maps.visited,m,true); 234 Put(maps.tree,m,e); 235 Put(maps.dist,m,d); 236 Put(maps.priority,m,pr++); 237 237 } 238 238 } while(!Q.empty());
Note: See TracChangeset
for help on using the changeset viewer.