{"id":20205339,"url":"https://github.com/kaidokert/cpp-delegate","last_synced_at":"2025-11-30T04:03:17.253Z","repository":{"id":151160433,"uuid":"49393865","full_name":"kaidokert/cpp-delegate","owner":"kaidokert","description":"A short version of Elbert Mai's lightweight delegates/callbacks in C++11","archived":false,"fork":false,"pushed_at":"2018-01-18T13:31:30.000Z","size":38,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-10T10:26:08.931Z","etag":null,"topics":["cpp","cpp11","delegate","header-only"],"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/kaidokert.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":"2016-01-11T01:15:52.000Z","updated_at":"2018-12-28T11:05:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"41a51836-3000-4934-8546-c469069c68dc","html_url":"https://github.com/kaidokert/cpp-delegate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kaidokert/cpp-delegate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaidokert%2Fcpp-delegate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaidokert%2Fcpp-delegate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaidokert%2Fcpp-delegate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaidokert%2Fcpp-delegate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaidokert","download_url":"https://codeload.github.com/kaidokert/cpp-delegate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaidokert%2Fcpp-delegate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27376104,"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-11-30T02:00:05.582Z","response_time":55,"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","cpp11","delegate","header-only"],"created_at":"2024-11-14T05:17:00.515Z","updated_at":"2025-11-30T04:03:17.242Z","avatar_url":"https://github.com/kaidokert.png","language":"C++","readme":"# Delegate\n\n[![Travis Status](https://travis-ci.org/kaidokert/cpp-delegate.svg?branch=master)](https://travis-ci.org/kaidokert/cpp-delegate) [![Appveyor Status](https://ci.appveyor.com/api/projects/status/6k3s500lbwlrc03e?svg=true)](https://ci.appveyor.com/project/kaidokert/cpp-delegate) [![Coverage Status](https://coveralls.io/repos/kaidokert/cpp-delegate/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/kaidokert/cpp-delegate)\n\nElbert Mai's [generic callback/delegate](http://www.codeproject.com/Articles/136799/Lightweight-Generic-C-Callbacks-or-Yet-Another-Del), C++11 with no other dependencies except ``\u003cutility\u003e``. No exceptions/rtti/heap usage, and just about 100 lines of single header template code.\n\nThis is effectively a raw function pointer wrapped in a typesafe template and has no runtime code size or processing overhead with any of the compilers.\n\nImplementation patterned after version from this [smart function pointer article](http://www.codeproject.com/Articles/995916/A-Smart-Function-Pointer) and https://github.com/reiver-dev/cppcallback\n\nUse primarily through CREATE_DELEGATE macro:\n```cpp\nstruct foo {\n\tbool bar(int param) {  }\n};\nbool baz(int param) { }\n\nfoo foo_instance;\nauto delegate = CREATE_DELEGATE(\u0026foo::bar, \u0026foo_instance);\ndelegate(42);\ndelegate = CREATE_DELEGATE(\u0026baz);\ndelegate(90210);\nDelegate\u003cbool(int)\u003e call_me_maybe = delegate;\ncall_me_maybe(31337);\n```\n\nBuilt with maximum warnings on gcc, clang, msvc,  full test coverage\n\n### TODO\n* Add [Catch](https://github.com/philsquared/Catch) / [Lest](https://github.com/martinmoene/lest) tests\n* add gcc/arm build\n* add cpplint\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaidokert%2Fcpp-delegate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaidokert%2Fcpp-delegate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaidokert%2Fcpp-delegate/lists"}