src/hugo/smart_graph.h
changeset 656 9971eb8bfbe8
parent 579 859f8c7e2a40
child 706 0fe42b8ec5a6
equal deleted inserted replaced
2:fab3528026ae 3:56fd5a08a117
    61       friend class SmartGraph;
    61       friend class SmartGraph;
    62     };
    62     };
    63     
    63     
    64   public:
    64   public:
    65     template <typename T> class EdgeMap;
    65     template <typename T> class EdgeMap;
    66     template <typename T> class EdgeMap;
    66     template <typename T> class NodeMap;
    67 
    67 
    68     class Node;
    68     class Node;
    69     class Edge;
    69     class Edge;
    70 
    70 
    71     //  protected:
    71     //  protected:
   305       }
   305       }
   306 
   306 
   307       template<typename TT> friend class NodeMap;
   307       template<typename TT> friend class NodeMap;
   308  
   308  
   309       ///\todo It can copy between different types.
   309       ///\todo It can copy between different types.
   310       ///
   310       ///\todo We could use 'copy'
   311       template<typename TT> NodeMap(const NodeMap<TT> &m) :
   311       template<typename TT> NodeMap(const NodeMap<TT> &m) :
   312 	DynMapBase<Node>(*m.G)
   312 	DynMapBase<Node>(*m.G), container(m.container.size())
   313       {
   313       {
   314 	G->dyn_node_maps.push_back(this);
   314 	G->dyn_node_maps.push_back(this);
   315 	typename std::vector<TT>::const_iterator i;
   315 	typename std::vector<TT>::const_iterator i;
   316 	for(typename std::vector<TT>::const_iterator i=m.container.begin();
   316 	for(typename std::vector<TT>::const_iterator i=m.container.begin();
   317 	    i!=m.container.end();
   317 	    i!=m.container.end();
   396       }
   396       }
   397 
   397 
   398       template<typename TT> friend class EdgeMap;
   398       template<typename TT> friend class EdgeMap;
   399 
   399 
   400       ///\todo It can copy between different types.
   400       ///\todo It can copy between different types.
   401       ///
   401       template<typename TT> EdgeMap(const EdgeMap<TT> &m)
   402       template<typename TT> EdgeMap(const EdgeMap<TT> &m) :
   402 	: DynMapBase<Edge>(*m.G), container(m.container.size())
   403 	DynMapBase<Edge>(*m.G)
       
   404       {
   403       {
   405 	G->dyn_edge_maps.push_back(this);
   404 	G->dyn_edge_maps.push_back(this);
   406 	typename std::vector<TT>::const_iterator i;
   405 	typename std::vector<TT>::const_iterator i;
   407 	for(typename std::vector<TT>::const_iterator i=m.container.begin();
   406 	for(typename std::vector<TT>::const_iterator i=m.container.begin();
   408 	    i!=m.container.end();
   407 	    i!=m.container.end();
   539       //      template<typename TT> friend class SymEdgeMap;
   538       //      template<typename TT> friend class SymEdgeMap;
   540 
   539 
   541       ///\todo It can copy between different types.
   540       ///\todo It can copy between different types.
   542       ///
   541       ///
   543 
   542 
   544       template<typename TT> SymEdgeMap(const SymEdgeMap<TT> &m) :
   543       template<typename TT> SymEdgeMap(const SymEdgeMap<TT> &m)
   545 	DynMapBase<SymEdge>(*m.G)
   544 	: DynMapBase<SymEdge>(*m.G), container(m.container.size())
   546       {
   545       {
   547 	G->dyn_node_maps.push_back(this);
   546 	G->dyn_node_maps.push_back(this);
   548 	typename std::vector<TT>::const_iterator i;
   547 	typename std::vector<TT>::const_iterator i;
   549 	for(typename std::vector<TT>::const_iterator i=m.container.begin();
   548 	for(typename std::vector<TT>::const_iterator i=m.container.begin();
   550 	    i!=m.container.end();
   549 	    i!=m.container.end();
   611 } //namespace hugo
   610 } //namespace hugo
   612 
   611 
   613 
   612 
   614 
   613 
   615 
   614 
   616 #endif //SMART_GRAPH_H
   615 #endif //HUGO_SMART_GRAPH_H