#ifndef PYTHONIC_INCLUDE_NUMPY_NDINDEX_HPP #define PYTHONIC_INCLUDE_NUMPY_NDINDEX_HPP #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/tuple.hpp" #include PYTHONIC_NS_BEGIN namespace numpy { template struct ndindex_iterator : std::iterator< std::random_access_iterator_tag, types::array, ptrdiff_t, types::array *, types::array /* reference_type, but no reference is possible*/> { long index; types::array shape; ndindex_iterator(); ndindex_iterator(types::array const &shape, long first); types::array operator*() const; ndindex_iterator &operator++(); ndindex_iterator &operator+=(long n); bool operator!=(ndindex_iterator const &other) const; bool operator<(ndindex_iterator const &other) const; long operator-(ndindex_iterator const &other) const; }; template struct _ndindex : ndindex_iterator { using iterator = ndindex_iterator; types::array shape; iterator end_iter; _ndindex(); _ndindex(types::array const &shape); iterator &begin(); iterator const &begin() const; iterator end() const; }; template _ndindex ndindex(Types... args); template _ndindex ndindex(types::array const &args); template _ndindex ndindex(types::pshape const &args); DEFINE_FUNCTOR(pythonic::numpy, ndindex); } PYTHONIC_NS_END #endif