MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / apply_transform

Function apply_transform

tutorials/integration/cpp/07_callbacks.cpp:30–37  ·  view source on GitHub ↗

Apply a transform function to each element of an array. The block takes an int and returns an int.

Source from the content-addressed store, hash-verified

28// Apply a transform function to each element of an array.
29// The block takes an int and returns an int.
30void apply_transform(const TArray<int32_t> & arr, int32_t * results,
31 const TBlock<int32_t, int32_t> & blk,
32 Context * context, LineInfoArg * at) {
33 for (uint32_t i = 0; i < arr.size; ++i) {
34 // das_invoke<RetType>::invoke(ctx, lineinfo, block, args...)
35 results[i] = das_invoke<int32_t>::invoke(context, at, blk, arr[i]);
36 }
37}
38
39// A simpler example: call a void block with two arguments.
40void with_values(int32_t a, int32_t b,

Callers

nothing calls this directly

Calls 1

invokeFunction · 0.50

Tested by

no test coverage detected