codex
|
This program demonstrates the use of a mutable lambda expression to copy multiple sources passed as variadic template arguments into a single output byte array. The context where it originally appeared was populating a byte buffer to be sent to the GPU via OpenCL:
The implementation is very concise, taking advantage of several language features such as automatic type deduction for template parameters, fold expressions, STL algorithms, and the aforementioned mutable lambda expression:
arg_size
and arg_ptr
are small helper functions that add support for copying both arithmetic and range types (the original implementation also supports a few additional parameter types).