[QGIS-Developer] QgsFeatureSource::getFeatures - why returning Iterator by value instead of pointer ?

Sandro Santilli strk at kbt.io
Fri Oct 15 08:32:14 PDT 2021


I'm still trying to understand why a QgsFeatureRequest that's being
built with a DistanceWithin filter ends up loosing that at some point
and reached the point in which:

    QgsFeatureIterator QgsPostgresFeatureSource::getFeatures( const QgsFeatureRequest &request )

Is returning:

      return QgsFeatureIterator( new QgsPostgresFeatureIterator( this, false, request ) );

My question is: why is a QgsFeatureIterator being constructed here,
just for returning it as a value ? Why not returning a pointer
instead, to allow subclasses to return whatever derived class they want ?

--strk; 

  Libre GIS consultant/developer
  https://strk.kbt.io/services.html


More information about the QGIS-Developer mailing list