Use constexpr effectively

Use constexpr effectively in C++ — with three ready prompts, from the immediate task to the lasting pattern.

3prompt heights
Open it in the interactive atlas →

3 ready prompts

Written for the moment this actually comes up.

Improve — make it easier to accept

+
Before I submit this change to the library, make it easy for reviewers to see which computations…
Before I submit this change to the library, make it easy for reviewers to see which computations became compile-time: move pure helpers into a header with constexpr, put the key results at the top as static constexpr variables, show one example of a static_assert testing expected behavior, and mark code that cannot be constexpr with a brief comment explaining why to avoid guessing during review.

Decide — diagnose the stuck moment

+
I modified core::compute to be constexpr and added static_asserts, but at runtime some unit tests…

I turned a function constexpr but a unit test now fails at runtime on non-constexpr inputs.

I modified core::compute to be constexpr and added static_asserts, but at runtime some unit tests that exercise dynamic inputs now fail in subtle ways. Team members are Tim who wrote compute and Aisha on test infra. I’m worried I changed evaluation order or removed a runtime guard. Is this likely that making it constexpr exposed a UB or tightened evaluation rules, and what quick checks should I perform to confirm the compile-time changes are safe for dynamic inputs?

Become — change the pattern

+
Over several releases we keep retrofitting constexpr on utilities and occasionally introduce…

We flip functions to constexpr haphazardly and sometimes break tests later.

Over several releases we keep retrofitting constexpr on utilities and occasionally introduce regressions in dynamic paths or tie ourselves to a specific standard version. The pattern is lack of a policy for when something should be constexpr and inconsistent test coverage. Which simple rules and review practices should we adopt so constexpr is used where it helps and never breaks runtime behavior or portability?

Next to this one

Other programming language work people do in C++.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.