diff options
Diffstat (limited to 'doc/html/function/misc.html')
-rw-r--r-- | doc/html/function/misc.html | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/doc/html/function/misc.html b/doc/html/function/misc.html index a943144a1d..4623edd679 100644 --- a/doc/html/function/misc.html +++ b/doc/html/function/misc.html @@ -4,9 +4,9 @@ <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Miscellaneous Notes</title> <link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css"> -<meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> -<link rel="up" href="../function.html" title="Chapter 12. Boost.Function"> +<link rel="up" href="../function.html" title="Chapter 13. Boost.Function"> <link rel="prev" href="faq.html" title="Frequently Asked Questions"> <link rel="next" href="testsuite.html" title="Testsuite"> </head> @@ -26,19 +26,19 @@ <div class="section"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="function.misc"></a>Miscellaneous Notes</h2></div></div></div> -<div class="toc"><dl> -<dt><span class="section"><a href="misc.html#idp138289392">Boost.Function vs. Function Pointers</a></span></dt> -<dt><span class="section"><a href="misc.html#idp138296576">Performance</a></span></dt> -<dt><span class="section"><a href="misc.html#idp138304224">Combatting virtual function "bloat"</a></span></dt> -<dt><span class="section"><a href="misc.html#idp138307744">Acknowledgements</a></span></dt> +<div class="toc"><dl class="toc"> +<dt><span class="section"><a href="misc.html#idm45928047938832">Boost.Function vs. Function Pointers</a></span></dt> +<dt><span class="section"><a href="misc.html#idm45928047931648">Performance</a></span></dt> +<dt><span class="section"><a href="misc.html#idm45928047924000">Combatting virtual function "bloat"</a></span></dt> +<dt><span class="section"><a href="misc.html#idm45928047920480">Acknowledgements</a></span></dt> </dl></div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="idp138289392"></a>Boost.Function vs. Function Pointers</h3></div></div></div> +<a name="idm45928047938832"></a>Boost.Function vs. Function Pointers</h3></div></div></div> <p>Boost.Function has several advantages over function pointers, namely: </p> -<div class="itemizedlist"><ul class="itemizedlist" type="disc" compact> +<div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "> <li class="listitem"><p>Boost.Function allows arbitrary compatible function objects to be targets (instead of requiring an exact function signature).</p></li> <li class="listitem"><p>Boost.Function may be used with argument-binding and other function object construction libraries.</p></li> <li class="listitem"><p>Boost.Function has predictible behavior when an empty function object is called. </p></li> @@ -46,7 +46,7 @@ <p> And, of course, function pointers have several advantages over Boost.Function: </p> -<div class="itemizedlist"><ul class="itemizedlist" type="disc" compact> +<div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "> <li class="listitem"><p> Function pointers are smaller (the size of one pointer instead of four or more) </p></li> <li class="listitem"><p> Function pointers are faster (Boost.Function may require two calls through function pointers) </p></li> <li class="listitem"><p> Function pointers are backward-compatible with C libraries.</p></li> @@ -57,37 +57,37 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="idp138296576"></a>Performance</h3></div></div></div> -<div class="toc"><dl> -<dt><span class="section"><a href="misc.html#idp138297248">Function object wrapper size</a></span></dt> -<dt><span class="section"><a href="misc.html#idp138299600">Copying efficiency</a></span></dt> -<dt><span class="section"><a href="misc.html#idp138302608">Invocation efficiency</a></span></dt> +<a name="idm45928047931648"></a>Performance</h3></div></div></div> +<div class="toc"><dl class="toc"> +<dt><span class="section"><a href="misc.html#idm45928047930976">Function object wrapper size</a></span></dt> +<dt><span class="section"><a href="misc.html#idm45928047928624">Copying efficiency</a></span></dt> +<dt><span class="section"><a href="misc.html#idm45928047925616">Invocation efficiency</a></span></dt> </dl></div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="idp138297248"></a>Function object wrapper size</h4></div></div></div> +<a name="idm45928047930976"></a>Function object wrapper size</h4></div></div></div> <p> Function object wrappers will be the size of a struct containing a member function pointer and two data pointers. The actual size can vary significantly depending on the underlying platform; on 32-bit Mac OS X with GCC, this amounts to 16 bytes, while it is 32 bytes Windows with Visual C++. Additionally, the function object target may be allocated on the heap, if it cannot be placed into the small-object buffer in the <code class="computeroutput">boost::function</code> object.</p> </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="idp138299600"></a>Copying efficiency</h4></div></div></div> +<a name="idm45928047928624"></a>Copying efficiency</h4></div></div></div> <p> Copying function object wrappers may require allocating memory for a copy of the function object target. The default allocator may be replaced with a faster custom allocator or one may choose to allow the function object wrappers to only store function object targets by reference (using <code class="computeroutput">ref</code>) if the cost of this cloning becomes prohibitive. Small function objects can be stored within the <code class="computeroutput">boost::function</code> object itself, improving copying efficiency.</p> </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> -<a name="idp138302608"></a>Invocation efficiency</h4></div></div></div> +<a name="idm45928047925616"></a>Invocation efficiency</h4></div></div></div> <p> With a properly inlining compiler, an invocation of a function object requires one call through a function pointer. If the call is to a free function pointer, an additional call must be made to that function pointer (unless the compiler has very powerful interprocedural analysis).</p> </div> </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="idp138304224"></a>Combatting virtual function "bloat"</h3></div></div></div> +<a name="idm45928047924000"></a>Combatting virtual function "bloat"</h3></div></div></div> <p> The use of virtual functions tends to cause 'code bloat' on many compilers. When a class contains a virtual function, it is necessary to emit an additional function that classifies the type of the object. It has been our experience that these auxiliary functions increase the size of the executable significantly when many <code class="computeroutput">boost::function</code> objects are used. </p> <p> In Boost.Function, an alternative but equivalent approach was taken using free functions instead of virtual functions. The Boost.Function object essentially holds two pointers to make a valid target call: a void pointer to the function object it contains and a void pointer to an "invoker" that can call the function object, given the function pointer. This invoker function performs the argument and return value conversions Boost.Function provides. A third pointer points to a free function called the "manager", which handles the cloning and destruction of function objects. The scheme is typesafe because the only functions that actually handle the function object, the invoker and the manager, are instantiated given the type of the function object, so they can safely cast the incoming void pointer (the function object pointer) to the appropriate type.</p> </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="idp138307744"></a>Acknowledgements</h3></div></div></div> +<a name="idm45928047920480"></a>Acknowledgements</h3></div></div></div> <p> Many people were involved in the construction of this library. William Kempf, Jesse Jones and Karl Nelson were all extremely helpful in isolating an interface and scope for the |