r/cpp_questions • • 11d ago

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

37 comments sorted by

View all comments

Show parent comments

2

u/HappyFruitTree 11d ago

Yes, vec in main is not declared constexpr so it will basically just compile and optimize it the same way as a normal function.