Commit 449daaceadc6bb9915381920ecd05d81e82fb88f

Authored by Grzegorz Jabłoński
1 parent 7472b5a4

C++ std cleanup

02-timer3.cpp
... ... @@ -10,7 +10,6 @@
10 10  
11 11 #include <iostream>
12 12 #include <asio.hpp>
13   -#include <boost/bind/bind.hpp>
14 13  
15 14 void print(const asio::error_code& /*e*/,
16 15 asio::steady_timer* t, int* count)
... ...
04-timer5.cpp
... ... @@ -10,7 +10,6 @@
10 10  
11 11 #include <iostream>
12 12 #include <asio.hpp>
13   -#include <boost/bind/bind.hpp>
14 13  
15 14 class printer
16 15 {
... ... @@ -22,10 +21,10 @@ public:
22 21 count_(0)
23 22 {
24 23 timer1_.async_wait(asio::bind_executor(strand_,
25   - boost::bind(&printer::print1, this)));
  24 + std::bind(&printer::print1, this)));
26 25  
27 26 timer2_.async_wait(asio::bind_executor(strand_,
28   - boost::bind(&printer::print2, this)));
  27 + std::bind(&printer::print2, this)));
29 28 }
30 29  
31 30 ~printer()
... ... @@ -43,7 +42,7 @@ public:
43 42 timer1_.expires_at(timer1_.expiry() + asio::chrono::seconds(1));
44 43  
45 44 timer1_.async_wait(asio::bind_executor(strand_,
46   - boost::bind(&printer::print1, this)));
  45 + std::bind(&printer::print1, this)));
47 46 }
48 47 }
49 48  
... ... @@ -57,7 +56,7 @@ public:
57 56 timer2_.expires_at(timer2_.expiry() + asio::chrono::seconds(1));
58 57  
59 58 timer2_.async_wait(asio::bind_executor(strand_,
60   - boost::bind(&printer::print2, this)));
  59 + std::bind(&printer::print2, this)));
61 60 }
62 61 }
63 62  
... ... @@ -72,7 +71,8 @@ int main()
72 71 {
73 72 asio::io_context io;
74 73 printer p(io);
75   - asio::thread t(boost::bind(&asio::io_context::run, &io));
  74 +// std::thread t(std::bind(&asio::io_context::run, &io));
  75 + std::thread t([&io]{io.run();});
76 76 io.run();
77 77 t.join();
78 78  
... ...