May 2017
Intermediate to advanced
590 pages
17h 18m
English
Composition is usually represented by a dot (.) or asterisk (*), such as f . g or f * g. We can actually do something similar in C++ by overloading operator* (it would make little sense to try to overload operator dot). Similar to the compose() function, operator* should work with any number of arguments; therefore, we will have two overloads, just like in the case of compose():
template <typename F, typename G> auto operator*(F&& f, G&& g) { return compose(std::forward<F>(f), std::forward<G>(g)); } template <typename F, ...Read now
Unlock full access