]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/asio/doc/requirements/ConnectHandler.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / asio / doc / requirements / ConnectHandler.qbk
CommitLineData
7c673cae
FG
1[/
2 / Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
3 /
4 / Distributed under the Boost Software License, Version 1.0. (See accompanying
5 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 /]
7
8[section:ConnectHandler Connect handler requirements]
9
10A connect handler must meet the requirements for a [link
11boost_asio.reference.Handler handler]. A value `h` of a connect handler
12class should work correctly in the expression `h(ec)`, where `ec` is an lvalue
13of type `const error_code`.
14
15[heading Examples]
16
17A free function as a connect handler:
18
19 void connect_handler(
20 const boost::system::error_code& ec)
21 {
22 ...
23 }
24
25A connect handler function object:
26
27 struct connect_handler
28 {
29 ...
30 void operator()(
31 const boost::system::error_code& ec)
32 {
33 ...
34 }
35 ...
36 };
37
38A non-static class member function adapted to a connect handler using `bind()`:
39
40 void my_class::connect_handler(
41 const boost::system::error_code& ec)
42 {
43 ...
44 }
45 ...
46 socket.async_connect(...,
47 boost::bind(&my_class::connect_handler,
48 this, boost::asio::placeholders::error));
49
50[endsect]