下面的代码显示了 2 个将 转换为 的解决方案 (std::to_string
和) 。是还是更快?std::stringstream
int
m_currentSoundTime
std::string
std::to_string
std::stringstream
// Compute current sound time in minute and convert to string
stringstream currentTime;
currentTime << m_currentSoundTime / 60;
m_currentSoundTimeInMinute = currentTime.str();
或者
m_currentSoundTimeInMinute = to_string( m_currentSoundTime / 60 );