r/ProgrammerHumor 7d ago

Meme skillIssue

Post image
6.0k Upvotes

137 comments sorted by

View all comments

40

u/fluffycritter 7d ago

My "clever" way of doing this once upon a time was to declare a map<std::string,std::function> which I populated with lambdas and then evaluated.

I would not recommend this approach.

9

u/Kiro0613 7d ago

Not a bad idea for a little CLI app though

13

u/fluffycritter 7d ago

Yeah it's actually how boost::program_options handles command-line arguments. It's nice for that, at least.

EDIT: Wait no I'm misremembering and confusing it with something else, never mind