[gdal-dev] Use of C++ iterators in API

Even Rouault even.rouault at spatialys.com
Thu Apr 12 11:03:27 PDT 2018


> I would recommend that Layers::iterator is updated to conform to the C++
> iterator concepts (to the very least to the InputIterator concept). 
 It
> still requires the following:
> - five typedefs (value_type, reference, pointer, iterator_category,
> difference_type) 
 - three constructors (default, copy, move)
> - two assignment operators (copy, move)
> - post-increment operator (operator++(int))
> 
> See also http://en.cppreference.com/w/cpp/concept/InputIterator.

I just planted the seed. Contributions (preferably as pull requests) 
welcome... 

> Considering the potential confusion, you can just avoid the issue completely
> and write:
 
>    for(const OGRLayer* layer : layers)

Fair enough. I'll use this.


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list