[Graph] const safety in edge_list_impl::edge_iterator

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Graph] const safety in edge_list_impl::edge_iterator

Boost - Users mailing list
Hello,

I am wondering if there is a particular reason why the == and !=
operators for edge_list_impl::edge_iterator (defined in
boost/graph/edge_list.hpp) are not marked const:

// The implementation class for edge_list.
template <class G, class EdgeIter, class T, class D>
class edge_list_impl
{
public:
...
  struct edge_iterator
  {
...
    bool operator==(const self& x) { return _iter == x._iter; }
    bool operator!=(const self& x) { return _iter != x._iter; }
    EdgeIter _iter;
    edge_id _i;
  };
...
};

Also, it does not seem correct to have different const qualifiers for
the operands of these operators (the above effectively says that the
right operand is const, but the left operand may be changed).

Thanks,
Hormoz
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users