{"id":15047563,"url":"https://github.com/andreiavrammsd/cpp-zip","last_synced_at":"2026-03-11T04:02:23.742Z","repository":{"id":255671144,"uuid":"849849295","full_name":"andreiavrammsd/cpp-zip","owner":"andreiavrammsd","description":"C++17 zip view and iterator","archived":false,"fork":false,"pushed_at":"2024-09-08T06:30:25.000Z","size":260,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-07T11:44:59.160Z","etag":null,"topics":["cpp","cpp17","iterator","view","zip","zip-iterator","zip-view"],"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/andreiavrammsd.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":"2024-08-30T11:23:42.000Z","updated_at":"2024-09-07T10:12:46.000Z","dependencies_parsed_at":"2024-09-06T17:09:48.243Z","dependency_job_id":"f10899a9-8774-4baf-b151-7e72cf24b2c6","html_url":"https://github.com/andreiavrammsd/cpp-zip","commit_stats":null,"previous_names":["andreiavrammsd/cpp-zip"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andreiavrammsd/cpp-zip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreiavrammsd%2Fcpp-zip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreiavrammsd%2Fcpp-zip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreiavrammsd%2Fcpp-zip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreiavrammsd%2Fcpp-zip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreiavrammsd","download_url":"https://codeload.github.com/andreiavrammsd/cpp-zip/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreiavrammsd%2Fcpp-zip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30370267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"online","status_checked_at":"2026-03-11T02:00:07.027Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cpp","cpp17","iterator","view","zip","zip-iterator","zip-view"],"created_at":"2024-09-24T21:00:22.002Z","updated_at":"2026-03-11T04:02:23.725Z","avatar_url":"https://github.com/andreiavrammsd.png","language":"C++","readme":"# ZIP\n\n[![test](https://github.com/andreiavrammsd/cpp-zip/workflows/test/badge.svg)](https://github.com/andreiavrammsd/cpp-zip/actions/workflows/test.yml)\n\u0026nbsp;\u0026nbsp;[![release](https://github.com/andreiavrammsd/cpp-zip/workflows/release/badge.svg)](https://github.com/andreiavrammsd/cpp-zip/actions/workflows/release.yml)\n\u0026nbsp;\u0026nbsp;[![codecov](https://codecov.io/github/andreiavrammsd/cpp-zip/graph/badge.svg?token=TBV8ID8QK0)](https://codecov.io/github/andreiavrammsd/cpp-zip)\n\u0026nbsp;\u0026nbsp;[![documentation](https://img.shields.io/badge/msd::zip-Documentation-4EC820?labelColor=5E5E5E)](https://andreiavrammsd.github.io/cpp-zip/)\n\n## What\n\nAn implementation of [zip](https://en.cppreference.com/w/cpp/ranges/zip_view) for C++17. Single header file.\n\n## Why\n\nLearning purposes.\n\n## Status\n\nIn development. Needs proper testing.\n\n## Install\n\nIntegrate with CMake or just copy the [header file](https://github.com/andreiavrammsd/cpp-zip/tree/master/include/msd/zip.hpp).\n\n## Usage and Documentation\n\n```c++\n#include \u003cmsd/zip.hpp\u003e\n\n#include \u003calgorithm\u003e\n#include \u003ccassert\u003e\n#include \u003cvector\u003e\n\nint main() {\n    std::vector actual_numbers = {1, 2, 3};\n    std::vector expected_numbers = {1, 2, 3};\n\n    const std::size_t size = std::min(actual_numbers.size(), expected_numbers.size());\n    for (std::size_t i = 0; i \u003c size; ++i) {\n        assert(actual_numbers[i] == expected_numbers[i]);\n    }\n\n    // vs\n\n    for (auto [actual, expected] : msd::zip(actual_numbers, expected_numbers)) {\n        assert(actual == expected);\n    }\n}\n\n```\n\nFor more, see [tests](https://github.com/andreiavrammsd/cpp-zip/blob/master/tests) and [documentation](https://andreiavrammsd.github.io/cpp-zip/).\n\n## Known issues\n\n### Calling std::prev on an msd::zip object compiles, but fails at runtime on some std containers.\n\n* list\n* forward_list\n* unordered_set\n* unordered_multiset\n* unordered_map\n* unordered_multimap\n\nThe `msd::zip` iterator is bidirectional to better control when you want to stop iterating.\n\nTo get only some of the elements from a C++23 zip, you can use `std::views::take`:\n```c++\nstd::forward_list\u003cint\u003e first_list{1, 2, 3, 4, 5};\nstd::forward_list\u003cint\u003e second_list{1, 2, 3, 4};\nauto forward_zip = std::views::zip(first_list, second_list);\n\nfor (auto [a, b] : forward_zip | std::views::take(3)) {\n    std::cout \u003c\u003c a \u003c\u003c \", \" \u003c\u003c b \u003c\u003c \"\\n\";\n}\n```\n\nWith `msd::zip`, you can write:\n```c++\nfor (auto it = forward_zip.begin(); it != std::prev(forward_zip.end()); ++it) {\n    auto [a, b] = *it;\n    std::cout \u003c\u003c a \u003c\u003c \", \" \u003c\u003c b \u003c\u003c \"\\n\";\n}\n```\nBut it does not work with the mentioned containers.\n\n### Post-increment operator missing\n\n```c++\n// Working\nfor (auto it = zip.begin(); it != zip.end(); ++it) {}\n\n// Not working\nfor (auto it = zip.begin(); it != zip.end(); it++) {}\n```\n\n## Development\n\n### Tools\n* [SSH keys for GitHub](https://help.ubuntu.com/community/SSH/OpenSSH/Keys) (~/.ssh)\n* [VS Code](https://code.visualstudio.com/) (see [.vscode/extensions.json](https://github.com/andreiavrammsd/cpp-zip/blob/master/.vscode/extensions.json))\n* [Docker](https://docs.docker.com/engine/install/ubuntu/)\n\n### Actions\n* Debug: F5\n* Coverage: Ctrl + Shift + P -\u003e Run Task -\u003e Generate Coverage Report\n  * Show coverage inline: Ctrl + Shift + 7 OR Ctrl + Shift + P -\u003e Coverage Gutters: Display Coverage\n  * Coverage as HTML: See build/coverage_html/index.html\n* Clang tidy: Ctrl + Shift + P -\u003e Run Task -\u003e Run clang-tidy on current file\n* Documentation: Ctrl + Shift + P -\u003e Run Task -\u003e Generate Documentation\n\n## TODO\n\n* Set up cache for release workflow (apt cache)\n* Exception guarantees: set and document\n* constexpr\n* Write benchmarks\n* Ignore google headers from clang-tidy\n* Consider checked access that returns an optional reference\n* Run clang-tidy on file save\n* Cancel running jobs on new commit\n* Investigate possible documentation issue: [cp: no such file or directory](https://github.com/andreiavrammsd/cpp-zip/actions/runs/10673792787/job/29583324820)\n* Test\n    * Analyze if LCOV_EXCL_LINE is needed\n    * Iterator operations: +, -, +=, -=, ++ pre/post, --pre/post, std::prev/next/advance, begin() + size() - begin(), etc.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreiavrammsd%2Fcpp-zip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreiavrammsd%2Fcpp-zip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreiavrammsd%2Fcpp-zip/lists"}