Narzędzia użytkownika

Narzędzia witryny


min_element_max_element

Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
min_element_max_element [2008/12/11 00:14]
kkukolow
min_element_max_element [2008/12/11 00:17]
kkukolow
Linia 36: Linia 36:
 <code cpp> <code cpp>
 template <class ForwardIterator>​ template <class ForwardIterator>​
-  ForwardIterator ​max_element ​( ForwardIterator first, ForwardIterator last )+  ForwardIterator ​min_element ​( ForwardIterator first, ForwardIterator last )
 { {
-  ForwardIterator ​largest ​= first;+  ForwardIterator ​lowest= first;
   if (first==last) return last;   if (first==last) return last;
   while (++first!=last)   while (++first!=last)
-    if (*largest<*first)    // or: if (comp(*largest,*lowest)) for the comp version +    if (*first<*lowest)    // or: if (comp(*first,*lowest)) for the comp version 
-      ​largest=first; +      ​lowest=first; 
-  return ​largest;+  return ​lowest;
 } }
 </​code>​ </​code>​
min_element_max_element.txt · ostatnio zmienione: 2008/12/11 00:21 przez kkukolow