下面的代码显示了 2 个将 转换为 的解决方案 (std::to_string和) 。是还是更快?std::stringstreamint m_currentSoundTimestd::stringstd::to_stringstd::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 );