Hi all, Please see https://github.com/qgis/QGIS-Enhancement-Proposals/pull/330 for a proposed change to the QGIS coding policies to relax the current prohibition against use of "auto" in some (more!) new cases.
(This follows up recent changes to permit auto for smart pointer types, see https://github.com/qgis/QGIS-Enhancement-Proposals/pull/319) This change relaxes the prohibition against auto to allow use of auto for variable types when the variable type is explicitly stated during its initialization as the result of a cast operation, such as dynamic_cast, static_cast, const_cast, reinterpret_cast, qobject_cast, qgsgeometry_cast, or qgis::down_cast Specifically: // allowed, the pointer types are explicit during initialization: auto markerSymbol = dynamic_cast< QgsMarkerSymbol* >( symbol ); auto vectorLayer = qobject_cast< QgsVectorLayer* >( layer ); if ( auto lineString = qgsgeometry_cast< const QgsLineString* >( geometry ) ) { ... } // NOT allowed, the type is not explicit: auto myLineStringPtr = downcastGeometryAsLineString( geometry ); Please keep discussion on https://github.com/qgis/QGIS-Enhancement-Proposals/pull/330 so that we have a formal record of the discussion. Thanks all! Nyall
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer