https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120622

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
And indeed in ./pythonic/include/numpy/ndenumerate.hpp we have:

  template <class E>
  struct ndenumerate_iterator
      : std::iterator<
            std::random_access_iterator_tag,
            std::tuple<types::array_tuple<long, E::value>, typename E::dtype>>
{
    long index;
    E const &expr;
    typename E::dtype *iter;

    ndenumerate_iterator();
    ndenumerate_iterator(E const &expr, long first);

    std::tuple<types::array_tuple<long, E::value>, typename E::dtype>
    operator*() const;

    ndenumerate_iterator &operator++();
    ndenumerate_iterator &operator+=(long n);
    bool operator!=(ndenumerate_iterator const &other) const;
    bool operator<(ndenumerate_iterator const &other) const;
    long operator-(ndenumerate_iterator const &other) const;
  };


This type does not meet the C++ standard's requirements for any kind of
iterator (certainly not a random access iterator).

Adding this member function fixes the testcase:

    bool operator==(ndenumerate_iterator const &other) const { return !(*this
!= other); }

However, it's still not a valid iterator because it has no postfix increment,
operator++(int)

And it's not a valid random access iterator, because it has no operator[] and
no operator-- and no operator--(int) and its operator* doesn't return a
reference.

Reply via email to