January 2019
Intermediate to advanced
512 pages
14h 5m
English
We have just seen a class adapter that changes the interface of a class. Another kind of interface is a function (a member or a non-member function). A function has certain arguments, but we may want to call it with a different set of arguments. This would need an adapter. One common application of such adapters is known as currying one (or more) of the function's arguments. All it means is that we have a function of several arguments, and we fix the value of one of these arguments, so we don't have to specify it on every call. One example would be if we have f(int i, int j), but we want g(i), which is the same as f(i, 5), only without typing the 5 every time.
Here is a more interesting example that we are actually going ...