{"id":16024410,"url":"https://github.com/argvchs/fastio","last_synced_at":"2025-03-17T20:32:10.208Z","repository":{"id":113348578,"uuid":"523628408","full_name":"argvchs/fastio","owner":"argvchs","description":"C++ FastIO lib.","archived":false,"fork":false,"pushed_at":"2025-01-14T14:18:02.000Z","size":71,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T04:27:19.208Z","etag":null,"topics":["c-plus-plus","cpp","cpp20","fastio"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/argvchs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-11T07:35:55.000Z","updated_at":"2025-01-14T15:32:26.000Z","dependencies_parsed_at":"2023-10-16T03:53:04.462Z","dependency_job_id":"a634dd88-17cb-4fa9-88d6-36637cb706ac","html_url":"https://github.com/argvchs/fastio","commit_stats":null,"previous_names":["argvchs/fastio"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/argvchs%2Ffastio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/argvchs%2Ffastio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/argvchs%2Ffastio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/argvchs%2Ffastio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/argvchs","download_url":"https://codeload.github.com/argvchs/fastio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243885886,"owners_count":20363643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","cpp","cpp20","fastio"],"created_at":"2024-10-08T19:20:29.395Z","updated_at":"2025-03-17T20:32:09.877Z","avatar_url":"https://github.com/argvchs.png","language":"C++","readme":"# FastIO\n\n一个快读快写库，支持基本类型读写，指针地址写入，和 `cin` `cout` 用法类似。\n\n虽然相对于原版函数式 `fread` 快读会有点慢，但还是比 `getchar` `putchar` 要快的。\n\n# 1. 目录解释\n\n```text\nfastio.cpp          # 测试代码\nfastio.h            # FastIO 库源代码\nfastio.beta.h       # FastIO 库源代码，使用 C++20\nfastio.in           # 读写测试数据\n```\n\n# 2. 使用\n\n-   `using namespace fastio;`\n\n    使用 FastIO。\n\n-   `using namespace fastio::symbols;`\n\n    使用读写符号，如 `endl`。\n\n-   `is \u003e\u003e n;`\n\n    读取 `n`。\n\n-   `is \u003e\u003e n \u003e\u003e m \u003e\u003e k;`\n\n    读取 `n` `m` `k`。\n\n-   `c = is.get();` `is.get(c);`\n\n    读取一个字符到 `c`。\n\n-   `is \u003e\u003e s;`\n\n    读取一个字符串 `s`。\n\n-   `is.getline(s);`\n\n    读取一行到 `s`。\n\n-   `is.getline(s, end);`\n\n    读取字符到 `s`，一直读到 `end` 停止。\n\n-   `is.get(s);`\n\n    读取一行到 `s`，但是把换行符保留在流中。\n\n-   `is.get(s, end);`\n\n    读取字符到 `s`，一直读到 `end` 停止，但是把 `end` 保留在流中。\n\n-   `is.ignore();`\n\n    忽略一行。\n\n-   `is.ignore(end);`\n\n    忽略字符到 c 停止。\n\n-   `while (is \u003e\u003e n) ;`\n\n    一直读取直到末尾。\n\n-   `is \u003e\u003e bin;` `is \u003e\u003e oct;` `is \u003e\u003e dec;` `is \u003e\u003e hex;`\n\n    按 2、8、10、16 进制读取数。\n\n-   `is \u003e\u003e ws;`\n\n    忽略前导空格。\n\n-   `is.setbase(n);`\n\n    按 `base` 进制读取数 $(2 \\le base \\le 36)$。\n\n-   `is \u003e\u003e reset;`\n\n    取消前面的所有设置。\n\n-   `os \u003c\u003c n;`\n\n    写入 `n`。\n\n-   `os \u003c\u003c n \u003c\u003c m \u003c\u003c k;`\n\n    写入 `n` `m` `k`。\n\n-   `os.put(c);`\n\n    写入一个字符 `c`。\n\n-   `os \u003c\u003c flush;`\n\n    刷新流。\n\n-   `os \u003c\u003c endl;`\n\n    写入换行。\n\n-   `os \u003c\u003c ends;`\n\n    写入空格。\n\n-   `os \u003c\u003c boolalpha;`\n\n    设置写入 `bool` 时用 `true` `false`。\n\n-   `os \u003c\u003c noboolalpha;`\n\n    设置写入 `bool` 时用 `0` `1`。\n\n-   `os \u003c\u003c showpos;`\n\n    设置写入正数和 0 时前面加 `+` 号。\n\n-   `os \u003c\u003c noshowpos;`\n\n    设置写入正数和 0 时前面不加 `+` 号。\n\n-   `os \u003c\u003c showpoint;`\n\n    设置写入浮点数时总是添加小数点。\n\n-   `os \u003c\u003c noshowpoint;`\n\n    设置写入浮点数时不总是添加小数点。\n\n-   `os \u003c\u003c fixed;`\n\n    设置写入浮点数时严格保留 `setprecision` 时设置的位数。\n\n-   `os \u003c\u003c defaultfloat;`\n\n    设置写入浮点数时不严格保留 `setprecision` 时设置的位数。\n\n-   `os \u003c\u003c bin;` `os \u003c\u003c oct;` `os \u003c\u003c dec;` `os \u003c\u003c hex;`\n\n    按 2、8、10、16 进制写入整数。\n\n-   `os \u003c\u003c lowercase;`\n\n    写入特殊内容时使用大写。\n\n-   `os \u003c\u003c uppercase;`\n\n    写入特殊内容时使用小写。\n\n-   `os \u003c\u003c showbase;`\n\n    写入 2、8、16 进制的数时，在前面显示 `0b` `0` `0x`。\n\n-   `os \u003c\u003c noshowbase;`\n\n    写入 2、8、16 进制的数时，不在前面显示 `0b` `0` `0x`。\n\n-   `os \u003c\u003c setbase(n);`\n\n    按 `base` 进制写入数，超出范围默认 10 进制 $(2 \\le base \\le 36)$。\n\n-   `os \u003c\u003c setw(n);`\n\n    设置下一次写入宽度若小于 `width`，就填补字符（下一次写入重置）。\n\n-   `os \u003c\u003c setfill(c);`\n\n    设置 `setw` 填补的字符，默认为空格。\n\n-   `os \u003c\u003c left;`\n\n    设置 `setw` 填补的字符在左边。\n\n-   `os \u003c\u003c right;`\n\n    设置 `setw` 填补的字符在右边。\n\n-   `os \u003c\u003c setprecision(n);`\n\n    设置浮点数保留位数，默认保留 3 位。\n\n-   `os \u003c\u003c reset;`\n\n    取消前面的所有设置。\n\n-   `ifstream ifs(s);`\n\n    创建文件读流，文件路径为 `s`，和普通读流用法相同。\n\n-   `ofstream ofs(s);`\n\n    创建文件写流，文件路径为 `s`，和普通写流用法相同。\n\n# 3. 接口\n\n可以用接口来重载运算符。\n\n**注意要用 `fastio::interface::istream` `fastio::interface::ostream` 来重载。**\n\n以下是重载 `std::tuple` 的示例程序。\n\n```cpp\nusing namespace fastio;\ntemplate \u003ctypename... TS\u003e\ninterface::istream \u0026operator\u003e\u003e(interface::istream \u0026is, std::tuple\u003cTS...\u003e \u0026a) {\n    std::apply([\u0026](auto \u0026\u0026...args) { ((is \u003e\u003e args), ...); }, a);\n    return is;\n}\ntemplate \u003ctypename... TS\u003e\ninterface::istream \u0026operator\u003e\u003e(interface::istream \u0026is, std::tuple\u003cTS...\u003e \u0026\u0026a) {\n    std::apply([\u0026](auto \u0026\u0026...args) { ((is \u003e\u003e args), ...); }, a);\n    return is;\n}\ntemplate \u003ctypename... TS\u003e\ninterface::ostream \u0026operator\u003c\u003c(interface::ostream \u0026os, std::tuple\u003cTS...\u003e const \u0026a) {\n    std::apply([\u0026](auto \u0026\u0026...args) { ((os \u003c\u003c args \u003c\u003c ' '), ...); }, a);\n    return os;\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fargvchs%2Ffastio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fargvchs%2Ffastio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fargvchs%2Ffastio/lists"}