boost - C++ meaning of [ ] -
this question has answer here:
- what lambda expression in c++11? 8 answers
that's example of boosts asio. [this] mean? why []?
acceptor_.async_accept(socket_, [this](boost::system::error_code ec)
it lambda expression used create function expression
[]
capture list
a list of symbols can passed follows:
- [a,&b] captured value , b captured reference.
- [this] captures pointer value
- [&] captures automatic variables mentioned in body of lambda reference
- [=] captures automatic variables mentioned in body of lambda value
- [] captures nothing
Comments
Post a Comment