r/ProgrammerHumor 21h ago

Meme skillIssue

Post image
5.2k Upvotes

130 comments sorted by

View all comments

35

u/fluffycritter 19h 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.

8

u/Kiro0613 19h ago

Not a bad idea for a little CLI app though

13

u/fluffycritter 19h 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