aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/main.cpp
blob: b2d6309947ada8d8ff96f1f6e785f2cae4b4969b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//===-- main.cpp -------------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#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
}