On Thu, 7 Sep 2006, Eric Fowler wrote:
How do I declare a graph that does not allow parallel edges?
I have come up with this but IMO it is sort of, well, kludgey:
typedef adjacency_list
Graph; This works because std::set does not like multiple entries.
But what if for performance reasons (say) I want a listS or vecS instead of setS?
In adjacency_list.hpp I find: template <> struct parallel_edge_traits<setS> { typedef disallow_parallel_edge_tag type; };
Which suggest the existence of a more elegant mechanism.
Anybody know what that is?
You could write a wrapper around std::vector or std::list that enforces unicity of it's elements, create a tag (e.g. my_tagS) for it and then a few thins like this: struct my_tagS {} ; template < typename ValueType > class my_container { // ... } ; namespace boost { template < typename ValueType > struct container_gen< my_tagS , ValueType > { typedef my_container< ValueType > type ; } ; template <> struct parallel_edge_traits< my_tagS > { typedef disallow_parallel_edge_tag type ; } ; } I have never tried it, though, so no guaranty it will work out. -- François Duranleau LIGUM, Université de Montréal "Any sufficiently advanced technology is indistinguishable from magic" - Arthur C. Clarke _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users