[gdal-dev] copying a GDALColorTable

Mateusz Loskot mateusz at loskot.net
Sun Nov 11 11:12:14 PST 2012


On 11 November 2012 19:07, David Strip <gdal at stripfamily.net> wrote:
> On 11/11/2012 11:59 AM, Mateusz Loskot wrote:
>
>> IMO, for GDAL 2.0 the API could be improved and some symmetry
>> introduced. For example, for GDALColorTable::Clone()
>> two static methods could be added:
>>
>> static GDALColorTable* GDALColorTable::Create(GDALPaletteInterp=GPI_RGB);
>> static void GDALColorTable::Destroy(GDALColorTable*);
>
>
> If we're building a list of suggestions, a copy constructor would allow more
> C++ like coding:
> GDALColorTable::GDALColorTable (const GDALColorTable &)
> and perhaps an assignment operator
> GDALColorTable::operator = (const GDALColorTable &)

Keep in mind, C++ API in GDAL is "C with classes", there is no culture
of implementing copy constructors and assignment operators,
so there won't be any move equivalents either.

The safest bet is to assume GDAL classes are NOT copy
constructible or assignable, as they would have
copy ctor and assignment operator declared private.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the gdal-dev mailing list