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.

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

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

What also is delivered is correct behavior in case of const required.  Code above is documented. In case of popular vote I can deliver more explanations.

The C++ Tool
The C++ Tool

 

 

 

Leave a Reply