On Mon, 10 Mar 2025 at 06:13, Nyall Dawson <nyall.daw...@gmail.com> wrote: > > > > On Mon, 24 Feb 2025, 8:31 am Nyall Dawson, <nyall.daw...@gmail.com> wrote: >> >> 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 > > > This proposal has passed the 2 week discussion phase and is ready for voting > now. > > Vote away!
Declaring as passed with approval from @alexbruy , @rouault , @elpaso, @uclaros Nyall > > > Nyall > > > > >> >> 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