Boost logo

Boost Users :

From: moritz Hilger (moritz.hilger_at_[hidden])
Date: 2006-07-26 09:26:13


hi,
i hava a problem using bundled properties with filtered graph. i've modified
the example from the filtered-graph page (
http://www.boost.org/libs/graph/doc/filtered_graph.html) to use edge
properties and woul like to create a filter using these bundled properties,
but am experiencing problems with the types of the property_map and/or
filter. since i'm quite new to c++ and boost i would aprectiate any
suggestin, thanks in advance
i'm using gcc-3.3.5 and boost-1.34
moritz

modified code:

struct myEdge {
        int id;
        int weight;
};

template <typename EdgeWeightMap>
struct positive_edge_weight {
  positive_edge_weight() { }
  positive_edge_weight(EdgeWeightMap weight) : m_weight(weight) { }
  template <typename Edge>
  bool operator()(const Edge& e) const {
    return 0 < boost::get(m_weight, e);
  }
  EdgeWeightMap m_weight;
};

int main()
{
  using namespace boost;

  typedef adjacency_list<vecS, vecS, directedS,
    //no_property, property<edge_weight_t, int> > Graph;
    no_property, myEdge > Graph;
  typedef property_map<Graph, int myEdge::*>::type EdgeWeightMap;
  typedef graph_traits<Graph>::edge_iterator edge_iter_t;

  typedef filtered_graph<Graph,positive_edge_weight<EdgeWeightMap> >
f_graph_t;

  typedef graph_traits<Graph>::edge_descriptor Edge;

  enum { A, B, C, D, E, N };
  const char* name = "ABCDE";
  Graph g(N);
  Edge e;
  bool ins;

  tie(e,ins)=add_edge(A, B, g);
/.../

  positive_edge_weight<EdgeWeightMap> filter(get(&myEdge::weight, g));
  f_graph_t fg(g, filter);

  std::cout << "filtered edge set: ";
  print_edges(fg, name);

  std::cout << "filtered out-edges:" << std::endl;
  print_graph(fg, name);

  return 0;
}

g++ output:

error: no matching function for call to `
   boost::bundle_property_map<main()::Graph,
   boost::detail::edge_desc_impl<boost::directed_tag, size_t>, myEdge,
int>::
   bundle_property_map()'
/homes/combi/Software/Boost/boost/graph/properties.hpp:330: error:
candidates
   are: boost::bundle_property_map<main()::Graph,
   boost::detail::edge_desc_impl<boost::directed_tag, size_t>, myEdge,
   int>::bundle_property_map(const boost::bundle_property_map<main()::Graph,

   boost::detail::edge_desc_impl<boost::directed_tag, size_t>, myEdge,
int>&)
/homes/combi/Software/Boost/boost/graph/properties.hpp:336:
error:
      boost::bundle_property_map<Graph, Descriptor, Bundle,
   T>::bundle_property_map(Graph*, T Bundle::*) [with Graph = main()::Graph,

   Descriptor = boost::detail::edge_desc_impl<boost::directed_tag, size_t>,
   Bundle = myEdge, T = int]

-- 
/* ICQ 291996214 */
/* MSN moritz.hilger_at_[hidden] */
/* moe1234_at_[hidden] */
/* del.icio.us/new/moritz.hilger */


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net