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

2018-04-13 Thread Alex HighViz
From: Even Rouault [mailto:even.roua...@spatialys.com] > I just planted the seed. Contributions (preferably as pull requests) > welcome... Ok just did that PR #411. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailma

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

2018-04-12 Thread Even Rouault
> 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 (defa

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

2018-04-12 Thread Alex HighViz
> Even: > In fact the nature of the object which is returned depends on the iterator, > and as documented in the API, for the sake of implementation simplicity, > those iterators do not necessarily respect the whole semantics of iterators. I don't think that is necessary, at least in the case of

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

2018-04-11 Thread Mateusz Loskot
On 11 April 2018 at 14:40, Even Rouault wrote: > On mercredi 11 avril 2018 05:10:53 CEST Kurt Schwehr wrote: >> The auto&& is really confusing. > > A experimentally working alternative with miminal use of '&' is > > for( auto poLayer: poDS->GetLayers() ) <-- this is a plain OGRLayer* IMHO, i

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

2018-04-11 Thread Andrew Bell
On Wed, Apr 11, 2018 at 8:40 AM, Even Rouault wrote: > On mercredi 11 avril 2018 05:10:53 CEST Kurt Schwehr wrote: > > The auto&& is really confusing. > > A experimentally working alternative with miminal use of '&' is > > for( auto poLayer: poDS->GetLayers() ) <-- this is a plain OGRLayer*

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

2018-04-11 Thread Even Rouault
On mercredi 11 avril 2018 05:10:53 CEST Kurt Schwehr wrote: > The auto&& is really confusing. A experimentally working alternative with miminal use of '&' is for( auto poLayer: poDS->GetLayers() ) <-- this is a plain OGRLayer* { for( auto& poFeature: *poLayer ) <-- this is a uni

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

2018-04-11 Thread Kurt Schwehr
The auto&& is really confusing. -kurt On Tue, Apr 10, 2018 at 2:41 PM, Mateusz Loskot wrote: > On 10 April 2018 at 23:06, Even Rouault > wrote: > > On mardi 10 avril 2018 22:34:56 CEST Mateusz Loskot wrote: > >> On 10 April 2018 at 22:06, Even Rouault > wrote: > >> > > >> > Just wanted to adv

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

2018-04-10 Thread Mateusz Loskot
On 10 April 2018 at 23:06, Even Rouault wrote: > On mardi 10 avril 2018 22:34:56 CEST Mateusz Loskot wrote: >> On 10 April 2018 at 22:06, Even Rouault wrote: >> > >> > Just wanted to advertize the recent new introduction of C++ iterators >> > (...) >> >> Good one, thanks! >> >> > for( auto&&

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

2018-04-10 Thread Even Rouault
On mardi 10 avril 2018 22:34:56 CEST Mateusz Loskot wrote: > On 10 April 2018 at 22:06, Even Rouault wrote: > > Hi, > > > > Just wanted to advertize the recent new introduction of C++ iterators > > (...) > > Good one, thanks! > > > for( auto&& poLayer: poDS->GetLayers() ) > > Do the iterat

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

2018-04-10 Thread Mateusz Loskot
On 10 April 2018 at 22:06, Even Rouault wrote: > Hi, > > Just wanted to advertize the recent new introduction of C++ iterators (...) Good one, thanks! > for( auto&& poLayer: poDS->GetLayers() ) Do the iterators return a proxy reference hence the tutorial prefers auto&& over plain auto&? (ie