summaryrefslogtreecommitdiff
path: root/pk.h.in
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-05-28 12:46:51 -0400
committerJonathan Bradley <jcb@pikum.xyz>2025-05-28 12:46:51 -0400
commit3612806d5ea470f5dd2fb5a6e7f5be9de716a67e (patch)
tree2f41f52b40059bf05013f30194201934c446864a /pk.h.in
parentb9f23559d8bc36356ea0b6264c91d82dba3fb74d (diff)
pktmpln: first-pass, adds _1, _2, and _3
Diffstat (limited to 'pk.h.in')
-rw-r--r--pk.h.in21
1 files changed, 21 insertions, 0 deletions
diff --git a/pk.h.in b/pk.h.in
index 5142c76..d255320 100644
--- a/pk.h.in
+++ b/pk.h.in
@@ -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@@"