allow auto for named local lambdas and iterator types
The blanket ban could not be satisfied: a lambda's type is unnameable, and std::function is the wrong substitute in per-tick hot paths, so around seven named local lambdas in lib violated the rule with no way to comply. Spelled-out iterator types were being followed inconsistently in the same file. Carving out the two cases makes the guideline enforceable rather than silently broken. No code is changed here; existing spelled-out iterator types stay valid. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YHcUerKAZKWNvSKJxYKbnG
This commit is contained in:
@@ -31,7 +31,14 @@ keep the citation accurate.
|
||||
## Coding Guidelines
|
||||
|
||||
* avoid duplicate code
|
||||
* do not use the "auto" keyword
|
||||
* do not use the "auto" keyword, with two exceptions:
|
||||
* **named local lambdas** — a lambda's type is unnameable, and `std::function`
|
||||
is not an acceptable substitute in per-tick code because it adds a heap
|
||||
allocation and an indirect call
|
||||
* **iterator types** — `auto it = m_buildings.find(id)` is allowed where
|
||||
spelling the iterator out adds length without adding information
|
||||
* everywhere else the type is written out; in particular `auto` is not used
|
||||
for plain values, return values, or range-for element types
|
||||
* use Qt utility data types (like QPoint, QVector3D, QString, etc.)
|
||||
* wrap strings that appear in the UI with Qt's "tr()"
|
||||
* use the EventManager/EventHandler instead of defining own signals and slots
|
||||
|
||||
Reference in New Issue
Block a user