[gdal-dev] Initializing vectors
Kurt Schwehr
schwehr at gmail.com
Tue May 15 14:09:45 PDT 2018
Hi Even,
Trying to get caught up going through patches. A comment for this one:
https://github.com/OSGeo/gdal/blob/f7c27a807b27cf74cf4666ffe3df4d64cc3f47b3/gdal/frmts/gtiff/geotiff.cpp
You can size and initialize a vector in the constructor. With this code:
std::vector<bool> abRequireNewOverview;
abRequireNewOverview.resize(nOverviews);
for( int i = 0; i < nOverviews && eErr == CE_None; ++i )
{
abRequireNewOverview[i] = true;
The vector can be setup all at one go...
std::vector<bool> abRequireNewOverview(nOverviews, true);
See http://en.cppreference.com/w/cpp/container/vector/vector The alloc
will be set to the default.
vector( size_type count,
const T& value,
const Allocator& alloc = Allocator());
As for vector<bool>'s sadness, I am not really liking std::bitset for here,
so as long as we are careful, we can use it as long as we are careful not
hit its sharp edges.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180515/5ae9693a/attachment.html>
More information about the gdal-dev
mailing list