1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Bind</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="../../index.html" title="Chapter 1. Phoenix 3.2.0"> 8<link rel="up" href="../modules.html" title="Modules"> 9<link rel="prev" href="scope/lambda.html" title="lambda"> 10<link rel="next" href="bind/binding_function_objects.html" title="Binding Function Objects"> 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="scope/lambda.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../modules.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="bind/binding_function_objects.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="phoenix.modules.bind"></a><a class="link" href="bind.html" title="Bind">Bind</a> 28</h3></div></div></div> 29<div class="toc"><dl class="toc"> 30<dt><span class="section"><a href="bind/binding_function_objects.html">Binding 31 Function Objects</a></span></dt> 32<dt><span class="section"><a href="bind/binding_functions.html">Binding Functions</a></span></dt> 33<dt><span class="section"><a href="bind/binding_member_functions.html">Binding 34 Member Functions</a></span></dt> 35<dt><span class="section"><a href="bind/binding_member_variables.html">Binding 36 Member Variables</a></span></dt> 37<dt><span class="section"><a href="bind/compatibility_with_boost_bind.html">Compatibility 38 with Boost.Bind</a></span></dt> 39</dl></div> 40<p> 41 <span class="emphasis"><em>Binding</em></span> is the act of tying together a function to some 42 arguments for deferred (lazy) evaluation. Named <a class="link" href="function.html" title="Function">lazy 43 functions</a> require a bit of typing. Unlike (unnamed) lambda expressions, 44 we need to write a functor somewhere offline, detached from the call site. 45 If you wish to transform a plain function, member function or member variable 46 to a lambda expression, <code class="computeroutput"><span class="identifier">bind</span></code> 47 is your friend. 48 </p> 49<div class="note"><table border="0" summary="Note"> 50<tr> 51<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td> 52<th align="left">Note</th> 53</tr> 54<tr><td align="left" valign="top"><p> 55 Take note that binding functions, member functions or member variables 56 is monomorphic. Rather than binding functions, the preferred way is to 57 write true generic and polymorphic <a class="link" href="function.html" title="Function">lazy 58 functions</a>. 59 </p></td></tr> 60</table></div> 61<p> 62 There is a set of overloaded <code class="computeroutput"><span class="identifier">bind</span></code> 63 template functions. Each <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span></code> 64 function generates a suitable binder object. 65 </p> 66</div> 67<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 68<td align="left"></td> 69<td align="right"><div class="copyright-footer">Copyright © 2002-2005, 2010, 2014, 2015 Joel de Guzman, Dan Marsden, Thomas 70 Heller, John Fletcher<p> 71 Distributed under the Boost Software License, Version 1.0. (See accompanying 72 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>) 73 </p> 74</div></td> 75</tr></table> 76<hr> 77<div class="spirit-nav"> 78<a accesskey="p" href="scope/lambda.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../modules.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="bind/binding_function_objects.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 79</div> 80</body> 81</html> 82