{"id":20483367,"url":"https://github.com/styczynski/keyed-queue","last_synced_at":"2026-05-29T18:31:26.502Z","repository":{"id":79817389,"uuid":"116674693","full_name":"styczynski/keyed-queue","owner":"styczynski","description":"C++17 STL-friendly queue with map-like keys support","archived":false,"fork":false,"pushed_at":"2018-01-08T14:06:22.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T16:16:20.792Z","etag":null,"topics":["cpp-library","cpp17","datastructures","queue"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/styczynski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-01-08T12:37:12.000Z","updated_at":"2018-01-08T13:51:57.000Z","dependencies_parsed_at":"2023-09-13T22:28:09.095Z","dependency_job_id":null,"html_url":"https://github.com/styczynski/keyed-queue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/styczynski/keyed-queue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fkeyed-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fkeyed-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fkeyed-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fkeyed-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/styczynski","download_url":"https://codeload.github.com/styczynski/keyed-queue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fkeyed-queue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33666290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"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-library","cpp17","datastructures","queue"],"created_at":"2024-11-15T16:17:08.622Z","updated_at":"2026-05-29T18:31:26.494Z","avatar_url":"https://github.com/styczynski.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Keyed queue\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;[@styczynski](https://github.com/styczynski)\u0026nbsp;\u0026nbsp;\u0026nbsp;-\u0026nbsp;code of keyed_queue\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;[@kowaalczyk](https://github.com/kowaalczyk)\u0026nbsp;-\u0026nbsp;increadibly useful handful of tests\n\n## About\n\nThis library was written on the *Faculty of Mathematics, Informathics and Mechanics, Warsaw Univeristy*\u003cbr\u003e\nas a part of **JNP1** (en. Languages and Tools for Programming) subject during **2017/2018** term.\n\nClass `keyed_queue` implements (**copy-on-write**) queue with map-like keys support. \n\nIt provides **strong exception quarantee** for all the methods.\u003cbr\u003e\nThe guarantee does not support throwing destructors of key or value.\n\n## Interface\n\n**keyed_queue\u003ctypename K, typename V\u003e** class implements the following methods:\n\n- **void push(K const \u0026k, V const \u0026v)**\u003cbr\u003e\n   Inserts value v to the end of the queue assigning the key k. \n\n\n- **void pop()**\u003cbr\u003e\n   Removes first element from the queue. If the queue is empty then `lookup_error` is thrown.\n\n\n- **void pop(K const \u0026)**\u003cbr\u003e\n   Removes the first element from the queue that has the given key value. If no element with such key exists in the queue then `lookup_error` is thrown.\n\n\n- **void move_to_back(K const \u0026k)**\u003cbr\u003e\n   Moves the elements with the given key to the end of the queue preserving their relative order. If no element with the provided key exists in the queue then `lookup_error` is thrown.\n\n\n- **std::pair\u003cK const \u0026, V \u0026\u003e  front()**\u003cbr\u003e\n   Returns key, value pair for element at the queue front. If the queue is empty then `lookup_error` is thrown. This method allows value modification by reference. Any writing operation performed on the queue may invalidate captured references. Value is unmodificable in `const` version of the method.\n\n- **std::pair\u003cK const \u0026, V \u0026\u003e  back()**\u003cbr\u003e\n   Returns key, value pair for element at the queue back. If the queue is empty then `lookup_error` is thrown. This method allows value modification by reference. Any writing operation performed on the queue may invalidate captured references. Value is unmodificable in `const` version of the method.\n\n- **std::pair\u003cK const \u0026, V \u0026\u003e front(K const\u0026)**\u003cbr\u003e\n   Returns key, value pair for the first element on the queue with the given key. If the queue is empty or does not contain any element with the given key then `lookup_error` is thrown. This method allows value modification by reference. Any writing operation performed on the queue may invalidate captured references. Value is unmodificable in `const` version of the method.\n\n- **std::pair\u003cK const \u0026, V \u0026\u003e last(K const\u0026)**\u003cbr\u003e\n   Returns key, value pair for the last element on the queue with the given key. If the queue is empty or does not contain any element with the given key then `lookup_error` is thrown. This method allows value modification by reference. Any writing operation performed on the queue may invalidate captured references. Value is unmodificable in `const` version of the method.\n\n- **size_t size()**\u003cbr\u003e\n   Returns the number of elements on the queue\n\n\n- **bool empty()**\u003cbr\u003e\n   Returns true if the queue is empty\n\n\n- **void clear()**\u003cbr\u003e\n   Clears the queue\n\n- **size_t count(K const \u0026)**\u003cbr\u003e\n   Counts elements with the given key\n\n- **keyed_queue::k_iterator k_begin()**\u003cbr\u003e\n   Returns iterator to the first element in the queue. Can be used to iterate queue in STL-like style.\n\n- **keyed_queue::k_iterator k_end()**\u003cbr\u003e\n   Returns past-the-end iterator to the queue. Can be used to iterate queue in STL-like style.\n\n# Building\n\nThe examples require the **GCC 7.2.0** compiler to be built.\u003cbr\u003e \nOther versions may work but they do not have to.\u003cbr\u003e\nLibrary itself is portable but the makefile is not. \n\n* Use **make all** to build all examples\n* Use **make run-basic-usage** and **make run-\u003cname\u003e** to run the compiled examples\n* Use **make clean** to clean the build\n\n# Example usage \n\n```c++\n#include \"keyed_queue.h\"\n#include \u003cvector\u003e\n#include \u003cmemory\u003e\n#include \u003ciostream\u003e\n\nint main() {\n\n   keyed_queue\u003cint, int\u003e q1;\n\n   q1.push(1, 1);\n   std::cout \u003c\u003c q1.to_string() \u003c\u003c \"\\n\";\n\n   keyed_queue\u003cint, int\u003e q2 = q1;\n   std::cout \u003c\u003c q2.to_string() \u003c\u003c \"\\n\";\n\n   q1.push(2, 2);\n   std::cout \u003c\u003c q1.to_string() \u003c\u003c \"\\n\";\n\n   q2.push(3, 3);\n   std::cout \u003c\u003c q2.to_string() \u003c\u003c \"\\n\";\n\n   q2.move_to_back(1);\n   std::cout \u003c\u003c q2.to_string() \u003c\u003c \"\\n\";\n\n   return 0;\n}\n    \n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyczynski%2Fkeyed-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstyczynski%2Fkeyed-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyczynski%2Fkeyed-queue/lists"}