Bosma / Scheduler

Modern C++ Scheduling Library
MIT License
273 stars 75 forks source link

Passing arguments to schedules #13

Closed Mitchell-Hampton closed 6 years ago

Mitchell-Hampton commented 6 years ago

Hello,

Is there a way to pass arguments to the schedules.

I want to do something similar to the following: for (int i = 0; i < 10; i++) s.cron(" *", []() { std::cout << "top of every minute "<< i << std::endl; });

however this will have all the schedules print 9.

Mitchell-Hampton commented 6 years ago

I was able to get it to work with s.cron(temp_cron, [&, i]() {std::cout << "top of every minute "<< i << std::endl; });