[gdal-dev] Use of std::unique_ptr and auto in new code
Even Rouault
even.rouault at spatialys.com
Tue Dec 12 02:06:17 PST 2017
> 1. std::unique_ptr
>
[...]
>
> Hopefully this will help to reduce the incidence of memory leaks.
+1, that's one of the benefits of C++11
>
> --
>
> 2. auto
>
> I'd like to not have to write
>
> for( std::vector<std::unique_ptr<OGRFeature>>::iterator oIt =
> apoMyList.begin();
>
> and simply write
>
> for( auto oIt = apoMyList.begin();
+1. You could even use range based loop
for( auto& olt: apoMyList )
(or auto const& depending on what you want to do with it)
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20171212/30f84ac4/attachment.html>
More information about the gdal-dev
mailing list