COIN-OR::LEMON - Graph Library

Changeset 1709:a323456bf7c8 in lemon-0.x for lemon/dfs.h


Ignore:
Timestamp:
10/05/05 18:45:37 (19 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2236
Message:

Template Named Parameter bugfix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/dfs.h

    r1694 r1709  
    5858      return new PredMap(G);
    5959    }
    60 //     ///\brief The type of the map that stores the last but one
    61 //     ///nodes of the %DFS paths.
    62 //     ///
    63 //     ///The type of the map that stores the last but one
    64 //     ///nodes of the %DFS paths.
    65 //     ///It must meet the \ref concept::WriteMap "WriteMap" concept.
    66 //     ///
    67 //     typedef NullMap<typename Graph::Node,typename Graph::Node> PredNodeMap;
    68 //     ///Instantiates a PredNodeMap.
    69    
    70 //     ///This function instantiates a \ref PredNodeMap.
    71 //     ///\param G is the graph, to which
    72 //     ///we would like to define the \ref PredNodeMap
    73 //     static PredNodeMap *createPredNodeMap(const GR &G)
    74 //     {
    75 //       return new PredNodeMap();
    76 //     }
    7760
    7861    ///The type of the map that indicates which nodes are processed.
     
    180163    ///edges of the %DFS paths.
    181164    typedef typename TR::PredMap PredMap;
    182 //     ///\brief The type of the map that stores the last but one
    183 //     ///nodes of the %DFS paths.
    184 //     typedef typename TR::PredNodeMap PredNodeMap;
    185165    ///The type of the map indicating which nodes are reached.
    186166    typedef typename TR::ReachedMap ReachedMap;
     
    196176    ///Indicates if \ref _pred is locally allocated (\c true) or not.
    197177    bool local_pred;
    198 //     ///Pointer to the map of predecessors nodes.
    199 //     PredNodeMap *_predNode;
    200 //     ///Indicates if \ref _predNode is locally allocated (\c true) or not.
    201 //     bool local_predNode;
    202178    ///Pointer to the map of distances.
    203179    DistMap *_dist;
     
    215191    std::vector<typename Graph::OutEdgeIt> _stack;
    216192    int _stack_head;
    217 //     ///The source node of the last execution.
    218 //     Node source;
    219193
    220194    ///Creates the maps if necessary.
     
    228202        _pred = Traits::createPredMap(*G);
    229203      }
    230 //       if(!_predNode) {
    231 //      local_predNode = true;
    232 //      _predNode = Traits::createPredNodeMap(*G);
    233 //       }
    234204      if(!_dist) {
    235205        local_dist = true;
     
    247217   
    248218  public :
    249  
     219
     220    typedef Dfs Create;
     221
    250222    ///\name Named template parameters
    251223
     
    265237    ///
    266238    template <class T>
    267     class DefPredMap : public Dfs< Graph,
    268                                         DefPredMapTraits<T> > { };
    269    
    270 //     template <class T>
    271 //     struct DefPredNodeMapTraits : public Traits {
    272 //       typedef T PredNodeMap;
    273 //       static PredNodeMap *createPredNodeMap(const Graph &G)
    274 //       {
    275 //      throw UninitializedParameter();
    276 //       }
    277 //     };
    278 //     ///\ref named-templ-param "Named parameter" for setting PredNodeMap type
    279 
    280 //     ///\ref named-templ-param "Named parameter" for setting PredNodeMap type
    281 //     ///
    282 //     template <class T>
    283 //     class DefPredNodeMap : public Dfs< Graph,
    284 //                                          LengthMap,
    285 //                                          DefPredNodeMapTraits<T> > { };
     239    struct DefPredMap : public Dfs<Graph, DefPredMapTraits<T> > {
     240      typedef Dfs<Graph, DefPredMapTraits<T> > Create;
     241    };
     242   
    286243   
    287244    template <class T>
     
    298255    ///
    299256    template <class T>
    300     class DefDistMap : public Dfs< Graph,
    301                                    DefDistMapTraits<T> > { };
     257    struct DefDistMap {
     258      typedef Dfs<Graph, DefDistMapTraits<T> > Create;
     259    };
    302260   
    303261    template <class T>
     
    314272    ///
    315273    template <class T>
    316     class DefReachedMap : public Dfs< Graph,
    317                                       DefReachedMapTraits<T> > { };
    318    
    319     struct DefGraphReachedMapTraits : public Traits {
    320       typedef typename Graph::template NodeMap<bool> ReachedMap;
    321       static ReachedMap *createReachedMap(const Graph &G)
    322       {
    323         return new ReachedMap(G);
    324       }
    325     };
     274    struct DefReachedMap {
     275      typedef Dfs< Graph, DefReachedMapTraits<T> > Create;
     276    };
     277
    326278    template <class T>
    327279    struct DefProcessedMapTraits : public Traits {
     
    338290    template <class T>
    339291    struct DefProcessedMap : public Dfs< Graph, DefProcessedMapTraits<T> > {
    340       typedef Dfs< Graph, DefProcessedMapTraits<T> > Dfs;
     292      typedef Dfs< Graph, DefProcessedMapTraits<T> > Create;
    341293    };
    342294   
     
    356308    template <class T>
    357309    class DefProcessedMapToBeDefaultMap :
    358       public Dfs< Graph,
    359                   DefGraphProcessedMapTraits> { };
     310      public Dfs< Graph, DefGraphProcessedMapTraits> {
     311      typedef Dfs< Graph, DefGraphProcessedMapTraits> Create;
     312    };
    360313   
    361314    ///@}
Note: See TracChangeset for help on using the changeset viewer.