T could be 32-bit or 64-bit
| 38 | // |
| 39 | template< typename T > // T could be 32-bit or 64-bit |
| 40 | std::basic_string<TCHAR> commatize (T number) |
| 41 | { |
| 42 | static TCHAR scratch [8*sizeof(T)]; |
| 43 | |
| 44 | register TCHAR * ptr = scratch + countOf( scratch ); |
| 45 | *(--ptr) = 0; |
| 46 | |
| 47 | for (int digits = 3; ; ) |
| 48 | { |
| 49 | *(--ptr) = '0' + int (number % 10); |
| 50 | number /= 10; |
| 51 | if (0 == number) |
| 52 | break; |
| 53 | if (--digits <= 0) |
| 54 | { |
| 55 | *(--ptr) = ','; |
| 56 | digits = 3; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | return std::basic_string<TCHAR> (ptr); |
| 61 | } |
| 62 | |
| 63 | // Functor object to help with accumulating values in vectors |
| 64 | template< typename T > |
nothing calls this directly
no outgoing calls
no test coverage detected