
On Mon, Oct 25, 2010 at 11:08 AM, Hossein Haeri
Dear all,
Is there any variadic max function in Boost? I mean something which returns the max of all the arguments it takes -- no matter how many they are. (Feel free to correct me if this use of 'variadic' is not the correct terminology.) Please note that I'm not after working on ranges of arguments. I'm rather looking for a max function which is applicable in all the examples below:
int m1 = max(a1, a2); int m2 = max(a1, a2, a3); ... int mk = max(a1, a2, ..., ak);
I privately emailed Hervé Brönnimann with a variadic implementation of min/max for inclusion into the minmax library in 2007. It was implemented both as brute force overloads using Boost.PP (up to 10 arguments) and using variadic templates. He said he liked it and would include it. A later reply mentioned that a student of his had independently come up with the same solution and was also working on a proposal for C++0x so he was going to use that one. I'm not sure what happened to it. I don't see it listed in the current Boost documentation, but it was accepted for C++0x, so perhaps your compiler has support for it if you compile in C++0x mode. --Michael Fawcett