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!

134 Upvotes

185 comments sorted by

View all comments

Show parent comment

1

u/Sopel97 Feb 16 '26

this achieves nothing

4

u/cdb_11 Feb 16 '26

It documents the parameters.

If you want to enforce that output parameters are always cleared, I bet you could add template specializations that automatically clear the container in the constructor.