News for hackers. Stuff that matters.
Re:What if anything have we learned from C++? [video] by nly on Friday July 24, 2015 @07:55AM (#9941308)
Your MAX has no respect for namespaces or scopes. A real world macro is probably going to be called MYLIBRARY_MAX to avoid this. Secondly the C++ lambda solution is just easier to read.

    auto max = [](auto a, auto b) { 
        return (a > b) ? a : b;
    };

    max (3.1415, 42); // returns double
    max (42ul, 78u); // returns unsigned long
    max (17, 16); // returns int

There are no comments on this comment yet.