Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (21 sloc) 550 Bytes
// Comple: g++ -std=c++14 test.cpp
// Usage: qsubarray ./a.out
#include <functional>
#include <iostream>
#include <vector>
using TaskList = std::vector<std::function<void()>>;
void submitJob(TaskList & taskList)
{
std::cout << "TUTHPCLIB4D:submit:" << taskList.size() << std::endl;
int idx;
std::cin >> idx;
if(idx >= 0 && idx < taskList.size())
taskList[idx]();
}
int main(void)
{
TaskList list;
for(int i = 0; i < 10; ++i)
list.push_back([=](){ std::cout << i << std::endl; });
submitJob(list);
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.