From a34d66f54847bd0988a5e768f529eaee614812c4 Mon Sep 17 00:00:00 2001 From: Malte Langkabel Date: Tue, 4 Aug 2026 15:21:32 +0200 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01YHcUerKAZKWNvSKJxYKbnG --- .claude/CLAUDE.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md index 41c87a6..0beabeb 100644 --- a/.claude/CLAUDE.md +++ b/.claude/CLAUDE.md @@ -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