Boost logo

Boost Users :

From: stas_fomin (stas_fomin_at_[hidden])
Date: 2002-06-18 11:30:49


 Hello.
 I a newbie in BGL and I rewrite my LEDA code now...

 I have to sort (order) edges according to some functor.

For example (simplified):

typedef adjacency_list<vecS, vecS, bidirectionalS> MyGraph;
typedef graph_traits < MyGraph >::edge_descriptor MyGraphEdge;
typedef graph_traits < MyGraph >::edge_iterator MyEdgeIter;

class MyCompareEdges{
        public:
    bool operator()(MyGraphEdge e1, MyGraphEdge e2) const
        {
                  return true;
        }
};

....

        {
                MyGraph Gr(10);
                MyEdgeIter ei_beg, ei_end;
                MyCompareEdges comp;
                tie(ei_beg, ei_end) = edges(Gr);
                std::sort(ei_beg, ei_end, comp); //Error C2676
        }

And I have error C2676 (below the message...).

Questions:
   1. Is it possible to sort edges in the graph?
   2. How to...

         
      Thanks all in advance...
        Stas Fomin.

P.S.
   vecS, setS, listS for edge container... - C2676.

------------------------------
d:\projects\lib\cpp_libs\libboost\boost\iterator_adaptors.hpp(264) :
error C2676: binary '+=' : 'class std::list<struct
boost::list_edge<unsigned int,struct boost::no_property>,class
std::allocator<struct boost::list_edge<unsigned int,struct boost::
no_property> > >::iterator' does not define this operator or a
conversion to a type acceptable to the predefined operator
        d:\projects\lib\cpp_libs\libboost\boost\iterator_adaptors.hpp
(911) : see reference to function template instantiation 'void
__thiscall boost::default_iterator_policies::advance(struct
boost::iterator_adaptor<class std::list<struct boost::lis
t_edge<unsigned int,struct boost::no_property>,class
std::allocator<struct boost::list_edge<unsigned int,struct
boost::no_property> > >::iterator,struct
boost::detail::undirected_edge_iter_policies,class
boost::detail::edge_desc_impl<struct boost::b
idirectional_tag,unsigned int>,class
boost::detail::edge_desc_impl<struct
boost::bidirectional_tag,unsigned int>,class
boost::detail::edge_desc_impl<struct
boost::bidirectional_tag,unsigned int> *,struct
boost::multi_pass_input_iterator_tag,int> &,i
nt)' being compiled
Error executing cl.exe.

 


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