[gdal-dev] [gdal 3.12beta1] OGRFeature::GetDefnRef now returns a const pointer

Even Rouault even.rouault at spatialys.com
Tue Oct 21 11:17:17 PDT 2025


> Just checked and it seems that a plain (non-ref) const shared_ptr can 
> be copied:
>
I see your point but the situation is a bit different:

- technically copying a const shared_ptr doesn't modify the original 
shared_ptr, but the control block encapsulating the raw pointer and the 
ref count, shared by all shared_ptr<>.

- Furthermore there is no const method in a shared_ptr<> that would 
destroy it. Whereas OGRFeatureDefn::Release() can definitely destroy 
"this" when the ref count reaches 0.


-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list