To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

lambda2.cpp 227 Bytes
Newer Older
Donjan Rodic's avatar
Donjan Rodic committed
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <thread>

int main()
{
  // create a function and store a pointer to it in f
  auto f = []() {std::cout << "Hello world!\n";};
  
  // call the function in a thread
  std::thread t(f);
  t.join();
}