[Qgis-psc] QEP 314: Relax prohibition against "auto"

Nyall Dawson nyall.dawson at gmail.com
Wed Jan 22 15:25:21 PST 2025


Hi all,

Please see https://github.com/qgis/QGIS-Enhancement-Proposals/pull/319
for a proposed change to the QGIS coding policies to relax the current
prohibition against use of "auto" in some new cases.

Specifically, allowing use of "auto" for variable types when the
variable type is explicitly stated during its initialization:

auto may be used for variable types if the type is explicit during
variable initialization. Eg

// allowed, as the QgsPoint type is explicit during initialization:
auto pointObject = QgsPoint( 3, 4 );
// allowed, as the std::unique_ptr< QgsPoint >, std::shared_ptr<
QgsPoint > types are explicit during initialization:
auto pointUniquePointer = std::make_unique< QgsPoint >( 3, 4 );
auto pointSharedPointer = std::make_shared< QgsPoint >( 3, 4 );

// NOT allowed, the argument types for the std::tuple are not explicit:
auto myTuple = std::make_tuple( 0, 5 );

Please keep discussion on
https://github.com/qgis/QGIS-Enhancement-Proposals/pull/319 so that we
have a formal record of the discussion.

Nyall


More information about the QGIS-PSC mailing list