@@ -33,9 +33,16 @@ namespace xt
3333
3434 using self_type = xchunked_view<E>;
3535 using expression_type = std::decay_t <E>;
36- using size_type = size_t ;
36+ using value_type = typename expression_type::value_type;
37+ using reference = typename expression_type::reference;
38+ using const_reference = typename expression_type::const_reference;
39+ using pointer = typename expression_type::pointer;
40+ using const_pointer = typename expression_type::const_pointer;
41+ using size_type = typename expression_type::size_type;
42+ using difference_type = typename expression_type::difference_type;
3743 using shape_type = svector<size_type>;
38- using chunk_iterator_type = xchunk_iterator<self_type>;
44+ using chunk_iterator = xchunk_iterator<self_type>;
45+ using const_chunk_iterator = xchunk_iterator<const self_type>;
3946
4047 template <class OE , class S >
4148 xchunked_view (OE&& e, S&& chunk_shape);
@@ -52,8 +59,13 @@ namespace xt
5259 expression_type& expression () noexcept ;
5360 const expression_type& expression () const noexcept ;
5461
55- chunk_iterator_type chunk_begin ();
56- chunk_iterator_type chunk_end ();
62+ chunk_iterator chunk_begin ();
63+ chunk_iterator chunk_end ();
64+
65+ const_chunk_iterator chunk_begin () const ;
66+ const_chunk_iterator chunk_end () const ;
67+ const_chunk_iterator chunk_cbegin () const ;
68+ const_chunk_iterator chunk_cend () const ;
5769
5870 private:
5971
@@ -155,16 +167,41 @@ namespace xt
155167 }
156168
157169 template <class E >
158- inline auto xchunked_view<E>::chunk_begin() -> chunk_iterator_type
170+ inline auto xchunked_view<E>::chunk_begin() -> chunk_iterator
171+ {
172+ shape_type chunk_index (m_shape.size (), size_type (0 ));
173+ return chunk_iterator (*this , std::move (chunk_index), 0u );
174+ }
175+
176+ template <class E >
177+ inline auto xchunked_view<E>::chunk_end() -> chunk_iterator
178+ {
179+ return chunk_iterator (*this , shape_type (grid_shape ()), grid_size ());
180+ }
181+
182+ template <class E >
183+ inline auto xchunked_view<E>::chunk_begin() const -> const_chunk_iterator
159184 {
160185 shape_type chunk_index (m_shape.size (), size_type (0 ));
161- return chunk_iterator_type (*this , std::move (chunk_index), 0u );
186+ return const_chunk_iterator (*this , std::move (chunk_index), 0u );
187+ }
188+
189+ template <class E >
190+ inline auto xchunked_view<E>::chunk_end() const -> const_chunk_iterator
191+ {
192+ return const_chunk_iterator (*this , shape_type (grid_shape ()), grid_size ());
193+ }
194+
195+ template <class E >
196+ inline auto xchunked_view<E>::chunk_cbegin() const -> const_chunk_iterator
197+ {
198+ return chunk_begin ();
162199 }
163200
164201 template <class E >
165- inline auto xchunked_view<E>::chunk_end () -> chunk_iterator_type
202+ inline auto xchunked_view<E>::chunk_cend () const -> const_chunk_iterator
166203 {
167- return chunk_iterator_type (* this , shape_type ( grid_shape ()), grid_size () );
204+ return chunk_end ( );
168205 }
169206
170207 template <class E , class S >
0 commit comments