Title: [Question, Suggestion] Would a variadic `zip()` be useful for the library? · Issue #2 · codereport/An-Algorithm-Library · GitHub
Open Graph Title: [Question, Suggestion] Would a variadic `zip()` be useful for the library? · Issue #2 · codereport/An-Algorithm-Library
X Title: [Question, Suggestion] Would a variadic `zip()` be useful for the library? · Issue #2 · codereport/An-Algorithm-Library
Description: A variadic zip() might make implementing other variadic algorithms easy in terms of existing stl algorithms. It might also be useful on its own. The function would take variadic number of ranges, and return a range that iterates over all...
Open Graph Description: A variadic zip() might make implementing other variadic algorithms easy in terms of existing stl algorithms. It might also be useful on its own. The function would take variadic number of ranges, a...
X Description: A variadic zip() might make implementing other variadic algorithms easy in terms of existing stl algorithms. It might also be useful on its own. The function would take variadic number of ranges, a...
Opengraph URL: https://github.com/codereport/An-Algorithm-Library/issues/2
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Question, Suggestion] Would a variadic `zip()` be useful for the library?","articleBody":"A variadic `zip()` might make implementing other variadic algorithms easy in terms of existing stl algorithms.\r\nIt might also be useful on its own.\r\n\r\nThe function would take variadic number of ranges, and return a range that iterates over all the input ranges, advancing all the input range iterators at each step, and yielding a tuple of values when dereferencing. The zipped range would only iterate until the shortest input range is consumed.\r\n\r\nFor example:\r\n```cpp\r\nauto a = std::vector{1, 2, 3, 4};\r\nauto b = std::vector{1, 2};\r\nauto zipped = zip(a, b);\r\nauto it = zipped.begin();\r\n\r\n*it == std::tuple{*a.begin(), *b.begin()};\r\n++it;\r\n*it == std::tuple{*(a.begin()+1), *(b.begin() + 1)};\r\n++it;\r\n(it != zipped.end()) == false; // b only had 2 elements\r\n```\r\n\r\nI played around a bit with the idea and wrote a little poc implementation https://godbolt.org/z/9oGWs9.\r\n\r\nPs. boost seems to have something similar https://www.boost.org/doc/libs/1_75_0/libs/iterator/doc/zip_iterator.html\r\n","author":{"url":"https://github.com/juntuu","@type":"Person","name":"juntuu"},"datePublished":"2021-02-28T13:06:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/2/An-Algorithm-Library/issues/2"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6425c8a0-08b2-a15c-d1a7-9bee00079a2a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C452:2630A2:1370B53:1AF8F49:6A4CADB4 |
| html-safe-nonce | b2c14c17fa6783d51f7cffb5e536c909635b76b55fe81efb0ee735144b80dc8c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNDUyOjI2MzBBMjoxMzcwQjUzOjFBRjhGNDk6NkE0Q0FEQjQiLCJ2aXNpdG9yX2lkIjoiNzkzOTMxNzU0OTU0MjgzNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 88bb1647574aab1be080f58b889a248b516d3e890131975103fbf2bb95d7507e |
| hovercard-subject-tag | issue:818202265 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/codereport/An-Algorithm-Library/2/issue_layout |
| twitter:image | https://opengraph.githubassets.com/03a6f0096df954fb600cd61f538d6addd83d0b8b334c124d943c83889168bdad/codereport/An-Algorithm-Library/issues/2 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/03a6f0096df954fb600cd61f538d6addd83d0b8b334c124d943c83889168bdad/codereport/An-Algorithm-Library/issues/2 |
| og:image:alt | A variadic zip() might make implementing other variadic algorithms easy in terms of existing stl algorithms. It might also be useful on its own. The function would take variadic number of ranges, a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | juntuu |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/codereport/An-Algorithm-Library git https://github.com/codereport/An-Algorithm-Library.git |
| octolytics-dimension-user_id | 36027403 |
| octolytics-dimension-user_login | codereport |
| octolytics-dimension-repository_id | 342963212 |
| octolytics-dimension-repository_nwo | codereport/An-Algorithm-Library |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 342963212 |
| octolytics-dimension-repository_network_root_nwo | codereport/An-Algorithm-Library |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ae90d426644ca15e89bacceb72e51f4e9dbf85f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width