Deleted functions have been introduced only recently to C++ -- see e.g. here on MSDN. Previously this was worked around by declaring the method as private. Whatever the way it is done, it means that someone declared an otherwise implicitly created method as deleted, so that nobody could (even accidentally) call it. This is used for example to disallow copying objects which it does not make sense to copy (by deleting the copy constructor).
This is exactly your case, as the deleted function's name ‘asio::basic_deadline_timer::basic_deadline_timer(const asio::basic_deadline_timer&)
indeed reveals that a copy constructor was supposed to be called. boost::deadline_timer
s cannot be copied.
But why is the timer object being copied? Because boost::bind
by default stores the bound parameters by value. If you need to pass a reference, you need to use boost::ref
as follows:
t1.async_wait(boost::bind(do_sth1,asio::placeholders::error,boost::ref(t1),boost::ref(count)));
I.e. even for the count variable, which would not cause a compiler error, but wouldn't work (would not modify the variable in main()
).