| Rev | Line |   | 
|---|
| [658] | 1 | #ifndef BZ_MINMAX_H
 | 
|---|
 | 2 | #define BZ_MINMAX_H
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 | #include <blitz/promote.h>
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 | BZ_NAMESPACE(blitz)
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | template<class T1, class T2>
 | 
|---|
 | 9 | BZ_PROMOTE(T1,T2) min(const T1& a, const T2& b)
 | 
|---|
 | 10 | {
 | 
|---|
 | 11 |     typedef BZ_PROMOTE(T1,T2) T_promote;
 | 
|---|
 | 12 | 
 | 
|---|
 | 13 |     if (a <= b)
 | 
|---|
 | 14 |         return T_promote(a);
 | 
|---|
 | 15 |     else
 | 
|---|
 | 16 |         return T_promote(b);
 | 
|---|
 | 17 | }
 | 
|---|
 | 18 | 
 | 
|---|
 | 19 | template<class T1, class T2>
 | 
|---|
 | 20 | BZ_PROMOTE(T1,T2) max(const T1& a, const T2& b)
 | 
|---|
 | 21 | {
 | 
|---|
 | 22 |     typedef BZ_PROMOTE(T1,T2) T_promote;
 | 
|---|
 | 23 | 
 | 
|---|
 | 24 |     if (a >= b)
 | 
|---|
 | 25 |         return T_promote(a);
 | 
|---|
 | 26 |     else
 | 
|---|
 | 27 |         return T_promote(b);
 | 
|---|
 | 28 | }
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | BZ_NAMESPACE_END
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | #endif
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.