c++ - 在 C++ 中测量时间并写入文件时,'operator<<' 不匹配
问题描述
我编写了一个代码来测量排序算法的运行时间并将时间写入文件,但我不断收到“错误:'operator<<'不匹配(操作数类型是'std :: basic_ostream'和'std ::chrono::duration >')|" 我不知道如何解决它。我的代码片段在这里,错误与数据文件有关:
auto start=std::chrono::high_resolution_clock::now();
selectionsort(numberarray, length);
auto stop=std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(stop-start);
datafile << length << ';' << duration << endl;
谁能告诉我它有什么问题?谢谢
解决方案
推荐阅读
- javascript - 实现 DOM 和 JS 将 textarea 输入转换为 textarea 输出框
- python - glob- python 排序的文件列表
- c# - 如何在 .NET Core 3.1.1 中将 json 更改为 camelCase?
- centos7 - Certbot 在 httpd.conf 中不存在的行上给我语法错误
- r - 如何创建可重用的 plot_ly 函数?
- android - 背景屏幕可见性
- angular - 如何在 Angular 7 中创建一个不包含我的导航的组件?
- mysql - 如何从可用插槽和预订插槽中找到空闲插槽
- excel - 检查列中的重复项并突出显示它
- dask - 如何从 Dask 调度程序获取仪表板地址