Boost logo

Boost Users :

Subject: [Boost-users] [Graph] const safety in edge_list_impl::edge_iterator
From: Hormoz Zarnani (hzarnani_at_[hidden])
Date: 2018-02-11 20:20:26


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 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