root/trunk/infrastructure/meta/Util.d
| Revision 40, 316 bytes (checked in by KirkMcDonald, 2 years ago) |
|---|
| Line | |
|---|---|
| 1 | module meta.Util; |
| 2 | |
| 3 | |
| 4 | |
| 5 | template itoa(int i) { |
| 6 | static if (i < 0) { |
| 7 | static const char[] itoa = "-" ~ itoa!(-i); |
| 8 | } |
| 9 | else { |
| 10 | static if (i / 10 > 0) { |
| 11 | static const char[] itoa = itoa(i / 10) ~ "0123456789"[i % 10]; |
| 12 | } else { |
| 13 | static const char[] itoa = "0123456789"[i % 10 .. i % 10 + 1]; |
| 14 | } |
| 15 | } |
| 16 | } |
Note: See TracBrowser for help on using the browser.
