Wednesday, January 25, 2023

Partial function application

 

From the article:

A few weeks ago, I had a discussion with a few of my readers. One reader said that I should write about Partial Function Applications. Another reader mentioned that C++ does not support function applications. This is wrong. C++ supports Partial Function Application. Consequently, I am writing today about std::function, std::bind, std::bind_front, lambdas, auto, and currying.

Let me start with a bit of theory…

 

Using perfect (and imperfect) forwarding to simplify C++ wrapper classes – Raymond Chen

 There may be cases where you have a C++ class that wants to wrap another C++ class that is contained as a member. … It’s annoying that there’s so much boilerplate to do the method forwarding, and that we have to keep looking up the parameters and return types so that each forwarder has the correct signature. Fortunately, we can use perfect forwarding to write most of them

No comments:

Post a Comment