• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>io_context::wrap</title>
5<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../boost_asio.html" title="Boost.Asio">
8<link rel="up" href="../io_context.html" title="io_context">
9<link rel="prev" href="use_service/overload2.html" title="io_context::use_service (2 of 2 overloads)">
10<link rel="next" href="_io_context.html" title="io_context::~io_context">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="use_service/overload2.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../io_context.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="_io_context.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="boost_asio.reference.io_context.wrap"></a><a class="link" href="wrap.html" title="io_context::wrap">io_context::wrap</a>
28</h4></div></div></div>
29<p>
30          <a class="indexterm" name="boost_asio.indexterm.io_context.wrap"></a>
31(Deprecated: Use <a class="link" href="../bind_executor.html" title="bind_executor"><code class="computeroutput">bind_executor</code></a>.)
32          Create a new handler that automatically dispatches the wrapped handler
33          on the <a class="link" href="../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>.
34        </p>
35<pre class="programlisting">template&lt;
36    typename <a class="link" href="../Handler.html" title="Handlers">Handler</a>&gt;
37unspecified wrap(
38    Handler handler);
39</pre>
40<p>
41          This function is used to create a new handler function object that, when
42          invoked, will automatically pass the wrapped handler to the <a class="link" href="../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
43          object's dispatch function.
44        </p>
45<h6>
46<a name="boost_asio.reference.io_context.wrap.h0"></a>
47          <span class="phrase"><a name="boost_asio.reference.io_context.wrap.parameters"></a></span><a class="link" href="wrap.html#boost_asio.reference.io_context.wrap.parameters">Parameters</a>
48        </h6>
49<div class="variablelist">
50<p class="title"><b></b></p>
51<dl class="variablelist">
52<dt><span class="term">handler</span></dt>
53<dd>
54<p>
55                The handler to be wrapped. The <a class="link" href="../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
56                will make a copy of the handler object as required. The function
57                signature of the handler must be:
58</p>
59<pre class="programlisting">void handler(A1 a1, ... An an);
60</pre>
61<p>
62              </p>
63</dd>
64</dl>
65</div>
66<h6>
67<a name="boost_asio.reference.io_context.wrap.h1"></a>
68          <span class="phrase"><a name="boost_asio.reference.io_context.wrap.return_value"></a></span><a class="link" href="wrap.html#boost_asio.reference.io_context.wrap.return_value">Return
69          Value</a>
70        </h6>
71<p>
72          A function object that, when invoked, passes the wrapped handler to the
73          <a class="link" href="../io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
74          object's dispatch function. Given a function object with the signature:
75        </p>
76<pre class="programlisting">R f(A1 a1, ... An an);
77</pre>
78<p>
79          If this function object is passed to the wrap function like so:
80        </p>
81<pre class="programlisting">io_context.wrap(f);
82</pre>
83<p>
84          then the return value is a function object with the signature
85        </p>
86<pre class="programlisting">void g(A1 a1, ... An an);
87</pre>
88<p>
89          that, when invoked, executes code equivalent to:
90        </p>
91<pre class="programlisting">io_context.dispatch(boost::bind(f, a1, ... an));
92</pre>
93</div>
94<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
95<td align="left"></td>
96<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
97      Kohlhoff<p>
98        Distributed under the Boost Software License, Version 1.0. (See accompanying
99        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
100      </p>
101</div></td>
102</tr></table>
103<hr>
104<div class="spirit-nav">
105<a accesskey="p" href="use_service/overload2.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../io_context.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="_io_context.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
106</div>
107</body>
108</html>
109