Implemented the indexed_iterator template and made it possible to specify the access mode (i.e. READONLY, WRITEONLY, or READWRITE) of the ndarray for the flat_iterator.