root/trunk/tango/util/MinMax.d
| Revision 5346, 1.0 kB (checked in by kris, 2 years ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | /******************************************************************************* |
| 2 | |
| 3 | copyright: Copyright (c) 2010 Kris. All rights reserved. |
| 4 | |
| 5 | license: BSD style: $(LICENSE) |
| 6 | |
| 7 | version: Jan 2010: Initial release |
| 8 | |
| 9 | author: Kris |
| 10 | |
| 11 | *******************************************************************************/ |
| 12 | |
| 13 | module tango.util.MinMax; |
| 14 | |
| 15 | /******************************************************************************* |
| 16 | |
| 17 | Return the minimum of two arguments (of the same type) |
| 18 | |
| 19 | *******************************************************************************/ |
| 20 | |
| 21 | T min(T)(T a, T b) |
| 22 | { |
| 23 | return a < b ? a : b; |
| 24 | } |
| 25 | |
| 26 | /******************************************************************************* |
| 27 | |
| 28 | Return the maximum of two arguments (of the same type) |
| 29 | |
| 30 | *******************************************************************************/ |
| 31 | |
| 32 | T max(T)(T a, T b) |
| 33 | { |
| 34 | return a > b ? a : b; |
| 35 | } |
Note: See TracBrowser for help on using the browser.












