Boost logo

Boost :

From: Joel Young (jdy_at_[hidden])
Date: 2001-04-20 13:15:07


Does anyone see what is wrong with this?

  template <class Property_T, class EdgeIter, class Graph>
  void links_to(EdgeIter first,
                EdgeIter last,
                const Graph& G,
                std::ostream& p_out) {

    typedef typename
      boost::property_map<Graph, Property_T>::const_type ValueMap;
    typedef typename
      boost::property_traits<ValueMap>::value_type ValueType;

    typedef typename
      boost::property_kind<Property_T>::type property_tag;

    // Access the property accessor type for this graph
    const ValueMap& name = boost::get(property_tag,G);
    
// This used to work in 1.18.0
// const ValueMap& name(
// boost::get(
// (Property_T)boost::property_num<Property_T>::value,G));

    while (first != last) {
      const ValueType& src_name = boost::get(name, source(*first, G));
      const ValueType& trg_name = boost::get(name, target(*first, G));
      p_out << src_name << " ----> "
            << trg_name << endl;
      ++first;
    }
  }

It gives:
file.h: In function `void links_to(EdgeIter, EdgeIter, const Graph&,
   ostream&)':
file.h:22: parse error before `,' token
file.h:22: declaration of `G' shadows a parameter

with gcc 3.1 (20010417) and gcc 2.95.2

Joel
jdy_at_[hidden]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk