【发布时间】:2021-01-29 23:52:24
【问题描述】:
ostream& operator<<(ostream& os, const TimedEvents& t)
{
os << "Execution Times:\n--------------------------\n";
for (int i = 0; i < t.nEvents; i++)
{
os << os.width(21) << t.events[i].name << ' ';
os.width(13);
os.setf(ios::right);
os << t.events[i].duration << os.unsetf(ios::left) << ' ' << t.events[i].units << endl;
}
cout << "--------------------------" << endl;
return os;
}
在上面的代码中,os << t.events[i].duration 不起作用,因为我无法将持续时间转换为 ostream。持续时间是 chrono::steady_clock::duration,Visual Studio 说没有匹配的“
【问题讨论】:
标签: c++