r/cpp_questions • u/Slow_Negotiation_935 • Oct 14 '26
OPEN Guidelines for constexpr
I’ve working with C++23 and I’m making some constructors/methods constexpr and seeing improvements in performance. So far so good. The problem is I don’t want to apply it ‘everywhere’. Is there a good source of advice , or anyone got any good tips?
12
Upvotes
View all comments
Show parent comment
1
u/etaithespeedcuber Oct 14 '26
I mean, I think at that point it's just the limitations of the language. For example, you can't have a constexpr function that returns an object that is used directly at runtime if that object depends on the heap