From 3612806d5ea470f5dd2fb5a6e7f5be9de716a67e Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Wed, 28 May 2025 12:46:51 -0400 Subject: pktmpln: first-pass, adds _1, _2, and _3 --- pk.h.in | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'pk.h.in') 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(); // 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; +* 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@@" -- cgit v1.2.3