Boost logo

Boost Users :

From: Thomas Costa (oohrah_at_[hidden])
Date: 2006-04-20 23:26:19


write your own total ordering/comparison function object for Edge
objects and declare the map type using this function.

On Apr 20, 2006, at 7:55 PM, Irek Szczesniak wrote:

> I'm trying to have a std::map where the key is an edge of a graph, but
> I get a compilation error. My graph is:
>
> typedef boost::adjacency_list <vecS, vecS, undirectedS,
> property<vertex_name_t, std::string>,
> property<edge_weight_t, int,
> property<edge_weight2_t, int> > > Graph;
>
> And an edge:
>
> typedef graph_traits<Graph>::edge_descriptor Edge;
>
> Then I have a map:
>
> std::map<Edge, double> m;
>
> But when I try this:
>
> m[e] = 0
>
> where e is of type Edge, then I get:
>
> /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/
> bits/stl_function.h:227:
> error: no match for 'operator<' in '__x < __y'
>
> Can I use map with the Edge as the key type? If so, what should I do?
>
> Thanks for reading.
>
>
> Best,
> Irek
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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