{"id":16139824,"url":"https://github.com/bluescarni/tanuki","last_synced_at":"2025-03-18T16:31:14.390Z","repository":{"id":195560554,"uuid":"693050398","full_name":"bluescarni/tanuki","owner":"bluescarni","description":"A type-erasure toolkit for C++20","archived":false,"fork":false,"pushed_at":"2025-03-02T20:04:03.000Z","size":5287,"stargazers_count":19,"open_issues_count":3,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-16T22:03:14.204Z","etag":null,"topics":["concepts","cpp20","modern-cpp","type-erasure"],"latest_commit_sha":null,"homepage":"https://bluescarni.github.io/tanuki/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bluescarni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2023-09-18T08:44:40.000Z","updated_at":"2025-03-06T01:54:09.000Z","dependencies_parsed_at":"2023-10-10T22:59:52.670Z","dependency_job_id":"3f512692-b12e-4532-972a-62c533fb30bd","html_url":"https://github.com/bluescarni/tanuki","commit_stats":null,"previous_names":["bluescarni/tanuki"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluescarni%2Ftanuki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluescarni%2Ftanuki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluescarni%2Ftanuki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluescarni%2Ftanuki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluescarni","download_url":"https://codeload.github.com/bluescarni/tanuki/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244259924,"owners_count":20424639,"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":["concepts","cpp20","modern-cpp","type-erasure"],"created_at":"2024-10-09T23:49:53.369Z","updated_at":"2025-03-18T16:31:13.395Z","avatar_url":"https://github.com/bluescarni.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"tanuki\n======\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/bluescarni/tanuki/gha.yml?branch=main\u0026style=for-the-badge)](https://github.com/bluescarni/tanuki/actions?query=workflow%3A%22GitHub+CI%22)\n[![Build Status](https://img.shields.io/circleci/project/github/bluescarni/tanuki/main.svg?style=for-the-badge)](https://circleci.com/gh/bluescarni/tanuki)\n![language](https://img.shields.io/badge/language-C%2B%2B20-blue.svg?style=for-the-badge)\n[![Code Coverage](https://img.shields.io/codecov/c/github/bluescarni/tanuki.svg?style=for-the-badge)](https://codecov.io/github/bluescarni/tanuki?branch=main)\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n  \u003cp align=\"center\"\u003e\n    A type-erasure toolkit for C++20\n    \u003cbr /\u003e\n    \u003ca href=\"https://bluescarni.github.io/tanuki/index.html\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/bluescarni/tanuki/issues/new/choose\"\u003eReport bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/bluescarni/tanuki/issues/new/choose\"\u003eRequest feature\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/bluescarni/tanuki/discussions\"\u003eDiscuss\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\u003e [tanukis](https://en.wikipedia.org/wiki/Japanese_raccoon_dog) are a kind of supernatural beings found in the\n\u003e classics and in the folklore and legends of various places in Japan. They are reputed to be mischievous and jolly,\n\u003e masters of disguise and shapeshifting but somewhat gullible and absent-minded.\n\ntanuki is a small, single-header and self-contained C++20/23 toolkit for\n[type-erasure](https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Type_Erasure).\nMain features include:\n\n- high configurability,\n- support for both value and reference semantics,\n- small object optimisation to avoid dynamic memory allocation,\n- the ability to type-erase references,\n- support for composite interfaces,\n- optional support for [Boost.serialization](https://www.boost.org/doc/libs/release/libs/serialization/doc/index.html).\n\nInterfaces are defined and implemented blending the familiar language of\ntraditional object-oriented programming (i.e., abstract base clasess,\ndefault implementations, single/multiple inheritance, etc.) with C++20 concepts.\n\nThe elevator pitch\n------------------\n\nHere is a minimal approximation of [std::any](https://en.cppreference.com/w/cpp/utility/any)\nin tanuki:\n\n```c++\n#include \u003cstring\u003e\n\n#include \u003ctanuki/tanuki.hpp\u003e\n\n// Interface implementation.\ntemplate \u003ctypename Base, typename Holder, typename T\u003e\nstruct any_iface_impl : public Base {\n};\n\n// Interface.\nstruct any_iface {\n    template \u003ctypename Base, typename Holder, typename T\u003e\n    using impl = any_iface_impl\u003cBase, Holder, T\u003e;\n};\n\nint main()\n{\n    using any_wrap = tanuki::wrap\u003cany_iface\u003e;\n\n    // Store an integer.\n    any_wrap w1(42);\n\n    // Store a string.\n    any_wrap w2(std::string(\"hello world\"));\n\n    // Store anything...\n    struct foo {\n    };\n    any_wrap w3(foo{});\n}\n```\n\n[Try it](https://godbolt.org/z/brh6rnnsY) on compiler explorer!\n\nDocumentation\n-------------\n\nThe full documentation can be found [here](https://bluescarni.github.io/tanuki).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluescarni%2Ftanuki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluescarni%2Ftanuki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluescarni%2Ftanuki/lists"}