diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-05-28 12:46:51 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-05-28 12:46:51 -0400 |
| commit | 3612806d5ea470f5dd2fb5a6e7f5be9de716a67e (patch) | |
| tree | 2f41f52b40059bf05013f30194201934c446864a /pk.h.in | |
| parent | b9f23559d8bc36356ea0b6264c91d82dba3fb74d (diff) | |
pktmpln: first-pass, adds _1, _2, and _3
Diffstat (limited to 'pk.h.in')
| -rw-r--r-- | pk.h.in | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -251,6 +251,27 @@ * arr.~pk_bkt_arr<int>(); // manually call dtor for globals * ``` * +******************************************************************************** +* pktmpl.h: only contains c++ templates, no IMPL. +* +* Provides template structs for trampolines, allowing c-style callbacks with +* capturing lambdas. +* +* Examples: +* ```c++ +* int some_counter = 0; +* using IterCbWrapper = pk_tmpln_1<void, int*, void*>; +* IterCbWrapper cb_wrapper{}; +* cb_wrapper.func = [&some_counter](int *lhs) +* { +* (void)lhs; +* some_counter += 1; +* return; +* }; +* pk_bkt_arr_iterate(&bkt_arr, &IterCbWrapper::invoke, &cb_wrapper); +* assert(some_count == 1); +* ``` +* *******************************************************************************/ #define PK_VERSION "@@PK_VERSION@@" |
