1#include <functional>
2#include <stdlib.h>
3
4template<typename ElemType>
5ElemType* alloc(size_t count, std::function<ElemType(size_t)> get)
6{
7 ElemType *elems = new ElemType[count];
8 for(size_t i = 0; i < count; i++)
9 elems[i] = get(i);
10 return elems;
11}
12
13int main (int argc, const char * argv[])
14{
15 int* data = alloc<int>(count: 5, get: [] (size_t idx) -> int {
16 return 2 * idx + 1;
17 });
18 return 0; // break here
19}
20
21

source code of lldb/test/API/functionalities/data-formatter/parray/main.cpp