blob: 97f13e2eca92aea6e418b448b36eb40ab6915c58 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
-->
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
<section id="function.history" last-revision="$Date: 2013-06-15 00:06:26 -0700 (Sat, 15 Jun 2013) $">
<title>History &amp; Compatibility Notes</title>
<itemizedlist spacing="compact">
<listitem><para><bold>Version 1.52.0</bold>: </para>
<itemizedlist spacing="compact">
<listitem><para>Move constructors and move assignment
operators added (only for compilers with C++11 rvalue
references support). Original patch
contributed by Antony Polukhin.</para></listitem>
</itemizedlist>
</listitem>
<listitem><para><bold>Version 1.37.0</bold>: </para>
<itemizedlist spacing="compact">
<listitem><para>Improved the performance of Boost.Function's
swap() operation for large function objects. Original patch
contributed by Niels Dekker.</para></listitem>
<listitem><para>Added a new header &lt;boost/function/function_typeof.hpp&gt; that provides support for using the Boost.Typeof library on Boost.Function objects.</para></listitem>
<listitem><para>Added a new header &lt;boost/function/function_fwd.hpp&gt; that provides support for using the Boost.Typeof library on Boost.Function objects.</para></listitem>
<listitem><para>The <methodname alt="boost::function::target">target</methodname>()
function now respects the cv-qualifiers of function objects
stored by reference
(using <classname>boost::reference_wrapper</classname>), such
that a reference to a <code>const</code> function object cannot
be accessed as a reference to a non-<code>const</code> function
object.</para></listitem>
</itemizedlist>
</listitem>
<listitem><para><bold>Version 1.36.0</bold>: </para>
<itemizedlist spacing="compact">
<listitem><para>Boost.Function now implements allocator support
in the same way that is is provided in C++0x, based on C++
committee
proposal <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2308.html">N2308</ulink>. This
change removes the <computeroutput>Allocator</computeroutput>
template parameter of <classname>boost::function</classname> in
favor of a constructor that takes an argument. While this is a
backward-incompatible change, it is likely to affect only a few
users. This change to Function was contributed by Emil
Dotchevski, which also authored the corresponding C++ committee
proposal.</para></listitem>
</itemizedlist>
</listitem>
<listitem><para><bold>Version 1.34.0</bold>: </para>
<itemizedlist spacing="compact">
<listitem><para>Boost.Function now implements a small buffer optimization, which can drastically improve the performance when copying or construction Boost.Function objects storing small function objects. For instance, <code>bind(&amp;X:foo, &amp;x, _1, _2)</code> requires no heap allocation when placed into a Boost.Function object. Note that some exception-safety guarantees have changed: assignment provides the basic exception guarantee and <code>swap()</code> may throw.</para></listitem>
</itemizedlist>
</listitem>
<listitem><para><bold>Version 1.30.0</bold>: </para>
<itemizedlist spacing="compact">
<listitem><para>All features deprecated in version 1.29.0 have
been removed from Boost.Function.</para></listitem>
<listitem><para><code><classname>boost::function</classname></code>
and <code><classname>boost::functionN</classname></code> objects
can be assigned to 0 (semantically equivalent to calling
<code><methodname
alt="boost::function::clear">clear</methodname>()</code>) and
compared against 0 (semantically equivalent to calling
<code><methodname
alt="boost::function::empty">empty</methodname>()</code>).</para></listitem>
<listitem><para>The Boost.Function code is now generated
entirely by the <libraryname>Preprocessor</libraryname> library,
so it is now possible to generate
<code><classname>boost::function</classname></code> and
<code><classname>boost::functionN</classname></code> class
templates for any number of arguments.</para></listitem>
<listitem><para>The
<classname>boost::bad_function_call</classname> exception class
was introduced.</para></listitem>
</itemizedlist>
</listitem>
<listitem><para><bold>Version 1.29.0</bold>:
Boost.Function has been partially redesigned to minimize the
interface and make it cleaner. Several seldom- or never-used
features of the older Boost.Function have been deprecated and will
be removed in the near future. Here is a list of features that have
been deprecated, the likely impact of the deprecations, and how to
adjust your code:
<itemizedlist spacing="compact">
<listitem><para>The <computeroutput>boost::function</computeroutput> class template syntax has
changed. The old syntax, e.g., <computeroutput>boost::function&lt;int, float,
double, std::string&gt;</computeroutput>, has been changed to a more natural
syntax <computeroutput>boost::function&lt;int (float, double,
std::string)&gt;</computeroutput>, where all return and argument types are
encoded in a single function type parameter. Any other template
parameters (e.g., the <computeroutput>Allocator</computeroutput>) follow this single
parameter.</para>
<para> The resolution to this change depends on the
abilities of your compiler: if your compiler supports template
partial specialization and can parse function types (most do), modify
your code to use the newer
syntax (preferable) or directly use one of the
<computeroutput>functionN</computeroutput> classes whose syntax has not
changed. If your compiler does not support template partial
specialization or function types, you must take the latter option and
use the numbered Boost.Function classes. This option merely requires
changing types such as <computeroutput>boost::function&lt;void, int, int&gt;</computeroutput>
to <computeroutput>boost::function2&lt;void, int, int&gt;</computeroutput> (adding the number of
function arguments to the end of the class name).</para>
<para> Support for the old syntax with the
<computeroutput>boost::function</computeroutput> class template will persist for a short
while, but will eventually be removed so that we can provide better
error messages and link compatibility. </para></listitem>
<listitem><para>The invocation
policy template parameter (<computeroutput>Policy</computeroutput>) has been deprecated
and will be removed. There is no direct equivalent to this rarely
used feature.</para></listitem>
<listitem><para>The mixin template parameter
(<computeroutput>Mixin</computeroutput>) has been deprecated and will be removed. There
is not direct equivalent to this rarely used feature.</para></listitem>
<listitem><para>The
<computeroutput>set</computeroutput> methods have been deprecated and will be
removed. Use the assignment operator instead.</para></listitem>
</itemizedlist>
</para>
</listitem>
</itemizedlist>
</section>