The comma is an overloadable operator in C++, and overloading it lets functors chain: each comma takes the number on the left and the functor on the right, applies, and passes the result on. Production code avoids this — but understanding when the overload is picked over the built-in comma teaches how operator resolution treats the strangest member of the family.
Make (4, a, b, c) compute c(b(a(4))): functor objects Mult_3, Add_5, Minus_1 are applied left to right through an overloaded comma operator. A legal, if exotic, corner of operator overloading.
One template operator,(int, const F&) covers all three functors: it applies f to the value and returns int — ready for the next comma.
The comma associates left to right, so the chain folds itself: ((4, a), b), c.
Hit Submit (or ⌘/Ctrl + ↵) — test results will show up here.