© 2025 bluewindde
本文采用 CC BY-SA 4.0 协议 发布
使用说明
需要在使用本模板库前加入如下代码。
#include<iostream>
#include<type_traits>
using namespace std;兼容性说明
本模板库在 C++ 14 下可用,舍弃了所有 C++ 17 及以后引入的特性。
这将导致本模板库全局修改了如下行为:
- is_integral 为 __int128 特化。
测试说明
FastIO
支持读写字符和非负整数。接口是 cin/cout 的一部分和 fin/fout 的混合体。
与解绑同步流的 cin/cout 在相同运行条件(C++ 14 O2)下对比:
| 数量 | 值域 | 输入量 | cin/cout | FastIO | 提速 |
|---|---|---|---|---|---|
| 9MiB | 48ms | 114 | |||
| 10MiB | 55ms | 129 | |||
| 18MiB | 108ms | 161 | |||
| 18MiB | 96ms | 180 | |||
| 180MiB | 876ms | 1666 | |||
| 185MiB | 1209ms | 1929 | |||
| 360MiB | 1911ms | 3114 | |||
| 370MiB | 1696ms | 3277 | |||
| 2GiB | 10530ms | 16503 | |||
| 2GiB | 9317ms | 17748 |
测试
gcc --version 结果:
g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.编译选项
g++ 1.cpp -o 1 -std=c++14 -O2每组测试重复三次,测试结果四舍五入,结果仅供参考。
提供测试所用程序的源代码。