C++ String to X conversion (X is an arithmetic type)