Stunt programming. Modern C++ is not about that.

Option Three

Ok. Sobering time. Cold head.  Of course we know very well about the good old Function Object aka “Functor”. So let’s do a proverbial step back and use what we already know. Bellow is the very bland looking very traditional C++ solution.  I am not sure but perhaps even C++98 compiler could produce a byte code from this?

This is one sober solution indeed. And working too. Usage seems simple and with no surprises.

Also the default argument issue is solved the C++ way. Modern or not. By using () operator overload, on the class.

What also is delivered is correct behavior in case of const required.  Code above is documented. And easy to maintain, expand or do whatever might be required down the line.

In case of popular vote I can deliver more explanations.

The C++ Tool
The C++ Tool