Namespaces
Variants
Views
Actions

Talk:cpp/algorithm/minmax element

From cppreference.com

In this code, isn't the assignment to "result.second" unnecessary because result.second already equals result.first?

if (comp(*first, *result.first)) {
   result.second = result.first;
   result.first = first;
} else {
   result.second = first;
}

217.42.228.94 14:46, 19 February 2014 (PST)

Yeah, I think it is unnecessary. I'll remove it -- if people feel that it adds clarity to the example implementation, we can add it back. --Nate (talk) 16:32, 20 February 2014 (PST)