{"id":20827239,"url":"https://github.com/raphiara/circ_buffer","last_synced_at":"2025-08-16T18:07:05.210Z","repository":{"id":44706959,"uuid":"453255203","full_name":"RaphiaRa/circ_buffer","owner":"RaphiaRa","description":"STL-like circular buffer ","archived":false,"fork":false,"pushed_at":"2025-07-11T19:31:03.000Z","size":31,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-11T21:21:59.908Z","etag":null,"topics":["circular-buffer","container","cpp","cpp11","ring-buffer","stl-like"],"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/RaphiaRa.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}},"created_at":"2022-01-29T00:17:01.000Z","updated_at":"2025-07-11T19:31:07.000Z","dependencies_parsed_at":"2023-02-09T12:45:22.480Z","dependency_job_id":null,"html_url":"https://github.com/RaphiaRa/circ_buffer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RaphiaRa/circ_buffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaphiaRa%2Fcirc_buffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaphiaRa%2Fcirc_buffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaphiaRa%2Fcirc_buffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaphiaRa%2Fcirc_buffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RaphiaRa","download_url":"https://codeload.github.com/RaphiaRa/circ_buffer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaphiaRa%2Fcirc_buffer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270749193,"owners_count":24638673,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"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":["circular-buffer","container","cpp","cpp11","ring-buffer","stl-like"],"created_at":"2024-11-17T23:11:33.263Z","updated_at":"2025-08-16T18:07:05.181Z","avatar_url":"https://github.com/RaphiaRa.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# circ_buffer\n**Requirements**  \nA compiler that supports at least C++11\n\n**Installation**  \nCopy the header file into your project and rename the namespace to whatever you want.\n\n**Usage**  \nThe usage of the circular buffer is similar to that of a STL container.\nThe circular buffer is initialized with a fixed buffer size, no hidden allocations\nare done while using the circular buffer. Just like with STL containers, a custom allocator can be used if needed (std::allocator is used by default).\n```c++\n#include \"circ_buffer.hpp\"\n#include \u003ciostream\u003e\nint main()\n{\n    raphia::circ_buffer\u003cchar\u003e circ(64);\n    circ.push_back('h');\n    circ.push_back('e');\n    circ.push_back('l');\n    circ.push_back('l');\n    circ.push_back('o');\n\n    for (auto c : circ)\n        std::cout \u003c\u003c c;\n    std::cout \u003c\u003c std::endl;\n}\n```\nOutput:\n```bash\n\u003e\u003e hello\n```\n\nIf data is pushed into the buffer via push_back and the buffer is out of space, then\nthe data at the beginning will be overwritten.\n\n```c++\nint main()\n{\n    raphia::circ_buffer\u003cchar\u003e circ(4);\n    circ.push_back('h');\n    circ.push_back('e');\n    circ.push_back('l');\n    circ.push_back('l');\n    circ.push_back('o');\n\n    for (auto c : circ)\n        std::cout \u003c\u003c c;\n    std::cout \u003c\u003c std::endl;\n}\n```\nOutput:\n```bash\n\u003e\u003e ello\n```\nThe behaviour is similar when emblace_back is used.\nOn the contrary, if data is pushed into the buffer via push_front, then\nthe data in the back will be overwritten if the buffer is full.\n\n**Building \u0026 running the tests**\n```bash\ngit clone git@github.com:RaphiaRa/circ_buffer.git\nmkdir circ_buffer/build; cd circ_buffer/build;\ngit submodule update --init\ncmake ../\nmake\n./Test\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphiara%2Fcirc_buffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphiara%2Fcirc_buffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphiara%2Fcirc_buffer/lists"}