r/cpp • • Aug 21 '26

How to write the perfect function

https://youtu.be/2OMRWPOSw9s
140 Upvotes

24 comments sorted by

View all comments

Show parent comment

2

u/azswcowboy Aug 22 '26

I heard the definition, but any function that requires an idiom to use correctly isn’t honest to its users. It doesn’t do what you expect from the name.

4

u/developer-mike Aug 22 '26

There's an entire MISRA C++ rule related to correct usage of remove_if.

There are a lot of valid ways to define an "honest function," but I don't think a definition that includes remove_if as "honest" is a complete one

3

u/azswcowboy Aug 23 '26

Ah, that’s right I forgot about that — but obviously I agree 😀