kruskal.h: an overloaded function for older, pointer-style iterators
authorklao
Thu, 02 Feb 2006 13:43:01 +0000
changeset 194208834607d4db
parent 1941 9fe177e0437d
child 1943 7349b09373a0
kruskal.h: an overloaded function for older, pointer-style iterators
lemon/kruskal.h
     1.1 --- a/lemon/kruskal.h	Thu Feb 02 08:52:20 2006 +0000
     1.2 +++ b/lemon/kruskal.h	Thu Feb 02 13:43:01 2006 +0000
     1.3 @@ -18,8 +18,9 @@
     1.4  #define LEMON_KRUSKAL_H
     1.5  
     1.6  #include <algorithm>
     1.7 +#include <vector>
     1.8  #include <lemon/unionfind.h>
     1.9 -#include<lemon/utility.h>
    1.10 +#include <lemon/utility.h>
    1.11  
    1.12  /**
    1.13  @defgroup spantree Minimum Cost Spanning Tree Algorithms
    1.14 @@ -315,7 +316,7 @@
    1.15      mutable Iterator it;
    1.16  
    1.17    public:
    1.18 -    typedef typename Iterator::value_type Key;
    1.19 +    typedef typename std::iterator_traits<Iterator>::value_type Key;
    1.20      typedef bool Value;
    1.21  
    1.22      KruskalSequenceOutput(Iterator const &_it) : it(_it) {}
    1.23 @@ -415,8 +416,6 @@
    1.24    kruskal(const GR& g,
    1.25  	  const IN& in,
    1.26  	  RET out,
    1.27 -	  //,typename RET::value_type = typename GR::Edge()
    1.28 -	  //,typename RET::value_type = typename RET::value_type()
    1.29  	  const typename RET::value_type * = 
    1.30  	  (const typename RET::value_type *)(0)
    1.31  	  )
    1.32 @@ -425,6 +424,18 @@
    1.33      return kruskal(g, KruskalMapInput<GR,IN>(g, in), _out);
    1.34    }
    1.35   
    1.36 +  template <class GR, class IN, class RET>
    1.37 +  inline
    1.38 +  typename IN::Value
    1.39 +  kruskal(const GR& g,
    1.40 +	  const IN& in,
    1.41 +	  RET *out
    1.42 +	  )
    1.43 +  {
    1.44 +    KruskalSequenceOutput<RET*> _out(out);
    1.45 +    return kruskal(g, KruskalMapInput<GR,IN>(g, in), _out);
    1.46 +  }
    1.47 + 
    1.48    /// @}
    1.49  
    1.50  } //namespace lemon