{"id":47025955,"url":"https://github.com/lsp-plugins/lsp-lltl-lib","last_synced_at":"2026-03-11T23:04:02.317Z","repository":{"id":37233959,"uuid":"253744252","full_name":"lsp-plugins/lsp-lltl-lib","owner":"lsp-plugins","description":"Low-level template library for basic data collections used in LSP Project","archived":false,"fork":false,"pushed_at":"2026-02-04T19:44:28.000Z","size":542,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-05T07:44:35.430Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lsp-plugins.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":".github/FUNDING.yml","license":"COPYING","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"liberapay":"sadko4u","patreon":"sadko4u","custom":["https://www.blockchain.com/btc/address/15X3AfDRF3EshSLBoK8UfHAsFr2TQsH8pk","https://etherscan.io/address/0x079b24da78d78302cd3cfbb80c728cd554606cc6","https://www.bountysource.com/teams/lsp-plugins","https://paypal.me/sadko4u"]}},"created_at":"2020-04-07T09:16:15.000Z","updated_at":"2025-12-20T11:21:25.000Z","dependencies_parsed_at":"2023-11-12T12:25:20.459Z","dependency_job_id":"72fbd8c8-32d5-43d1-9dee-41e703269fbb","html_url":"https://github.com/lsp-plugins/lsp-lltl-lib","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/lsp-plugins/lsp-lltl-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsp-plugins%2Flsp-lltl-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsp-plugins%2Flsp-lltl-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsp-plugins%2Flsp-lltl-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsp-plugins%2Flsp-lltl-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsp-plugins","download_url":"https://codeload.github.com/lsp-plugins/lsp-lltl-lib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsp-plugins%2Flsp-lltl-lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30406401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T22:36:59.286Z","status":"ssl_error","status_checked_at":"2026-03-11T22:36:57.544Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-03-11T23:04:01.472Z","updated_at":"2026-03-11T23:04:02.308Z","avatar_url":"https://github.com/lsp-plugins.png","language":"C++","funding_links":["https://liberapay.com/sadko4u","https://patreon.com/sadko4u","https://www.blockchain.com/btc/address/15X3AfDRF3EshSLBoK8UfHAsFr2TQsH8pk","https://etherscan.io/address/0x079b24da78d78302cd3cfbb80c728cd554606cc6","https://www.bountysource.com/teams/lsp-plugins","https://paypal.me/sadko4u"],"categories":[],"sub_categories":[],"readme":"# lsp-lltl-lib\n\nLow-level Template Library (LLTL) for basic data collections used in LSP Project\n\nThis library does not aim to repeat STL. It aims to replace some important\nparts of STL with generalized templates (generics). Since STL template \ninstantiation may blow up the code with many additional functions, this library\ntries to economy code space used by collections by generalizing data pointers.\n\n## The Paradigm\n\nLet's look at the paradigm by taking `std::vector` as example.\n\nFor STL `std::vector\u003cchar\u003e` and `vector\u003cint\u003e` are different\ntypes, so they will have different instances, so the code:\n\n```C++\nstd::vector\u003cchar\u003e a;\nstd::vector\u003cint\u003e b;\n\na.push_back('a'); // Instance 1\nb.push_back(42); // Instance 2\n\n```\n\nwill instantiate two `push_back` functions. Moreover, the code will get blown up\nif these functions will get inlined.\n\nThe basic idea is, to generalize `std::vector` with two instances: a raw container\nof data structures `lsp::lltl::raw_darray` and a raw container of pointers `lsp::lltl::raw_parray`.\nThese data structures are classic 'C' data structures inside and use `malloc`/`free` memory allocation\ninstead of `new[]`/`delete[]`. That makes the final code exception-safe. \n\nBoth raw containers define their template adaptors - `lsp::lltl::darray\u003cT\u003e` and `lsp::lltl::parray\u003cT\u003e`\nwhich declare inline methods that finally call methods of `lsp::lltl::raw_darray` and\n`lsp::lltl::raw_parray` respectively.\n\nFinally, the code above can be replaced with the following code snippet:\n\n```C++\nusing namespace lsp;\n\nlltl::darray\u003cchar\u003e a;\nlltl::darray\u003cint\u003e b;\n\na.push('a'); // Using one of the available instances of lsp::lltl::raw_darray::add()\nb.push(42);  // Using the same instance of lsp::lltl::raw_darray::add()\n\n```\n\n**IMPORTANT!** Data structures do store plain data and do not call any constructors/destructors\nto initialize/free data. This responsibility is delegated to the caller code (if not said otherwise).\n\nAlso, for automatic managment of objects and lookup, additional interfaces like `lsp::lltl::hash_spec`,\n`lsp::lltl::compare_spec` and `lsp::lltl::allocator_spec` should be defined.\n\n## Library Contents\n\nAvailable collections:\n  - `lltl::bitset` - set of bits stored in the optimal for the CPU form for quick data processing \n                       and memory economy. \n  - `lltl::darray` - dynamic array of plain data structures of the same type.\n  - `lltl::ddeque` - double-end queue of plain data structures of the same type.\n  - `lltl::hash_index` - the hash container for associating two pointers one to another.\n  - `lltl::parray` - dynamic array of pointers to any data structure of the same base type.\n  - `lltl::phashset` - hash set of pointers, each pointer is managed by the caller.\n  - `lltl::pphash` - pointer to pointer hash map, where keys are managed automatically and values\n                       are managed by caller.\n  - `lltl::ptrset` - set for organize quick storage of raw pointers.\n  - `lltl::shbuffer` - shared buffer for operating on memory.\n\n\nCollection access:\n  - `lltl::iterator` - iterator class for sequential data access.\n\nAvailable inter-process and inter-thread primitive communications:\n  - `lltl::state` - object for safe state transfer between Real-time and non-realtime thread.\n\nData manipulation interfaces:\n  - `lltl::hash_iface` - inferface for defining hash function for the object.\n  - `lltl::compare_iface` - interface for defining comparison routine for the object.\n  - `lltl::allocator_iface` - interface for defining allocation (creating cloned copy) \n                                 and deallocation of the object.\n  - `lltl::initializer_iface` - interface for defining initialization, copying and finalization of\n                                 in-place stored objects. \n\nAvailable hashing functions:\n  - `lltl::default_hash_func` - default hashing function used for any object if hashing specification\n                                   for the object is not defined.\n  - `lltl::ptr_hash_func` - hashing function for pointers (considering that it uniquely identifies the\n                               object the pointer points to).\n  - `lltl::char_hash_func` - hashing function for C strings present as `char *` or `const char *` types.\n  \nAvailable comparison functions:\n  - `lltl::char_cmp_func` - comparison function for C strings present as `char *` or `const char *` types.\n  - `lltl::ptr_cmp_func` - comparisoin function for pointers (considering that it uniquely identifies the\n                               object the pointer points to).\n\nAvailable allocation functions:\n  - `lltl::char_copy_func` - function for copying C strings\n\nRequired specifications:\n  - `lltl::hash_spec` - specification for computing hash value of the object, required by:\n    - `lltl::pphash` for key object,\n    - `lltl::phashset` for value object\n  - `lltl::compare_spec` - specification for comparing two objects, required by:\n    - `lltl::pphash` for key object,\n    - `lltl::phashset` for value object\n  - `lltl::allocator_spec` - specification for allocation (creating copy) and deallocation\n                                of the object, required by:\n    - `lltl::pphash` for key object\n\n## Requirements\n\nThe following packages need to be installed for building:\n\n* gcc \u003e= 4.9\n* make \u003e= 4.0\n\n## Building\n\nTo build the library, perform the following commands:\n\n```bash\nmake config # Configure the build\nmake fetch # Fetch dependencies from Git repository\nmake\nsudo make install\n```\n\nTo get more build options, run:\n\n```bash\nmake help\n```\n\nTo uninstall library, simply issue:\n\n```bash\nmake uninstall\n```\n\nTo clean all binary files, run:\n\n```bash\nmake clean\n```\n\nTo clean the whole project tree including configuration files, run:\n\n```bash\nmake prune\n```\n\nUsage\n=======\n\nAn example of transaction-safe widget creation:\n\n```C++\n#include \u003cstdlib.h\u003e\n#include \u003clsp-plug.in/lltl/parray.h\u003e\n\n\nclass Widget; // Some widget class\n\nWidget *create(const char *type); // Some abstract factory\n\nusing namespace lsp;\n\nbool add_widget(lltl::parray\u003cWidget\u003e \u0026v, const char *type)\n{\n    Widget *w = create(type);\n    if (!w)\n        return false;\n    if (v.add(w))\n        return true;\n    \n    delete w;\n    return false;\n}\n\n// Create form and replace all widgets in the passed list with\n// new ones\nbool create_form(lltl::parray\u003cWidget\u003e \u0026list)\n{\n    lltl::parray\u003cWidget\u003e v;\n\n    // Create widgets\n    bool res = add_widget(v, \"label\");\n    res \u0026= add_widget(v, \"edit\");\n    res \u0026= add_widget(v, \"label\");\n    res \u0026= add_widget(v, \"edit\");\n\n    // Commit the transaction\n    if (res)\n        list.swap(v);\n    \n    // Perform garbage collection\n    for(size_t i=0, n=v.size(); i\u003cn; ++i)\n    \tdelete v[i];\n    \n    return res;\n}\n\n\n```\n\n## SAST Tools\n\n* [PVS-Studio](https://pvs-studio.com/en/pvs-studio/?utm_source=website\u0026utm_medium=github\u0026utm_campaign=open_source) - static analyzer for C, C++, C#, and Java code.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsp-plugins%2Flsp-lltl-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsp-plugins%2Flsp-lltl-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsp-plugins%2Flsp-lltl-lib/lists"}