{"id":21861328,"url":"https://github.com/seng3694/deque","last_synced_at":"2025-10-26T07:39:31.000Z","repository":{"id":114139417,"uuid":"163074670","full_name":"Seng3694/Deque","owner":"Seng3694","description":"Simple implementation of a double-ended queue in C","archived":false,"fork":false,"pushed_at":"2019-02-11T02:09:49.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-26T14:50:11.198Z","etag":null,"topics":["c","cmake","deque","double-ended-queue"],"latest_commit_sha":null,"homepage":null,"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/Seng3694.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":"2018-12-25T10:55:24.000Z","updated_at":"2019-02-11T02:09:51.000Z","dependencies_parsed_at":"2023-06-14T07:15:26.706Z","dependency_job_id":null,"html_url":"https://github.com/Seng3694/Deque","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seng3694%2FDeque","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seng3694%2FDeque/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seng3694%2FDeque/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seng3694%2FDeque/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Seng3694","download_url":"https://codeload.github.com/Seng3694/Deque/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244860600,"owners_count":20522466,"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","cmake","deque","double-ended-queue"],"created_at":"2024-11-28T03:11:12.299Z","updated_at":"2025-10-26T07:39:25.977Z","avatar_url":"https://github.com/Seng3694.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Deque in C #\nSimple implementation of a [double-ended queue (deque)][2] in C.\n\nThis implementation uses a single array with a single allocation. You can use the `Deque_Resize` function to resize it or enable dynamic resizing.\n\n## How to use ##\n\n```C\n#include \u003cdeque.h\u003e\n\nint main(void)\n{\n    //create a deque with capacity 10\n    Deque* deque = Deque_Create(10);\n\n    //get the size of the deque\n    assert(Deque_GetSize(deque) == 0);\n    //get the capacity of the deque\n    assert(Deque_GetCapacity(deque) == 10);\n\n    //push something back\n    Deque_PushBack(deque, 1);\n    //push something front\n    Deque_PushFront(deque, 2);\n\n    assert(Deque_GetSize(deque) == 2);\n    assert(Deque_GetCapacity(deque) == 10);\n\n    //peek which value is at the back (without removing it)\n    assert(Deque_PeekBack(deque) == 1);\n\n    //peek which value is at the front (without removing it)\n    assert(Deque_PeekFront(deque) == 2);\n\n    assert(Deque_GetSize(deque) == 2);\n    assert(Deque_GetCapacity(deque) == 10);\n\n    //pop value at the back\n    assert(Deque_PopBack(deque) == 1);\n\n    //pop value at the front\n    assert(Deque_PopFront(deque) == 2);\n    \n    assert(Deque_GetSize(deque) == 0);\n    assert(Deque_GetCapacity(deque) == 10);\n\n    //resize internal array to 5\n    Deque_Resize(deque, 5);\n    assert(Deque_GetCapacity(deque) == 5);\n\n    //cleanup\n    Deque_Destroy(deque);\n\n    return 0;\n}\n```\n\nFor more insight you can check the [tests][4].\n\nIf you are building with [CMake][1] you can enable the `DYNAMIC_DEQUE` option with `-DDYNAMIC_DEQUE=ON`. \nThis automatically resizes the deque when you push values to it without enough capacity. An automatic resize resizes the internal array by 1.5 times the capacity.\nFor example you are pushing a value to a deque with a size and capacity of 10, the capacity will be resized to 15.\n\nThis option is **disabled** by default.\n\n## Build ##\n\nProject uses [CMake][1].\n\nYou can include this project as a submodule:\n\n```\ngit submodule add \"https://github.com/Seng3694/Deque\"\n```\n\nAnd then add the directory to your CMakeLists:\n```CMake\nadd_subdirectory(Deque)\n```\n\nAnd link it with your application:\n```CMake\ntarget_link_libraries(YOUR_TARGET Deque)\n```\n\nOr just embed it manually.\n\nExample cmake command for the dynamic deque:\n\n```\ncmake -G\"Visual Studio 15\" -DDYNAMIC_DEQUE=ON  YOUR/PROJECT/DIRECTORY\n```\n\nYou can also just enable it in CMake before including the subdirectory:\n```CMake\noption(DYNAMIC_DEQUE ON)\n```\n\n## License ##\nThis Code is licensed under the MIT License. See [LICENSE][3] for more information.\n\n[1]:http://www.cmake.org/\n[2]:https://en.wikipedia.org/wiki/Double-ended_queue\n[3]:LICENSE\n[4]:src/test.c","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseng3694%2Fdeque","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseng3694%2Fdeque","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseng3694%2Fdeque/lists"}