You work in a bar, pouring pints for the locals. One of your regulars comes in; he’s looking pretty grumpy today. “Whiskey” he snaps. You put down a glass and pour. You finish pouring and he necks back the drink. “Again”, he snaps. Again, you pour and as soon as you finish he necks it. This repeats two or three more times before the grumpy man slams down the money for his tab and leaves. Congratulations, you have just taken part in a “Producer/Consumer” exchange.
Month: October 2013
Variadic Functions the C++11 way
The C++11 standard introduced so called Variadic Templates. These have many uses, one of which is the ability to write functions that take any number of arguments without having to mess around with C-style non-type safe “var-args” and printf like format specifiers.