Could someone please explain what this does in the code above?
for (; num; num /= base) {
// Note: abs() is done on each digit instead of the whole num
// to preserve the full range of int
result.insert(result.begin(), digits[abs(num % base)]);
}