r/cpp • • Feb 16 '26

Favorite optimizations ??

I'd love to hear stories about people's best feats of optimization, or something small you are able to use often!

136 Upvotes

185 comments sorted by

View all comments

Show parent comment

6

u/Careful-Nothing-2432 Feb 16 '26

Does this include when you’re in a const method/declare the class instance as a const value?

I guess with a const class method you still have aliasing

5

u/usefulcat Feb 16 '26

Yes, it includes that case. Aliasing is the root of the issue (or so I assume, anyway).