aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities/data-formatter/parray/main.cpp
blob: 63001eb3f96386ff7fc350fd0e426994375ab6cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <functional>
#include <stdlib.h>

template<typename ElemType>
ElemType* alloc(size_t count, std::function<ElemType(size_t)> get)
{
  ElemType *elems = new ElemType[count];
  for(size_t i = 0; i < count; i++)
    elems[i] = get(i);
  return elems;
}

int main (int argc, const char * argv[])
{
  int* data = alloc<int>(5, [] (size_t idx) -> int {
    return 2 * idx + 1;
  });
  return 0; // break here
}