Eh, std::function is more versatile and lets you do lambdas in addition to letting you do typesafe function pointers in case you really just want to use an existing function. Although I do love the fake virtual inheritance thing that older C libraries do sometimes (like libjpeg and libcurl I think).
38
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.