I could write myself a helper class that does this when given a functor, but I was wondering if there's a better approach, or if there's something already in the standard library (seems like there should be).
Answers I've found on StackOverflow are all for C# which doesn't help me.
Thanks