In common.h, define func_lib for function objects.  In configure.ac, define HAVE_STD_FUNCTION and HAVE_BOOST_FUNCTION.  Include function headers in ndnboost.
diff --git a/libs/function/doc/Jamfile.v2 b/libs/function/doc/Jamfile.v2
new file mode 100644
index 0000000..1aee1e7
--- /dev/null
+++ b/libs/function/doc/Jamfile.v2
@@ -0,0 +1,16 @@
+#   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)
+project boost/doc ;
+import boostbook : boostbook ;
+
+boostbook function-doc 
+    : 
+    function.xml 
+    :
+        <xsl:param>boost.root=../../../..
+        <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
+    ;
+
diff --git a/libs/function/doc/faq.xml b/libs/function/doc/faq.xml
new file mode 100644
index 0000000..95c5961
--- /dev/null
+++ b/libs/function/doc/faq.xml
@@ -0,0 +1,163 @@
+<?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.faq" last-revision="$Date: 2006-11-03 11:41:10 -0800 (Fri, 03 Nov 2006) $">
+  <title>Frequently Asked Questions</title>
+
+<qandaset>
+  <qandaentry>
+    <question><para>Why can't I compare
+    <classname>boost::function</classname> objects with
+    <code>operator==</code> or
+    <code>operator!=</code>?</para></question>
+
+    <answer>
+      <para>Comparison between <classname>boost::function</classname>
+      objects cannot be implemented "well", and therefore will not be
+      implemented. The typical semantics requested for <code>f ==
+      g</code> given <classname>boost::function</classname> objects
+      <code>f</code> and <code>g</code> are:</para>
+        <itemizedlist>
+          <listitem><simpara>If <code>f</code> and <code>g</code>
+          store function objects of the same type, use that type's
+          <code>operator==</code> to compare
+          them.</simpara></listitem> 
+
+          <listitem><simpara>If <code>f</code> and <code>g</code>
+          store function objects of different types, return
+          <code>false</code>.</simpara></listitem>
+        </itemizedlist>
+      <para>The problem occurs when the type of the function objects
+      stored by both <code>f</code> and <code>g</code> doesn't have an
+      <code>operator==</code>: we would like the expression <code>f ==
+      g</code> to fail to compile, as occurs with, e.g., the standard
+      containers. However, this is not implementable for
+      <classname>boost::function</classname> because it necessarily
+      "erases" some type information after it has been assigned a
+      function object, so it cannot try to call
+      <code>operator==</code> later: it must either find a way to call
+      <code>operator==</code> now, or it will never be able to call it
+      later. Note, for instance, what happens if you try to put a
+      <code>float</code> value into a
+      <classname>boost::function</classname> object: you will get an
+      error at the assignment operator or constructor, not in
+      <code>operator()</code>, because the function-call expression
+      must be bound in the constructor or assignment operator.</para>
+
+      <para>The most promising approach is to find a method of
+      determining if <code>operator==</code> can be called for a
+      particular type, and then supporting it only when it is
+      available; in other situations, an exception would be
+      thrown. However, to date there is no known way to detect if an
+      arbitrary operator expression <code>f == g</code> is suitably
+      defined. The best solution known has the following undesirable
+      qualities:</para>
+
+      <orderedlist>
+        <listitem><simpara>Fails at compile-time for objects where
+        <code>operator==</code> is not accessible (e.g., because it is
+        <code>private</code>).</simpara></listitem>
+
+        <listitem><simpara>Fails at compile-time if calling
+        <code>operator==</code> is ambiguous.</simpara></listitem>
+
+        <listitem><simpara>Appears to be correct if the
+        <code>operator==</code> declaration is correct, even though
+        <code>operator==</code> may not compile.</simpara></listitem>
+      </orderedlist>
+
+      <para>All of these problems translate into failures in the
+      <classname>boost::function</classname> constructors or
+      assignment operator, <emphasis>even if the user never invokes
+      operator==</emphasis>. We can't do that to users.</para>
+
+      <para>The other option is to place the burden on users that want
+      to use <code>operator==</code>, e.g., by providing an
+      <code>is_equality_comparable</code> trait they may
+      specialize. This is a workable solution, but is dangerous in
+      practice, because forgetting to specialize the trait will result
+      in unexpected exceptions being thrown from
+      <classname>boost::function</classname>'s
+      <code>operator==</code>. This essentially negates the usefulness
+      of <code>operator==</code> in the context in which it is most
+      desired: multitarget callbacks. The
+      <libraryname>Signals</libraryname> library has a way around
+      this.</para>
+    </answer>
+  </qandaentry>
+
+  <qandaentry>
+    <question><para>I see void pointers; is this [mess] type safe?</para></question>
+    <answer>
+<para>Yes, <computeroutput>boost::function</computeroutput> is type
+safe even though it uses void pointers and pointers to functions
+returning void and taking no arguments. Essentially, all type
+information is encoded in the functions that manage and invoke
+function pointers and function objects. Only these functions are
+instantiated with the exact type that is pointed to by the void
+pointer or pointer to void function. The reason that both are required
+is that one may cast between void pointers and object pointers safely
+or between different types of function pointers (provided you don't
+invoke a function pointer with the wrong type).  </para>
+    </answer>
+  </qandaentry>
+
+  <qandaentry>
+    <question><para>Why are there workarounds for void returns? C++ allows them!</para></question>
+    <answer><para>Void returns are permitted by the C++ standard, as in this code snippet:
+<programlisting>void f();
+void g() { return f(); }</programlisting>
+    </para>
+
+    <para> This is a valid usage of <computeroutput>boost::function</computeroutput> because void returns are not used. With void returns, we would attempting to compile ill-formed code similar to:
+<programlisting>int f();
+void g() { return f(); }</programlisting>
+</para>
+
+<para> In essence, not using void returns allows
+<computeroutput>boost::function</computeroutput> to swallow a return value. This is
+consistent with allowing the user to assign and invoke functions and
+function objects with parameters that don't exactly match.</para>
+
+    </answer>
+  </qandaentry>
+
+  <qandaentry>
+    <question><para>Why (function) cloning?</para></question>
+    <answer>
+      <para>In November and December of 2000, the issue of cloning
+      vs. reference counting was debated at length and it was decided
+      that cloning gave more predictable semantics. I won't rehash the
+      discussion here, but if it cloning is incorrect for a particular
+      application a reference-counting allocator could be used.</para>
+    </answer>
+  </qandaentry>
+
+  <qandaentry>
+    <question><para>How much overhead does a call through <code><classname>boost::function</classname></code> incur?</para></question>
+    <answer>
+      <para>The cost of <code>boost::function</code> can be reasonably
+      consistently measured at around 20ns +/- 10 ns on a modern >2GHz
+      platform versus directly inlining the code.</para>
+
+      <para>However, the performance of your application may benefit
+      from or be disadvantaged by <code>boost::function</code>
+      depending on how your C++ optimiser optimises.  Similar to a
+      standard function pointer, differences of order of 10% have been
+      noted to the benefit or disadvantage of using
+      <code>boost::function</code> to call a function that contains a
+      tight loop depending on your compilation circumstances.</para>
+     
+      <para>[Answer provided by Matt Hurd. See <ulink url="http://article.gmane.org/gmane.comp.lib.boost.devel/33278"/>]</para>
+    </answer>
+  </qandaentry>
+</qandaset> 
+
+</section>
diff --git a/libs/function/doc/function.xml b/libs/function/doc/function.xml
new file mode 100644
index 0000000..fcf29fc
--- /dev/null
+++ b/libs/function/doc/function.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
+  "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<library name="Function" dirname="function" id="function" 
+         last-revision="$Date: 2004-07-24 19:59:30 -0700 (Sat, 24 Jul 2004) $" 
+         xmlns:xi="http://www.w3.org/2001/XInclude">
+<libraryinfo>
+  <author>
+    <firstname>Douglas</firstname>
+    <surname>Gregor</surname>
+    <email>dgregor -at- cs.indiana.edu</email>
+  </author>
+
+  <copyright>
+    <year>2001</year>
+    <year>2002</year>
+    <year>2003</year>
+    <year>2004</year>
+    <holder>Douglas Gregor</holder>
+  </copyright>
+
+  <legalnotice>
+    <para>Use, modification and distribution is subject to the Boost
+    Software License, Version 1.0. (See accompanying file
+    <filename>LICENSE_1_0.txt</filename> or copy at <ulink
+    url="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</ulink>)</para>
+  </legalnotice>
+
+  <librarypurpose>Function object wrappers for deferred calls or callbacks</librarypurpose>
+  <librarycategory name="category:higher-order"/>
+</libraryinfo>
+
+<title>Boost.Function</title>
+
+<section id="function.intro">
+<title>Introduction</title> 
+<para>The Boost.Function library contains a family of class templates
+that are function object wrappers. The notion is similar to a
+generalized callback. It shares features with function pointers in
+that both define a call interface (e.g., a function taking two integer
+arguments and returning a floating-point value) through which some
+implementation can be called, and the implementation that is invoked
+may change throughout the course of the program.</para>
+
+<para> Generally, any place in which a function pointer would be used
+to defer a call or make a callback, Boost.Function can be used instead
+to allow the user greater flexibility in the implementation of the
+target. Targets can be any 'compatible' function object (or function
+pointer), meaning that the arguments to the interface designated by
+Boost.Function can be converted to the arguments of the target
+function object.</para>
+</section>
+
+<xi:include href="history.xml"/>
+<xi:include href="tutorial.xml"/>
+<xi:include href="reference.xml"/>
+<xi:include href="faq.xml"/>
+<xi:include href="misc.xml"/>
+<xi:include href="tests.xml"/>
+
+</library>
diff --git a/libs/function/doc/history.xml b/libs/function/doc/history.xml
new file mode 100644
index 0000000..97f13e2
--- /dev/null
+++ b/libs/function/doc/history.xml
@@ -0,0 +1,146 @@
+<?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>
diff --git a/libs/function/doc/misc.xml b/libs/function/doc/misc.xml
new file mode 100644
index 0000000..c0f4fb5
--- /dev/null
+++ b/libs/function/doc/misc.xml
@@ -0,0 +1,72 @@
+<?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.misc" last-revision="$Date: 2008-07-14 11:32:29 -0700 (Mon, 14 Jul 2008) $">
+  <title>Miscellaneous Notes</title>
+
+  <section>
+    <title>Boost.Function vs. Function Pointers</title>
+<para>Boost.Function has several advantages over function pointers, namely:
+
+<itemizedlist spacing="compact">
+   <listitem><para>Boost.Function allows arbitrary compatible function objects to be targets (instead of requiring an exact function signature).</para></listitem>
+   <listitem><para>Boost.Function may be used with argument-binding and other function object construction libraries.</para></listitem>
+   <listitem><para>Boost.Function has predictible behavior when an empty function object is called. </para></listitem>
+</itemizedlist></para>
+
+<para> And, of course, function pointers have several advantages over Boost.Function:
+
+<itemizedlist spacing="compact">
+    <listitem><para> Function pointers are smaller (the size of one pointer instead of four or more) </para></listitem>
+    <listitem><para> Function pointers are faster (Boost.Function may require two calls through function pointers) </para></listitem>
+    <listitem><para> Function pointers are backward-compatible with C libraries.</para></listitem>
+    <listitem><para> More readable error messages. </para></listitem>
+</itemizedlist>
+</para>
+  </section>
+
+  <section>
+    <title>Performance</title>
+
+<section>
+  <title>Function object wrapper size</title>
+  <para> 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>boost::function</code> object.</para>
+</section>
+
+<section>
+  <title>Copying efficiency</title>
+  <para> 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 <computeroutput>ref</computeroutput>) if the cost of this cloning becomes prohibitive. Small function objects can be stored within the <code>boost::function</code> object itself, improving copying efficiency.</para>
+ </section>
+
+<section>
+  <title>Invocation efficiency</title>
+<para> 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).</para>
+  </section>
+</section>
+
+  <section>
+    <title>Combatting virtual function "bloat"</title>
+<para> 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 <computeroutput>boost::function</computeroutput> objects are used. </para>
+
+<para> 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.</para>
+  </section>
+
+  <section>
+    <title>Acknowledgements</title> 
+
+    <para> 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
+    library. John Maddock managed the formal review, and many
+    reviewers gave excellent comments on interface, implementation,
+    and documentation. Peter Dimov led us to the function
+    declarator-based syntax.</para>
+  </section>
+</section>
diff --git a/libs/function/doc/reference.xml b/libs/function/doc/reference.xml
new file mode 100644
index 0000000..c7c914c
--- /dev/null
+++ b/libs/function/doc/reference.xml
@@ -0,0 +1,992 @@
+<?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">
+
+<library-reference id="function.reference" last-revision="$Date: 2013-06-15 00:06:26 -0700 (Sat, 15 Jun 2013) $">
+
+<section id="function.definitions">
+  <title>Definitions</title>
+<para>
+  <itemizedlist>
+    <listitem>
+      <para>A function object <computeroutput>f</computeroutput> is
+      <emphasis>compatible</emphasis> if for the given set of argument
+      types <computeroutput>Arg1</computeroutput>,
+      <computeroutput>Arg2</computeroutput>, ...,
+      <computeroutput>ArgN</computeroutput> and a
+      return type <computeroutput>ResultType</computeroutput>, the
+      appropriate following function is well-formed:
+<programlisting>
+  <emphasis>// if ResultType is not <emphasis role="bold">void</emphasis></emphasis>
+  ResultType foo(Arg1 arg1, Arg2 arg2, ..., Arg<emphasis>N</emphasis> arg<emphasis>N</emphasis>)
+  {
+    <emphasis role="bold">return</emphasis> f(arg1, arg2, ..., arg<emphasis>N</emphasis>);
+  }
+
+  <emphasis>// if ResultType is <emphasis role="bold">void</emphasis></emphasis>
+  ResultType foo(Arg1 arg1, Arg2 arg2, ..., Arg<emphasis>N</emphasis> arg<emphasis>N</emphasis>)
+  {
+    f(arg1, arg2, ..., arg<emphasis>N</emphasis>);
+  }
+</programlisting></para>
+
+      <para> A special provision is made for pointers to member
+      functions. Though they are not function objects, Boost.Function
+      will adapt them internally to function objects. This requires
+      that a pointer to member function of the form <code>R
+      (X::*mf)(Arg1, Arg2, ..., ArgN)
+      cv-quals</code> be adapted to a
+      function object with the following function call operator
+      overloads:
+<programlisting>
+  <emphasis role="bold">template</emphasis>&lt;<emphasis role="bold">typename P</emphasis>&gt;
+  R <emphasis role="bold">operator</emphasis>()(<emphasis>cv-quals</emphasis> P&amp; x, Arg1 arg1, Arg2 arg2, ..., Arg<emphasis>N</emphasis> arg<emphasis>N</emphasis>) <emphasis role="bold">const</emphasis>
+  {
+    <emphasis role="bold">return</emphasis> (*x).*mf(arg1, arg2, ..., arg<emphasis>N</emphasis>);
+  }
+</programlisting>
+</para>
+    </listitem>
+    <listitem>
+      <para>A function object <code>f</code> of
+      type <code>F</code> is
+      <emphasis>stateless</emphasis> if it is a function pointer or if
+      <code><classname>boost::is_stateless</classname>&lt;F&gt;</code>
+      is true. The construction of or copy to a Boost.Function object
+      from a stateless function object will not cause exceptions to be
+      thrown and will not allocate any storage.
+      </para>
+    </listitem>
+  </itemizedlist>
+</para>
+</section>
+
+<header name="boost/function.hpp">
+<namespace name="boost">
+  <class name="bad_function_call">
+    <inherit access="public"><classname>std::runtime_error</classname></inherit>
+    <purpose>An exception type thrown when an instance of a <code>function</code> object is empty when invoked.</purpose>
+    <constructor>
+      <effects><simpara>Constructs a <code><classname>bad_function_call</classname></code> exception object.</simpara></effects>
+    </constructor>
+  </class>
+
+  <class name="function_base">
+    <purpose>The common base class for all Boost.Function
+    objects. Objects of type function_base may not be created
+    directly.</purpose>
+
+    <method-group name="capacity">
+      <method name="empty" cv="const">
+        <type>bool</type>
+        <returns><simpara><code>false</code> if <code>this</code> has a target, and <code>true</code> otherwise.</simpara></returns>
+        <throws><simpara>Will not throw.</simpara></throws>
+      </method>
+    </method-group>
+
+    <method-group name="target access">
+      <overloaded-method name="target">
+        <signature>
+          <template> 
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>Functor*</type>
+        </signature>
+        <signature cv="const">
+          <template> 
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>const Functor*</type>
+        </signature>
+
+        <returns><simpara>If <code>this</code> stores a target of type
+        <code>Functor</code>, returns the address of the
+        target. Otherwise, returns the NULL
+        pointer.</simpara></returns>
+
+        <throws><simpara>Will not throw.</simpara></throws>
+      </overloaded-method>
+
+      <method name="contains" cv="const">
+        <template>
+          <template-type-parameter name="Functor"/>
+        </template>
+        <type>bool</type>
+        <parameter name="f">
+          <paramtype>const Functor&amp;</paramtype>
+        </parameter>
+        <returns><simpara><code>true</code> if <code>this-&gt;<methodname>target</methodname>&lt;Functor&gt;()</code> is non-NULL and <code><functionname>function_equal</functionname>(*(this-&gt;target&lt;Functor&gt;()), f)</code></simpara></returns>
+ 
+      </method>
+
+      <method name="target_type" cv="const">
+        <type>const std::type_info&amp;</type>
+        <returns><simpara><code>typeid</code> of the target function object, or <code>typeid(void)</code> if <code>this-&gt;<methodname>empty</methodname>()</code>.</simpara></returns>
+        <throws><simpara>Will not throw.</simpara></throws>
+      </method>
+    </method-group>
+  </class>
+
+  <class name="functionN">
+    <template>
+      <template-type-parameter name="R"/>
+      <template-type-parameter name="T1"/>
+      <template-type-parameter name="T2"/>
+      <template-varargs/>
+      <template-type-parameter name="TN"/>
+    </template>
+
+    <inherit access="public"><classname>function_base</classname></inherit>
+
+    <purpose>A set of generalized function pointers that can be used for callbacks or wrapping function objects.</purpose>
+
+    <description>
+      <para>Class template <classname>functionN</classname> is
+      actually a family of related classes <classname
+      alt="functionN">function0</classname>, <classname
+      alt="functionN">function1</classname>, etc., up to some
+      implementation-defined maximum. In this context, <code>N</code>
+      refers to the number of parameters.</para>
+    </description>
+
+    <typedef name="result_type"><type>R</type></typedef>
+    <typedef name="argument_type">
+      <type>T1</type><purpose>If N == 1</purpose>
+    </typedef>
+    <typedef name="first_argument_type">
+      <type>T1</type>
+      <purpose>If N == 2</purpose>
+    </typedef>
+    <typedef name="second_argument_type">
+      <type>T2</type>
+      <purpose>If N == 2</purpose>
+    </typedef>
+    <typedef name="arg1_type"><type>T1</type></typedef>
+    <typedef name="arg2_type"><type>T2</type></typedef>
+    <typedef name="..."><type/></typedef>
+    <typedef name="argN_type"><type>TN</type></typedef>
+
+    <static-constant name="arity">
+      <type>int</type>
+      <default>N</default>
+    </static-constant>
+
+    <struct name="sig">
+      <template>
+        <template-type-parameter name="Args"/>
+      </template>
+
+      <purpose>
+        <simpara><libraryname>Lambda</libraryname> library support</simpara>
+      </purpose>
+
+      <typedef name="type"><type>result_type</type></typedef>
+    </struct>
+
+    <constructor>
+      <postconditions><simpara><code>this-&gt;<methodname>empty</methodname>()</code></simpara></postconditions>
+      <throws><simpara>Will not throw.</simpara></throws>
+    </constructor>
+
+    <constructor>
+      <parameter name="f">
+        <paramtype>const <classname>functionN</classname>&amp;</paramtype>
+      </parameter>
+      <postconditions><simpara>Contains a copy of the <code>f</code>'s target, if it has one, or is empty if <code>f.<methodname>empty</methodname>()</code>.</simpara></postconditions>
+      <throws><simpara>Will not throw unless copying the target of <code>f</code> throws.</simpara></throws>
+    </constructor>
+
+    <constructor>
+      <parameter name="f">
+        <paramtype><classname>functionN</classname>&amp;&amp;</paramtype>
+      </parameter>
+      <requires><simpara>C++11 compatible compiler.</simpara></requires>
+      <postconditions><simpara>Moves the value from <code>f</code> to <code>*this</code>. If the argument has its function object allocated on the heap, its buffer will be assigned to <code>*this</code> leaving argument empty.</simpara></postconditions>
+      <throws><simpara>Will not throw unless argument has its function object allocated not on the heap and copying the target of <code>f</code> throws.</simpara></throws>
+    </constructor>
+    
+    <constructor>
+      <template>
+        <template-type-parameter name="F"/>
+      </template>
+      <parameter name="f"><paramtype>F</paramtype></parameter>
+      <requires><simpara>F is a function object Callable from <code>this</code>.</simpara></requires>
+      <postconditions><simpara><code>*this</code> targets a copy of <code>f</code> if <code>f</code> is nonempty, or <code>this-&gt;<methodname>empty</methodname>()</code> if <code>f</code> is empty.</simpara></postconditions>
+    </constructor>
+
+    <constructor>
+      <template>
+        <template-type-parameter name="F"/>
+        <template-type-parameter name="Allocator"/>
+      </template>
+      <parameter name="f"><paramtype>F</paramtype></parameter>
+      <parameter name="alloc"><paramtype>Allocator</paramtype></parameter>
+      <requires><simpara>F is a function object Callable from <code>this</code>, Allocator is an allocator. The copy constructor and destructor of Allocator shall not throw.</simpara></requires>
+      <postconditions><simpara><code>*this</code> targets a copy of <code>f</code> if <code>f</code> is nonempty, or <code>this-&gt;<methodname>empty</methodname>()</code> if <code>f</code> is empty.</simpara></postconditions>
+
+      <effects><simpara>If memory allocation is required, the given allocator (or a copy of it) will be used to allocate that memory.</simpara></effects>
+    </constructor>
+
+    <destructor>
+      <effects><simpara>If <code>!this-&gt;<methodname>empty</methodname>()</code>, destroys the target of this.</simpara></effects>
+
+    </destructor>
+
+    <copy-assignment>
+      <parameter name="f">
+        <paramtype>const <classname>functionN</classname>&amp;</paramtype>
+      </parameter>
+      <postconditions><simpara>If copy construction does not throw, <code>*this</code> targets a copy of <code>f</code>'s target, if it has one, or is empty if <code>f.<methodname>empty</methodname>()</code>. If copy construction does throw, <code>this-&gt;<methodname>empty</methodname>()</code>.</simpara></postconditions>
+    </copy-assignment>
+    
+    <copy-assignment>
+      <parameter name="f">
+        <paramtype><classname>functionN</classname>&amp;&amp;</paramtype>
+      </parameter>
+      <requires><simpara>C++11 compatible compiler.</simpara></requires>
+      <postconditions><simpara>Moves the value from <code>f</code> to <code>*this</code>. If the argument has its function object allocated on the heap, its buffer will be assigned to <code>*this</code> leaving argument empty.</simpara></postconditions>
+      <throws><simpara>Will not throw unless argument has its function object allocated not on the heap and copying the target of <code>f</code> throws.</simpara></throws>
+    </copy-assignment>
+
+    <method-group name="modifiers">
+      <method name="swap">
+        <type>void</type>
+        <parameter name="f"><paramtype>const <classname>functionN</classname>&amp;</paramtype></parameter>
+        <effects><simpara>Interchanges the targets of <code>*this</code> and <code>f</code>.</simpara></effects>
+      </method>
+
+      <method name="clear">
+        <type>void</type>
+        <postconditions><simpara>this-&gt;<methodname>empty</methodname>()</simpara></postconditions>
+      </method>
+    </method-group>
+
+    <method-group name="capacity">
+      <method name="empty" cv="const">
+        <type>bool</type>
+        <returns><simpara><code>false</code> if <code>this</code> has a target, and <code>true</code> otherwise.</simpara></returns>
+        <throws><simpara>Will not throw.</simpara></throws>
+      </method>
+
+      <method name="conversion-operator" cv="const">
+        <type>safe_bool</type>
+        <returns><simpara>A <code>safe_bool</code> that evaluates <code>false</code> in a boolean context when <code>this-&gt;<methodname>empty</methodname>()</code>, and <code>true</code> otherwise.</simpara></returns>
+        <throws><simpara>Will not throw.</simpara></throws>
+      </method>
+
+      <method name="operator!" cv="const">
+        <type>bool</type>
+        <returns><simpara><code>this-&gt;<methodname>empty</methodname>()</code></simpara></returns>
+        <throws><simpara>Will not throw.</simpara></throws>
+      </method>
+    </method-group>
+
+    <method-group name="target access">
+      <overloaded-method name="target">
+        <signature>
+          <template> 
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>Functor*</type>
+        </signature>
+        <signature cv="const">
+          <template> 
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>const Functor*</type>
+        </signature>
+
+        <returns><simpara>If <code>this</code> stores a target of type
+        <code>Functor</code>, returns the address of the
+        target. Otherwise, returns the NULL
+        pointer.</simpara></returns>
+
+        <throws><simpara>Will not throw.</simpara></throws>
+      </overloaded-method>
+
+      <method name="contains" cv="const">
+        <template>
+          <template-type-parameter name="Functor"/>
+        </template>
+        <type>bool</type>
+        <parameter name="f">
+          <paramtype>const Functor&amp;</paramtype>
+        </parameter>
+        <returns><simpara><code>true</code> if <code>this-&gt;<methodname>target</methodname>&lt;Functor&gt;()</code> is non-NULL and <code><functionname>function_equal</functionname>(*(this-&gt;target&lt;Functor&gt;()), f)</code></simpara></returns>
+ 
+      </method>
+
+      <method name="target_type" cv="const">
+        <type>const std::type_info&amp;</type>
+        <returns><simpara><code>typeid</code> of the target function object, or <code>typeid(void)</code> if <code>this-&gt;<methodname>empty</methodname>()</code>.</simpara></returns>
+        <throws><simpara>Will not throw.</simpara></throws>
+      </method>
+
+    </method-group>
+
+    <method-group name="invocation">
+      <method name="operator()" cv="const">
+        <type>result_type</type>
+        <parameter name="a1"><paramtype>arg1_type</paramtype></parameter>
+        <parameter name="a2"><paramtype>arg2_type</paramtype></parameter>
+        <parameter><paramtype>...</paramtype></parameter>
+        <parameter name="aN"><paramtype>argN_type</paramtype></parameter>
+        <effects><simpara><code>f(a1, a2, ..., aN)</code>, where <code>f</code> is the target of <code>*this</code>.</simpara></effects>
+        <returns><simpara>if <code>R</code> is <code>void</code>, nothing is returned; otherwise, the return value of the call to <code>f</code> is returned.</simpara></returns>
+        <throws><simpara><code><classname>bad_function_call</classname></code> if <code>this-&gt;<methodname>empty</methodname>()</code>. Otherwise, may through any exception thrown by the target function <code>f</code>.</simpara></throws>
+      </method>
+    </method-group>
+
+    <free-function-group name="specialized algorithms">
+      <function name="swap">
+        <template>
+          <template-type-parameter name="T1"/>
+          <template-type-parameter name="T2"/>
+          <template-varargs/>
+          <template-type-parameter name="TN"/>
+        </template>
+        <type>void</type>
+        <parameter name="f1"><paramtype><classname>functionN</classname>&lt;T1, T2, ..., TN&gt;&amp;</paramtype></parameter>
+        <parameter name="f2"><paramtype><classname>functionN</classname>&lt;T1, T2, ..., TN&gt;&amp;</paramtype></parameter>
+        <effects><simpara><code>f1.<methodname>swap</methodname>(f2)</code></simpara></effects>
+      </function>
+    </free-function-group>
+
+    <free-function-group name="comparison operators">
+      <overloaded-function name="operator==">
+        <signature>
+          <template>
+            <template-type-parameter name="T1"/>
+            <template-type-parameter name="T2"/>
+            <template-varargs/>
+            <template-type-parameter name="TN"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="f"><paramtype>const <classname>functionN</classname>&lt;T1, T2, ..., TN&gt;&amp;</paramtype></parameter>
+          <parameter name="g"><paramtype>Functor</paramtype></parameter>
+        </signature>
+        <signature>
+          <template>
+            <template-type-parameter name="T1"/>
+            <template-type-parameter name="T2"/>
+            <template-varargs/>
+            <template-type-parameter name="TN"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="g"><paramtype>Functor</paramtype></parameter>
+          <parameter name="f"><paramtype>const <classname>functionN</classname>&lt;T1, T2, ..., TN&gt;&amp;</paramtype></parameter>
+        </signature>        
+        <signature>
+          <template>
+            <template-type-parameter name="T1"/>
+            <template-type-parameter name="T2"/>
+            <template-varargs/>
+            <template-type-parameter name="TN"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="f"><paramtype>const <classname>functionN</classname>&lt;T1, T2, ..., TN&gt;&amp;</paramtype></parameter>
+          <parameter name="g"><paramtype><classname>reference_wrapper</classname>&lt;Functor&gt;</paramtype></parameter>
+        </signature>
+        <signature>
+          <template>
+            <template-type-parameter name="T1"/>
+            <template-type-parameter name="T2"/>
+            <template-varargs/>
+            <template-type-parameter name="TN"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="g"><paramtype><classname>reference_wrapper</classname>&lt;Functor&gt;</paramtype></parameter>
+          <parameter name="f"><paramtype>const <classname>functionN</classname>&lt;T1, T2, ..., TN&gt;&amp;</paramtype></parameter>
+        </signature>        
+        <signature>
+          <template>
+            <template-type-parameter name="T1"/>
+            <template-type-parameter name="T2"/>
+            <template-varargs/>
+            <template-type-parameter name="TN"/>
+            <template-type-parameter name="U1"/>
+            <template-type-parameter name="U2"/>
+            <template-varargs/>
+            <template-type-parameter name="UN"/>
+          </template>
+          <type>void</type>
+          <parameter name="f1"><paramtype>const <classname>functionN</classname>&lt;T1, T2, ..., TN&gt;&amp;</paramtype></parameter>
+          <parameter name="f2"><paramtype>const <classname>functionN</classname>&lt;U1, U2, ..., UN&gt;&amp;</paramtype></parameter>
+        </signature>
+
+        <returns><simpara>True when <code>f</code> stores an object of
+        type <code>Functor</code> and one of the following conditions applies:
+          <itemizedlist>
+
+            <listitem><simpara><code>g</code> is of type
+            <code><classname>reference_wrapper</classname>&lt;Functor&gt;</code>
+            and <code>f.target&lt;Functor&gt;() == g.<methodname
+            alt="reference_wrapper::get_pointer">get_pointer</methodname>()</code>.</simpara></listitem>
+
+            <listitem><simpara><code>g</code> is not of type
+            <code><classname>reference_wrapper</classname>&lt;Functor&gt;</code>
+            and
+            <code><functionname>function_equal</functionname>(*(f.target&lt;Functor&gt;()),
+            g)</code>.</simpara></listitem>
+
+          </itemizedlist>
+          </simpara></returns>
+
+        <notes><simpara><code><classname>functionN</classname></code>
+        objects are not
+        <conceptname>EqualityComparable</conceptname>.</simpara></notes>
+
+        <rationale><simpara>The <code>safe_bool</code> conversion
+        opens a loophole whereby two <code>functionN</code>
+        instances can be compared via <code>==</code>, although this
+        is not feasible to implement. The undefined <code>void
+        operator==</code> closes the loophole and ensures a
+        compile-time or link-time error.</simpara></rationale>
+      </overloaded-function>
+
+      <overloaded-function name="operator!=">
+        <signature>
+          <template>
+            <template-type-parameter name="T1"/>
+            <template-type-parameter name="T2"/>
+            <template-varargs/>
+            <template-type-parameter name="TN"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="f"><paramtype>const <classname>functionN</classname>&lt;T1, T2, ..., TN&gt;&amp;</paramtype></parameter>
+          <parameter name="g"><paramtype>Functor</paramtype></parameter>
+        </signature>
+        <signature>
+          <template>
+            <template-type-parameter name="T1"/>
+            <template-type-parameter name="T2"/>
+            <template-varargs/>
+            <template-type-parameter name="TN"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="g"><paramtype>Functor</paramtype></parameter>
+          <parameter name="f"><paramtype>const <classname>functionN</classname>&lt;T1, T2, ..., TN&gt;&amp;</paramtype></parameter>
+        </signature>        
+        <signature>
+          <template>
+            <template-type-parameter name="T1"/>
+            <template-type-parameter name="T2"/>
+            <template-varargs/>
+            <template-type-parameter name="TN"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="f"><paramtype>const <classname>functionN</classname>&lt;T1, T2, ..., TN&gt;&amp;</paramtype></parameter>
+          <parameter name="g"><paramtype><classname>reference_wrapper</classname>&lt;Functor&gt;</paramtype></parameter>
+        </signature>
+        <signature>
+          <template>
+            <template-type-parameter name="T1"/>
+            <template-type-parameter name="T2"/>
+            <template-varargs/>
+            <template-type-parameter name="TN"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="g"><paramtype><classname>reference_wrapper</classname>&lt;Functor&gt;</paramtype></parameter>
+          <parameter name="f"><paramtype>const <classname>functionN</classname>&lt;T1, T2, ..., TN&gt;&amp;</paramtype></parameter>
+        </signature>        
+        <signature>
+          <template>
+            <template-type-parameter name="T1"/>
+            <template-type-parameter name="T2"/>
+            <template-varargs/>
+            <template-type-parameter name="TN"/>
+            <template-type-parameter name="U1"/>
+            <template-type-parameter name="U2"/>
+            <template-varargs/>
+            <template-type-parameter name="UN"/>
+          </template>
+          <type>void</type>
+          <parameter name="f1"><paramtype>const <classname>functionN</classname>&lt;T1, T2, ..., TN&gt;&amp;</paramtype></parameter>
+          <parameter name="f2"><paramtype>const <classname>functionN</classname>&lt;U1, U2, ..., UN&gt;&amp;</paramtype></parameter>
+        </signature>
+
+        <returns><simpara>True when <code>f</code> does not store an
+        object of type <code>Functor</code> or it stores an object of
+        type <code>Functor</code> and one of the following conditions
+        applies:
+          <itemizedlist>
+
+            <listitem><simpara><code>g</code> is of type
+            <code><classname>reference_wrapper</classname>&lt;Functor&gt;</code>
+            and <code>f.target&lt;Functor&gt;() != g.<methodname
+            alt="reference_wrapper::get_pointer">get_pointer</methodname>()</code>.</simpara></listitem>
+
+            <listitem><simpara><code>g</code> is not of type
+            <code><classname>reference_wrapper</classname>&lt;Functor&gt;</code>
+            and <code>!<functionname>function_equal</functionname>(*(f.target&lt;Functor&gt;()), g)</code>.</simpara></listitem>
+
+          </itemizedlist>
+          </simpara></returns>
+
+        <notes><simpara><code><classname>functionN</classname></code>
+        objects are not
+        <conceptname>EqualityComparable</conceptname>.</simpara></notes>
+
+        <rationale><simpara>The <code>safe_bool</code> conversion
+        opens a loophole whereby two <code>functionN</code>
+        instances can be compared via <code>!=</code>, although this
+        is not feasible to implement. The undefined <code>void
+        operator!=</code> closes the loophole and ensures a
+        compile-time or link-time error.</simpara></rationale>
+      </overloaded-function>
+    </free-function-group>
+  </class>
+
+  <class name="function">
+    <template>
+      <template-type-parameter name="Signature">
+        <purpose>Function type R (T1, T2, ..., TN)</purpose>
+      </template-type-parameter>
+    </template>
+    <inherit access="public"><classname>functionN</classname>&lt;R, T1, T2, ..., TN&gt;</inherit>
+
+    <purpose>A generalized function pointer that can be used for
+    callbacks or wrapping function objects.</purpose>
+
+    <description>
+      <para>Class template <classname>function</classname> is a thin
+      wrapper around the numbered class templates <classname
+      alt="functionN">function0</classname>, <classname
+      alt="functionN">function1</classname>, etc. It accepts a
+      function type with N arguments and will will derive from
+      <classname>functionN</classname> instantiated with the arguments
+      it receives.</para>
+
+      <para>The semantics of all operations in class template
+      <classname>function</classname> are equivalent to that of the
+      underlying <classname>functionN</classname> object, although
+      additional member functions are required to allow proper copy
+      construction and copy assignment of function objects.</para>
+    </description>
+
+    <typedef name="result_type"><type>R</type></typedef>
+    <typedef name="argument_type">
+      <type>T1</type><purpose>If N == 1</purpose>
+    </typedef>
+    <typedef name="first_argument_type">
+      <type>T1</type>
+      <purpose>If N == 2</purpose>
+    </typedef>
+    <typedef name="second_argument_type">
+      <type>T2</type>
+      <purpose>If N == 2</purpose>
+    </typedef>
+    <typedef name="arg1_type"><type>T1</type></typedef>
+    <typedef name="arg2_type"><type>T2</type></typedef>
+    <typedef name="..."><type/></typedef>
+    <typedef name="argN_type"><type>TN</type></typedef>
+
+    <static-constant name="arity">
+      <type>int</type>
+      <default>N</default>
+    </static-constant>
+
+    <struct name="sig">
+      <template>
+        <template-type-parameter name="Args"/>
+      </template>
+
+      <purpose>
+        <simpara><libraryname>Lambda</libraryname> library support</simpara>
+      </purpose>
+
+      <typedef name="type"><type>result_type</type></typedef>
+    </struct>
+
+    <constructor>
+      <postconditions><simpara><code>this-&gt;<methodname>empty</methodname>()</code></simpara></postconditions>
+      <throws><simpara>Will not throw.</simpara></throws>
+    </constructor>
+
+    <constructor>
+      <parameter name="f">
+        <paramtype>const <classname>functionN</classname>&amp;</paramtype>
+      </parameter>
+      <postconditions><simpara>Contains a copy of the <code>f</code>'s target, if it has one, or is empty if <code>f.<methodname>empty</methodname>()</code>.</simpara></postconditions>
+      <throws><simpara>Will not throw unless copying the target of <code>f</code> throws.</simpara></throws>
+    </constructor>
+        
+    <constructor>
+      <parameter name="f">
+        <paramtype><classname>functionN</classname>&amp;&amp;</paramtype>
+      </parameter>
+      <requires><simpara>C++11 compatible compiler.</simpara></requires>
+      <postconditions><simpara>Moves the value from <code>f</code> to <code>*this</code>. If the argument has its function object allocated on the heap, its buffer will be assigned to <code>*this</code> leaving argument empty.</simpara></postconditions>
+      <throws><simpara>Will not throw unless argument has its function object allocated not on the heap and copying the target of <code>f</code> throws.</simpara></throws>
+    </constructor>
+    
+    <constructor>
+      <parameter name="f">
+        <paramtype>const <classname>function</classname>&amp;</paramtype>
+      </parameter>
+      <postconditions><simpara>Contains a copy of the <code>f</code>'s target, if it has one, or is empty if <code>f.<methodname>empty</methodname>()</code>.</simpara></postconditions>
+      <throws><simpara>Will not throw unless copying the target of <code>f</code> throws.</simpara></throws>
+    </constructor>
+
+    <constructor>
+      <parameter name="f">
+        <paramtype><classname>function</classname>&amp;&amp;</paramtype>
+      </parameter>
+      <requires><simpara>C++11 compatible compiler.</simpara></requires>
+      <postconditions><simpara>Moves the value from <code>f</code> to <code>*this</code>. If the argument has its function object allocated on the heap, its buffer will be assigned to <code>*this</code> leaving argument empty.</simpara></postconditions>
+      <throws><simpara>Will not throw unless argument has its function object allocated not on the heap and copying the target of <code>f</code> throws.</simpara></throws>
+    </constructor>
+    
+    <constructor>
+      <template>
+        <template-type-parameter name="F"/>
+      </template>
+      <parameter name="f"><paramtype>F</paramtype></parameter>
+      <requires><simpara>F is a function object Callable from <code>this</code>.</simpara></requires>
+      <postconditions><simpara><code>*this</code> targets a copy of <code>f</code> if <code>f</code> is nonempty, or <code>this-&gt;<methodname>empty</methodname>()</code> if <code>f</code> is empty.</simpara></postconditions>
+    </constructor>
+
+    <constructor>
+      <template>
+        <template-type-parameter name="F"/>
+        <template-type-parameter name="Allocator"/>
+      </template>
+      <parameter name="f"><paramtype>F</paramtype></parameter>
+      <parameter name="alloc"><paramtype>Allocator</paramtype></parameter>
+      <requires><simpara>F is a function object Callable from <code>this</code>, Allocator is an allocator. The copy constructor and destructor of Allocator shall not throw.</simpara></requires>
+      <postconditions><simpara><code>*this</code> targets a copy of <code>f</code> if <code>f</code> is nonempty, or <code>this-&gt;<methodname>empty</methodname>()</code> if <code>f</code> is empty.</simpara></postconditions>
+
+      <effects><simpara>If memory allocation is required, the given allocator (or a copy of it) will be used to allocate that memory.</simpara></effects>
+    </constructor>
+
+    <destructor>
+      <effects><simpara>If <code>!this-&gt;<methodname>empty</methodname>()</code>, destroys the target of <code>this</code>.</simpara></effects>
+
+    </destructor>
+
+    <copy-assignment>
+      <parameter name="f">
+        <paramtype>const <classname>functionN</classname>&amp;</paramtype>
+      </parameter>
+      <postconditions><simpara>If copy construction does not throw, <code>*this</code> targets a copy of <code>f</code>'s target, if it has one, or is empty if <code>f.<methodname>empty</methodname>()</code>. If copy construction does throw, <code>this-&gt;<methodname>empty</methodname>()</code>.</simpara></postconditions>
+    </copy-assignment>
+    
+    <copy-assignment>
+      <parameter name="f">
+        <paramtype><classname>functionN</classname>&amp;&amp;</paramtype>
+      </parameter>
+      <requires><simpara>C++11 compatible compiler.</simpara></requires>
+      <postconditions><simpara>Moves the value from <code>f</code> to <code>*this</code>. If the argument has its function object allocated on the heap, its buffer will be assigned to <code>*this</code> leaving argument empty.</simpara></postconditions>
+      <throws><simpara>Will not throw unless argument has its function object allocated not on the heap and copying the target of <code>f</code> throws.</simpara></throws>
+    </copy-assignment>
+
+    <copy-assignment>
+      <parameter name="f">
+        <paramtype>const <classname>function</classname>&amp;</paramtype>
+      </parameter>
+      <postconditions><simpara>If copy construction of the target of <code>f</code> does not throw, <code>*this</code> targets a copy of <code>f</code>'s target, if it has one, or is empty if <code>f.<methodname>empty</methodname>()</code>. </simpara></postconditions>
+      <throws><simpara>Will not throw when the target of <code>f</code> is a stateless function object or a reference to the function object. If copy construction does throw, <code>this-&gt;<methodname>empty</methodname>()</code>.</simpara></throws>
+    </copy-assignment>
+    
+    <copy-assignment>
+      <parameter name="f">
+        <paramtype><classname>function</classname>&amp;&amp;</paramtype>
+      </parameter>
+      <requires><simpara>C++11 compatible compiler.</simpara></requires>
+      <postconditions><simpara>Moves the value from <code>f</code> to <code>*this</code>. If the argument has its function object allocated on the heap, its buffer will be assigned to <code>*this</code> leaving argument empty.</simpara></postconditions>
+      <throws><simpara>Will not throw unless argument has its function object allocated not on the heap and copying the target of <code>f</code> throws.</simpara></throws>
+    </copy-assignment>
+
+    <method-group name="modifiers">
+      <method name="swap">
+        <type>void</type>
+        <parameter name="f"><paramtype>const <classname>function</classname>&amp;</paramtype></parameter>
+        <effects><simpara>Interchanges the targets of <code>*this</code> and <code>f</code>.</simpara></effects>
+      </method>
+
+      <method name="clear">
+        <type>void</type>
+        <postconditions><simpara><code>this-&gt;<methodname>empty</methodname>()</code></simpara></postconditions>
+        <throws><simpara>Will not throw.</simpara></throws>
+      </method>
+    </method-group>
+
+    <method-group name="capacity">
+      <method name="empty" cv="const">
+        <type>bool</type>
+        <returns><simpara><code>false</code> if <code>this</code> has a target, and <code>true</code> otherwise.</simpara></returns>
+        <throws><simpara>Will not throw.</simpara></throws>
+      </method>
+
+      <method name="conversion-operator" cv="const">
+        <type>safe_bool</type>
+        <returns><simpara>A <code>safe_bool</code> that evaluates <code>false</code> in a boolean context when <code>this-&gt;<methodname>empty</methodname>()</code>, and <code>true</code> otherwise.</simpara></returns>
+        <throws><simpara>Will not throw.</simpara></throws>
+      </method>
+
+      <method name="operator!" cv="const">
+        <type>bool</type>
+        <returns><simpara><code>this-&gt;<methodname>empty</methodname>()</code></simpara></returns>
+        <throws><simpara>Will not throw.</simpara></throws>
+      </method>
+    </method-group>
+
+    <method-group name="target access">
+      <overloaded-method name="target">
+        <signature>
+          <template> 
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>Functor*</type>
+        </signature>
+        <signature cv="const">
+          <template> 
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>const Functor*</type>
+        </signature>
+
+        <returns><simpara>If <code>this</code> stores a target of type
+        <code>Functor</code>, returns the address of the
+        target. Otherwise, returns the NULL
+        pointer.</simpara></returns>
+        <throws><simpara>Will not throw.</simpara></throws>
+      </overloaded-method>
+
+      <method name="contains" cv="const">
+        <template>
+          <template-type-parameter name="Functor"/>
+        </template>
+        <type>bool</type>
+        <parameter name="f">
+          <paramtype>const Functor&amp;</paramtype>
+        </parameter>
+        <returns><simpara><code>true</code> if <code>this-&gt;<methodname>target</methodname>&lt;Functor&gt;()</code> is non-NULL and <code><functionname>function_equal</functionname>(*(this-&gt;target&lt;Functor&gt;()), f)</code></simpara></returns>
+ 
+      </method>
+
+      <method name="target_type" cv="const">
+        <type>const std::type_info&amp;</type>
+        <returns><simpara><code>typeid</code> of the target function object, or <code>typeid(void)</code> if <code>this-&gt;<methodname>empty</methodname>()</code>.</simpara></returns>
+        <throws><simpara>Will not throw.</simpara></throws>
+      </method>
+    </method-group>
+
+    <method-group name="invocation">
+      <method name="operator()" cv="const">
+        <type>result_type</type>
+        <parameter name="a1"><paramtype>arg1_type</paramtype></parameter>
+        <parameter name="a2"><paramtype>arg2_type</paramtype></parameter>
+        <parameter><paramtype>...</paramtype></parameter>
+        <parameter name="aN"><paramtype>argN_type</paramtype></parameter>
+        <effects><simpara><code>f(a1, a2, ..., aN)</code>, where <code>f</code> is the target of <code>*this</code>.</simpara></effects>
+        <returns><simpara>if <code>R</code> is <code>void</code>, nothing is returned; otherwise, the return value of the call to <code>f</code> is returned.</simpara></returns>
+        <throws><simpara><code><classname>bad_function_call</classname></code> if <code>this-&gt;<methodname>empty</methodname>()</code>. Otherwise, may through any exception thrown by the target function <code>f</code>.</simpara></throws>
+      </method>
+    </method-group>
+
+    <free-function-group name="specialized algorithms">
+      <function name="swap">
+        <template>
+          <template-type-parameter name="Signature"/>
+        </template>
+        <type>void</type>
+        <parameter name="f1"><paramtype><classname>function</classname>&lt;Signature&gt;&amp;</paramtype></parameter>
+        <parameter name="f2"><paramtype><classname>function</classname>&lt;Signature&gt;&amp;</paramtype></parameter>
+        <effects><simpara><code>f1.<methodname>swap</methodname>(f2)</code></simpara></effects>
+      </function>
+    </free-function-group>
+
+    <free-function-group name="comparison operators">
+      <overloaded-function name="operator==">
+        <signature>
+          <template>
+            <template-type-parameter name="Signature"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="f"><paramtype>const <classname>function</classname>&lt;Signature&gt;&amp;</paramtype></parameter>
+          <parameter name="g"><paramtype>Functor</paramtype></parameter>
+        </signature>
+        <signature>
+          <template>
+            <template-type-parameter name="Signature"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="g"><paramtype>Functor</paramtype></parameter>
+          <parameter name="f"><paramtype>const <classname>function</classname>&lt;Signature&gt;&amp;</paramtype></parameter>
+        </signature>        
+        <signature>
+          <template>
+            <template-type-parameter name="Signature"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="f"><paramtype>const <classname>function</classname>&lt;Signature&gt;&amp;</paramtype></parameter>
+          <parameter name="g"><paramtype><classname>reference_wrapper</classname>&lt;Functor&gt;</paramtype></parameter>
+        </signature>
+        <signature>
+          <template>
+            <template-type-parameter name="Signature"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="g"><paramtype><classname>reference_wrapper</classname>&lt;Functor&gt;</paramtype></parameter>
+          <parameter name="f"><paramtype>const <classname>function</classname>&lt;Signature&gt;&amp;</paramtype></parameter>
+        </signature>        
+        <signature>
+          <template>
+            <template-type-parameter name="Signature1"/>
+            <template-type-parameter name="Signature2"/>
+          </template>
+          <type>void</type>
+          <parameter name="f1"><paramtype>const <classname>function</classname>&lt;Signature1&gt;&amp;</paramtype></parameter>
+          <parameter name="f2"><paramtype>const <classname>function</classname>&lt;Signature2&gt;&amp;</paramtype></parameter>
+        </signature>
+
+        <returns><simpara>True when <code>f</code> stores an object of
+        type <code>Functor</code> and one of the following conditions applies:
+          <itemizedlist>
+
+            <listitem><simpara><code>g</code> is of type
+            <code><classname>reference_wrapper</classname>&lt;Functor&gt;</code>
+            and <code>f.target&lt;Functor&gt;() == g.<methodname
+            alt="reference_wrapper::get_pointer">get_pointer</methodname>()</code>.</simpara></listitem>
+
+            <listitem><simpara><code>g</code> is not of type
+            <code><classname>reference_wrapper</classname>&lt;Functor&gt;</code>
+            and <code><functionname>function_equals</functionname>(*(f.target&lt;Functor&gt;()), g)</code>.</simpara></listitem>
+
+          </itemizedlist>
+          </simpara></returns>
+
+        <notes><simpara><code><classname>function</classname></code>
+        objects are not
+        <conceptname>EqualityComparable</conceptname>.</simpara></notes>
+
+        <rationale><simpara>The <code>safe_bool</code> conversion
+        opens a loophole whereby two <code>function</code>
+        instances can be compared via <code>==</code>, although this
+        is not feasible to implement. The undefined <code>void
+        operator==</code> closes the loophole and ensures a
+        compile-time or link-time error.</simpara></rationale>
+      </overloaded-function>
+
+      <overloaded-function name="operator!=">
+        <signature>
+          <template>
+            <template-type-parameter name="Signature"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="f"><paramtype>const <classname>function</classname>&lt;Signature&gt;&amp;</paramtype></parameter>
+          <parameter name="g"><paramtype>Functor</paramtype></parameter>
+        </signature>
+        <signature>
+          <template>
+            <template-type-parameter name="Signature"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="g"><paramtype>Functor</paramtype></parameter>
+          <parameter name="f"><paramtype>const <classname>function</classname>&lt;Signature&gt;&amp;</paramtype></parameter>
+        </signature>        
+        <signature>
+          <template>
+            <template-type-parameter name="Signature"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="f"><paramtype>const <classname>function</classname>&lt;Signature&gt;&amp;</paramtype></parameter>
+          <parameter name="g"><paramtype><classname>reference_wrapper</classname>&lt;Functor&gt;</paramtype></parameter>
+        </signature>
+        <signature>
+          <template>
+            <template-type-parameter name="Signature"/>
+            <template-type-parameter name="Functor"/>
+          </template>
+          <type>bool</type>
+          <parameter name="g"><paramtype><classname>reference_wrapper</classname>&lt;Functor&gt;</paramtype></parameter>
+          <parameter name="f"><paramtype>const <classname>function</classname>&lt;Signature&gt;&amp;</paramtype></parameter>
+        </signature>        
+        <signature>
+          <template>
+            <template-type-parameter name="Signature1"/>
+            <template-type-parameter name="Signature2"/>
+          </template>
+          <type>void</type>
+          <parameter name="f1"><paramtype>const <classname>function</classname>&lt;Signature1&gt;&amp;</paramtype></parameter>
+          <parameter name="f2"><paramtype>const <classname>function</classname>&lt;Signature2&gt;&amp;</paramtype></parameter>
+        </signature>
+
+        <returns><simpara>True when <code>f</code> does not store an
+        object of type <code>Functor</code> or it stores an object of
+        type <code>Functor</code> and one of the following conditions
+        applies:
+          <itemizedlist>
+
+            <listitem><simpara><code>g</code> is of type
+            <code><classname>reference_wrapper</classname>&lt;Functor&gt;</code>
+            and <code>f.target&lt;Functor&gt;() != g.<methodname
+            alt="reference_wrapper::get_pointer">get_pointer</methodname>()</code>.</simpara></listitem>
+
+            <listitem><simpara><code>g</code> is not of type
+            <code><classname>reference_wrapper</classname>&lt;Functor&gt;</code>
+            and <code>!<functionname>function_equals</functionname>(*(f.target&lt;Functor&gt;()), g)</code>.</simpara></listitem>
+
+          </itemizedlist>
+          </simpara></returns>
+
+        <notes><simpara><code><classname>function</classname></code>
+        objects are not
+        <conceptname>EqualityComparable</conceptname>.</simpara></notes>
+
+        <rationale><simpara>The <code>safe_bool</code> conversion
+        opens a loophole whereby two <code>function</code>
+        instances can be compared via <code>!=</code>, although this
+        is not feasible to implement. The undefined <code>void
+        operator!=</code> closes the loophole and ensures a
+        compile-time or link-time error.</simpara></rationale>
+      </overloaded-function>
+    </free-function-group>
+  </class>
+</namespace>
+</header>
+
+<header name="boost/function_equal.hpp">
+  <namespace name="boost">
+  <function name="function_equal">
+    <template>
+      <template-type-parameter name="F"/>
+      <template-type-parameter name="G"/>
+    </template>
+    <type>bool</type>
+    <parameter name="f">
+      <paramtype>const F&amp;</paramtype>
+    </parameter>
+    <parameter name="g">
+      <paramtype>const G&amp;</paramtype>
+    </parameter>
+    <purpose><simpara>Compare two function objects for equality.</simpara></purpose>
+    <returns><simpara><code>f == g</code>.</simpara></returns>
+    <throws><simpara>Only if <code>f == g</code> throws.</simpara></throws>
+  </function>
+  </namespace>
+</header>
+</library-reference>
diff --git a/libs/function/doc/tests.xml b/libs/function/doc/tests.xml
new file mode 100644
index 0000000..c8d8b65
--- /dev/null
+++ b/libs/function/doc/tests.xml
@@ -0,0 +1,258 @@
+<?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">
+<testsuite id="function.testsuite" last-revision="$Date: 2006-11-03 11:41:10 -0800 (Fri, 03 Nov 2006) $">
+  <run-test filename="function_test.cpp" name="lib_function_test">
+    <purpose><para>Test the capabilities of the <classname>boost::function</classname> class template.</para></purpose>
+    <if-fails><para>The <classname>boost::function</classname> class template may not be usable on your compiler. However, the library may still be usable via the <classname>boost::functionN</classname> class templates.</para></if-fails>
+  </run-test>
+
+  <run-test filename="function_n_test.cpp">
+    <purpose><para>Test the capabilities of the <classname>boost::functionN</classname> class templates.</para></purpose>
+  </run-test>
+
+  <run-test filename="allocator_test.cpp">
+    <purpose><para>Test the use of custom allocators.</para></purpose>
+    <if-fails><para>Allocators are ignored by the implementation.</para></if-fails>
+  </run-test>
+
+  <run-test filename="stateless_test.cpp">
+    <purpose><para>Test the optimization of stateless function objects in the Boost.Function library.</para></purpose>
+    <if-fails><para>The exception-safety and performance guarantees given for stateless function objects may not be met by the implementation.</para></if-fails>
+  </run-test>
+
+  <run-test filename="lambda_test.cpp">
+    <purpose><para>Test the interaction between Boost.Function and Boost.Lambda.</para></purpose>
+    <if-fails><para>Either Boost.Lambda does not work on the platform, or Boost.Function cannot safely be applied without the use of <functionname>boost::unlambda</functionname>.</para></if-fails>
+  </run-test>
+
+  <run-test filename="contains_test.cpp">
+    <purpose><para>Test the operation of the
+    <code><methodname>target</methodname></code> member function and the
+    equality operators.</para></purpose>
+  </run-test>
+
+  <compile-fail-test filename="function_test_fail1.cpp">
+    <purpose><para>Test the (incorrect!) use of comparisons between Boost.Function function objects.</para></purpose>
+    <if-fails><para>Intuitive (but incorrect!) code may compile and will give meaningless results.</para></if-fails>
+  </compile-fail-test>
+
+  <compile-fail-test filename="function_test_fail2.cpp">
+    <purpose><para>Test the use of an incompatible function object with Boost.Function</para></purpose>
+    <if-fails><para>Incorrect code may compile (with potentially unexpected results).</para></if-fails>
+  </compile-fail-test>
+
+  <compile-test filename="function_30.cpp">
+    <purpose><para>Test the generation of a Boost.Function function object adaptor accepting 30 arguments.</para></purpose>
+    <if-fails><para>The Boost.Function library may work for function object adaptors of up to 10 parameters, but will be unable to generate adaptors for an arbitrary number of parameters. Failure often indicates an error in the compiler's preprocessor.</para></if-fails>
+  </compile-test> 
+
+  <run-test filename="function_arith_cxx98.cpp">
+    <source>
+    <![CDATA[
+#include <boost/function.hpp>
+#include <iostream>
+]]>
+
+<snippet name="function.tutorial.mul_ints"/>
+<snippet name="function.tutorial.int_div"/>
+
+int main()
+{
+    <snippet name="function.tutorial.arith.cxx98"/>
+    <snippet name="function.tutorial.use_int_div"/>
+    <snippet name="function.tutorial.call_int_div"/>
+    <snippet name="function.tutorial.check_empty"/>
+    <snippet name="function.tutorial.clear"/>
+    <snippet name="function.tutorial.use_mul_ints"/>
+  
+    return 0;
+}
+</source>
+    <purpose><para>Test the first tutorial example.</para></purpose>
+  </run-test>
+
+  <run-test filename="function_arith_portable.cpp">
+    <source>
+    <![CDATA[
+#include <boost/function.hpp>
+#include <iostream>
+]]>
+<snippet name="function.tutorial.mul_ints"/>
+<snippet name="function.tutorial.int_div"/>
+int main()
+{
+    <snippet name="function.tutorial.arith.portable"/>
+    <snippet name="function.tutorial.use_int_div"/>
+    <snippet name="function.tutorial.call_int_div"/>
+    <snippet name="function.tutorial.check_empty"/>
+    <snippet name="function.tutorial.clear"/>
+    <snippet name="function.tutorial.use_mul_ints"/>
+
+    return 0;
+}
+</source>
+    <purpose><para>Test the first tutorial example.</para></purpose>
+  </run-test>
+
+  <run-test filename="sum_avg_cxx98.cpp">
+    <source>
+    <![CDATA[
+#include <boost/function.hpp>
+#include <iostream>
+]]>
+<snippet name="function.tutorial.sum_avg"/>
+int main()
+{
+    <snippet name="function.tutorial.sum_avg_decl.cxx98"/>
+    <snippet name="function.tutorial.use_sum_avg"/>
+
+    return 0;
+}
+</source>
+    <purpose><para>Test the second tutorial example.</para></purpose>
+  </run-test>
+
+  <run-test filename="sum_avg_portable.cpp">
+    <source>
+    <![CDATA[
+#include <boost/function.hpp>
+#include <iostream>
+]]>
+<snippet name="function.tutorial.sum_avg"/>
+int main()
+{
+    <snippet name="function.tutorial.sum_avg_decl.portable"/>
+    <snippet name="function.tutorial.use_sum_avg"/>
+
+    return 0;
+}
+</source>
+    <purpose><para>Test the second tutorial example.</para></purpose>
+  </run-test>
+
+  <run-test filename="mem_fun_cxx98.cpp">
+    <source>
+    <![CDATA[
+#include <boost/function.hpp>
+#include <iostream>
+#include <functional>
+]]>
+<snippet name="function.tutorial.X"/>
+int X::foo(int x) { return -x; }
+
+int main()
+{
+    <snippet name="function.tutorial.mem_fun.cxx98"/>
+
+    return 0;
+}
+</source>    
+    <purpose><para>Test member function example from tutorial.</para></purpose>
+  </run-test>
+
+  <run-test filename="mem_fun_portable.cpp">
+    <source>
+    <![CDATA[
+#include <boost/function.hpp>
+#include <iostream>
+#include <functional>
+]]>
+<snippet name="function.tutorial.X"/>
+int X::foo(int x) { return -x; }
+
+int main()
+{
+    <snippet name="function.tutorial.mem_fun.portable"/>
+
+    return 0;
+}
+</source>    
+    <purpose><para>Test member function example from tutorial.</para></purpose>
+  </run-test>
+
+  <run-test filename="std_bind_cxx98.cpp">
+    <source>
+    <![CDATA[
+#include <boost/function.hpp>
+#include <iostream>
+#include <functional>
+]]>
+<snippet name="function.tutorial.X"/>
+int X::foo(int x) { return -x; }
+
+int main()
+{
+    <snippet name="function.tutorial.std_bind.cxx98"/>
+
+    return 0;
+}
+</source>
+    <purpose><para>Test standard binders example from tutorial.</para></purpose>
+  </run-test>
+
+  <run-test filename="std_bind_portable.cpp">
+    <source>
+    <![CDATA[
+#include <boost/function.hpp>
+#include <iostream>
+#include <functional>
+]]>
+<snippet name="function.tutorial.X"/>
+int X::foo(int x) { return -x; }
+
+int main()
+{
+    <snippet name="function.tutorial.std_bind.portable"/>
+
+    return 0;
+}
+</source>
+    <purpose><para>Test standard binders example from tutorial.</para></purpose>
+  </run-test>
+
+  <run-test filename="function_ref_cxx98.cpp">
+    <source>
+<![CDATA[
+#include <boost/function.hpp>
+#include <iostream>
+]]>
+
+struct stateful_type { int operator()(int) const { return 0; } };
+
+int main()
+{
+  <snippet name="function.tutorial.ref.cxx98"/>
+
+    return 0;
+}
+</source>
+    <purpose><para>Test <functionname>boost::ref</functionname> example from tutorial.</para></purpose>
+  </run-test>
+
+  <run-test filename="function_ref_portable.cpp">
+    <source>
+<![CDATA[
+#include <boost/function.hpp>
+#include <iostream>
+]]>
+
+struct stateful_type { int operator()(int) const { return 0; } };
+
+int main()
+{
+  <snippet name="function.tutorial.ref.portable"/>
+
+    return 0;
+}
+</source>
+    <purpose><para>Test <functionname>boost::ref</functionname> example from tutorial.</para></purpose>
+  </run-test>
+</testsuite>
diff --git a/libs/function/doc/tutorial.xml b/libs/function/doc/tutorial.xml
new file mode 100644
index 0000000..5429c3a
--- /dev/null
+++ b/libs/function/doc/tutorial.xml
@@ -0,0 +1,364 @@
+<?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 xmlns:xi="http://www.w3.org/2001/XInclude" id="function.tutorial"
+         last-revision="$Date: 2009-07-12 09:13:35 -0700 (Sun, 12 Jul 2009) $">
+<title>Tutorial</title>
+
+<using-namespace name="boost"/>
+
+<para> Boost.Function has two syntactical forms: the preferred form
+and the portable form. The preferred form fits more closely with the
+C++ language and reduces the number of separate template parameters
+that need to be considered, often improving readability; however, the
+preferred form is not supported on all platforms due to compiler
+bugs. The compatible form will work on all compilers supported by
+Boost.Function. Consult the table below to determine which syntactic
+form to use for your compiler.
+
+  <informaltable>
+    <tgroup cols="2" align="left">
+      <thead>
+        <row>
+          <entry>Preferred syntax</entry>
+          <entry>Portable syntax</entry>
+        </row>
+      </thead>
+      <tbody>
+        <row>
+          <entry>
+            <itemizedlist spacing="compact">
+              <listitem><simpara>GNU C++ 2.95.x, 3.0.x and later versions</simpara></listitem>
+              <listitem><simpara>Comeau C++ 4.2.45.2</simpara></listitem>
+              <listitem><simpara>SGI MIPSpro 7.3.0</simpara></listitem>
+              <listitem><simpara>Intel C++ 5.0, 6.0</simpara></listitem>
+              <listitem><simpara>Compaq's cxx 6.2</simpara></listitem>
+	      <listitem><simpara>Microsoft Visual C++ 7.1 and later versions</simpara></listitem>
+            </itemizedlist>
+          </entry>
+          <entry>
+            <itemizedlist spacing="compact">
+              <listitem><simpara><emphasis>Any compiler supporting the preferred syntax</emphasis></simpara></listitem>
+              <listitem><simpara>Microsoft Visual C++ 6.0, 7.0</simpara></listitem>
+              <listitem><simpara>Borland C++ 5.5.1</simpara></listitem>
+              <listitem><simpara>Sun WorkShop 6 update 2 C++ 5.3</simpara></listitem>
+              <listitem><simpara>Metrowerks CodeWarrior 8.1</simpara></listitem>
+            </itemizedlist>
+          </entry>
+        </row>
+      </tbody>
+    </tgroup>
+  </informaltable>
+
+</para>
+
+<para> If your compiler does not appear in this list, please try the preferred syntax and report your results to the Boost list so that we can keep this table up-to-date.</para>
+
+<using-class name="boost::function"/>
+
+<section>
+<title>Basic Usage</title> <para> A function wrapper is defined simply
+by instantiating the <computeroutput>function</computeroutput> class
+template with the desired return type and argument types, formulated
+as a C++ function type. Any number of arguments may be supplied, up to
+some implementation-defined limit (10 is the default maximum). The
+following declares a function object wrapper
+<computeroutput>f</computeroutput> that takes two
+<computeroutput>int</computeroutput> parameters and returns a
+<computeroutput>float</computeroutput>:
+
+  <informaltable>
+    <tgroup cols="2" align="left">
+      <thead>
+        <row>
+          <entry>Preferred syntax</entry>
+          <entry>Portable syntax</entry>
+        </row>
+      </thead>
+      <tbody>
+        <row>
+          <entry>
+<programlisting name="function.tutorial.arith.cxx98"><classname>boost::function</classname>&lt;float (int x, int y)&gt; f;</programlisting>
+</entry>
+<entry>
+<programlisting name="function.tutorial.arith.portable"><classname alt="functionN">boost::function2</classname>&lt;float, int, int&gt; f;</programlisting>
+</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </informaltable>
+</para>
+
+<para> By default, function object wrappers are empty, so we can create a 
+function object to assign to <computeroutput>f</computeroutput>:
+
+<programlisting name="function.tutorial.int_div">struct int_div { 
+  float operator()(int x, int y) const { return ((float)x)/y; }; 
+};</programlisting>
+<programlisting name="function.tutorial.use_int_div">f = int_div();</programlisting>
+</para>
+
+<para> Now we can use <computeroutput>f</computeroutput> to execute
+the underlying function object
+<computeroutput>int_div</computeroutput>:
+
+<programlisting name="function.tutorial.call_int_div">std::cout &lt;&lt; f(5, 3) &lt;&lt; std::endl;</programlisting>
+</para>
+
+<para> We are free to assign any compatible function object to
+<computeroutput>f</computeroutput>. If
+<computeroutput>int_div</computeroutput> had been declared to take two
+<computeroutput>long</computeroutput> operands, the implicit
+conversions would have been applied to the arguments without any user
+interference. The only limit on the types of arguments is that they be
+CopyConstructible, so we can even use references and arrays:
+
+  <informaltable>
+    <tgroup cols="1" align="left">
+      <thead><row><entry>Preferred syntax</entry></row></thead>
+      <tbody>
+        <row>
+          <entry>
+<programlisting name="function.tutorial.sum_avg_decl.cxx98"><classname>boost::function</classname>&lt;void (int values[], int n, int&amp; sum, float&amp; avg)&gt; sum_avg;</programlisting>
+</entry>
+        </row>
+      </tbody>
+    </tgroup> 
+  </informaltable>
+  <informaltable>
+    <tgroup cols="1" align="left">
+      <thead><row><entry>Portable syntax</entry></row></thead>
+      <tbody>
+        <row>
+<entry>
+<programlisting name="function.tutorial.sum_avg_decl.portable"><classname alt="functionN">boost::function4</classname>&lt;void, int*, int, int&amp;, float&amp;&gt; sum_avg;</programlisting>
+</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </informaltable>
+
+<programlisting name="function.tutorial.sum_avg">void do_sum_avg(int values[], int n, int&amp; sum, float&amp; avg)
+{
+  sum = 0;
+  for (int i = 0; i &lt; n; i++)
+    sum += values[i];
+  avg = (float)sum / n;
+}</programlisting>
+
+
+<programlisting name="function.tutorial.use_sum_avg">sum_avg = &amp;do_sum_avg;</programlisting>
+</para>
+
+<para> Invoking a function object wrapper that does not actually
+contain a function object is a precondition violation, much like
+trying to call through a null function pointer, and will throw a <classname>bad_function_call</classname> exception). We can check for an
+empty function object wrapper by using it in a boolean context (it evaluates <computeroutput>true</computeroutput> if the wrapper is not empty) or compare it against <computeroutput>0</computeroutput>. For instance:
+<programlisting name="function.tutorial.check_empty">if (f)
+  std::cout &lt;&lt; f(5, 3) &lt;&lt; std::endl;
+else
+  std::cout &lt;&lt; "f has no target, so it is unsafe to call" &lt;&lt; std::endl;</programlisting>
+</para>
+
+<para> Alternatively,
+<computeroutput><methodname>empty</methodname>()</computeroutput>
+method will return whether or not the wrapper is empty.  </para>
+
+<para> Finally, we can clear out a function target by assigning it to <computeroutput>0</computeroutput> or by calling the <computeroutput><methodname>clear</methodname>()</computeroutput> member function, e.g., 
+<programlisting name="function.tutorial.clear">f = 0;</programlisting>
+</para>
+
+</section>
+
+<section>
+  <title>Free functions</title>
+<para> Free function pointers can be considered singleton function objects with const function call operators, and can therefore be directly used with the function object wrappers: 
+<programlisting name="function.tutorial.mul_ints">float mul_ints(int x, int y) { return ((float)x) * y; }</programlisting>
+<programlisting name="function.tutorial.use_mul_ints">f = &amp;mul_ints;</programlisting>
+</para>
+
+<para> Note that the <computeroutput>&amp;</computeroutput> isn't really necessary unless you happen to be using Microsoft Visual C++ version 6. </para>
+</section>
+
+<section>
+  <title>Member functions</title>
+
+<para> In many systems, callbacks often call to member functions of a
+particular object. This is often referred to as "argument binding",
+and is beyond the scope of Boost.Function. The use of member functions
+directly, however, is supported, so the following code is valid:
+
+<programlisting name="function.tutorial.X">struct X {
+  int foo(int);
+};</programlisting>
+
+  <informaltable>
+    <tgroup cols="2" align="left">
+      <thead>
+        <row>
+          <entry>Preferred syntax</entry>
+          <entry>Portable syntax</entry>
+        </row>
+      </thead>
+      <tbody>
+        <row>
+          <entry>
+<programlisting name="function.tutorial.mem_fun.cxx98"><classname>boost::function</classname>&lt;int (X*, int)&gt; f;
+
+f = &amp;X::foo;
+  
+X x;
+f(&amp;x, 5);</programlisting>
+</entry>
+<entry>
+<programlisting name="function.tutorial.mem_fun.portable"><classname alt="functionN">boost::function2</classname>&lt;int, X*, int&gt; f;
+
+f = &amp;X::foo;
+  
+X x;
+f(&amp;x, 5);</programlisting>
+</entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
+</para>
+
+<para> Several libraries exist that support argument binding. Three such libraries are summarized below:
+<itemizedlist>
+  <listitem> <para><libraryname>Bind</libraryname>. This library allows binding of
+  arguments for any function object. It is lightweight and very
+  portable.</para></listitem>
+
+  <listitem> <para>The C++ Standard library. Using
+  <computeroutput>std::bind1st</computeroutput> and
+  <computeroutput>std::mem_fun</computeroutput> together one can bind
+  the object of a pointer-to-member function for use with
+  Boost.Function:
+
+  <informaltable>
+    <tgroup cols="2" align="left">
+      <thead>
+        <row>
+          <entry>Preferred syntax</entry>
+          <entry>Portable syntax</entry>
+        </row>
+      </thead>
+      <tbody>
+        <row>
+          <entry>
+<programlisting name="function.tutorial.std_bind.cxx98">  <classname>boost::function</classname>&lt;int (int)&gt; f;
+X x;
+f = std::bind1st(
+      std::mem_fun(&amp;X::foo), &amp;x);
+f(5); // Call x.foo(5)</programlisting>
+</entry>
+<entry>
+<programlisting name="function.tutorial.std_bind.portable">  <classname alt="functionN">boost::function1</classname>&lt;int, int&gt; f;
+X x;
+f = std::bind1st(
+      std::mem_fun(&amp;X::foo), &amp;x);
+f(5); // Call x.foo(5)</programlisting>
+</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </informaltable>
+</para>
+</listitem>
+
+  <listitem><para>The <libraryname>Lambda</libraryname> library. This library provides a powerful composition mechanism to construct function objects that uses very natural C++ syntax. Lambda requires a compiler that is reasonably conformant to the C++ standard. </para></listitem>
+</itemizedlist>
+</para>
+
+</section>
+
+<section>
+  <title>References to Function Objects</title> <para> In some cases it is
+  expensive (or semantically incorrect) to have Boost.Function clone a
+  function object. In such cases, it is possible to request that
+  Boost.Function keep only a reference to the actual function
+  object. This is done using the <computeroutput>ref</computeroutput>
+  and <computeroutput>cref</computeroutput> functions to wrap a
+  reference to a function object:
+
+  <informaltable>
+    <tgroup cols="2" align="left">
+      <thead>
+        <row>
+          <entry>Preferred syntax</entry>
+          <entry>Portable syntax</entry>
+        </row>
+      </thead>
+      <tbody>
+        <row>
+          <entry>
+<programlisting name="function.tutorial.ref.cxx98">stateful_type a_function_object;
+<classname>boost::function</classname>&lt;int (int)&gt; f;
+f = <functionname>boost::ref</functionname>(a_function_object);
+
+<classname>boost::function</classname>&lt;int (int)&gt; f2(f);</programlisting>
+</entry>
+<entry>
+<programlisting name="function.tutorial.ref.portable">stateful_type a_function_object;
+<classname alt="functionN">boost::function1</classname>&lt;int, int&gt; f;
+f = <functionname>boost::ref</functionname>(a_function_object);
+
+<classname alt="functionN">boost::function1</classname>&lt;int, int&gt; f2(f);</programlisting>
+</entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </informaltable>
+</para>
+
+<para> Here, <computeroutput>f</computeroutput> will not make a copy
+of <computeroutput>a_function_object</computeroutput>, nor will
+<computeroutput>f2</computeroutput> when it is targeted to
+<computeroutput>f</computeroutput>'s reference to
+<computeroutput>a_function_object</computeroutput>. Additionally, when
+using references to function objects, Boost.Function will not throw
+exceptions during assignment or construction.
+</para>
+</section>
+
+<section>
+  <title>Comparing Boost.Function function objects</title>
+
+  <para>Function object wrappers can be compared via <code>==</code>
+  or <code>!=</code> against any function object that can be stored
+  within the wrapper. If the function object wrapper contains a
+  function object of that type, it will be compared against the given
+  function object (which must be either be
+  <conceptname>EqualityComparable</conceptname> or have an overloaded <functionname>boost::function_equal</functionname>). For instance:</para>
+  
+  <programlisting name="function.tutorial.compare">int compute_with_X(X*, int);
+
+f = &amp;X::foo;
+assert(f == &amp;X::foo);
+assert(&amp;compute_with_X != f);</programlisting>
+
+   <para>When comparing against an instance of
+   <code><classname>reference_wrapper</classname></code>, the address
+   of the object in the
+   <code><classname>reference_wrapper</classname></code> is compared
+   against the address of the object stored by the function object
+   wrapper:</para>
+
+  <programlisting name="function.tutorial.compare-ref">a_stateful_object so1, so2;
+f = <functionname>boost::ref</functionname>(so1);
+assert(f == <functionname>boost::ref</functionname>(so1));
+assert(f == so1); <emphasis>// Only if a_stateful_object is <conceptname>EqualityComparable</conceptname></emphasis>
+assert(f != <functionname>boost::ref</functionname>(so2));</programlisting>
+
+</section>
+
+</section>
+
diff --git a/libs/function/example/bind1st.cpp b/libs/function/example/bind1st.cpp
new file mode 100644
index 0000000..8dfc68a
--- /dev/null
+++ b/libs/function/example/bind1st.cpp
@@ -0,0 +1,32 @@
+// Boost.Function library examples
+
+//  Copyright Douglas Gregor 2001-2003. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#include <iostream>
+#include <boost/function.hpp>
+#include <functional>
+
+struct X {
+  X(int val) : value(val) {}
+
+  int foo(int x) { return x * value; }
+
+  int value;
+};
+
+
+int
+main()
+{
+  ndnboost::function<int (int)> f;
+  X x(7);
+  f = std::bind1st(std::mem_fun(&X::foo), &x);
+
+  std::cout << f(5) << std::endl; // Call x.foo(5)
+  return 0;
+}
diff --git a/libs/function/example/int_div.cpp b/libs/function/example/int_div.cpp
new file mode 100644
index 0000000..8991f56
--- /dev/null
+++ b/libs/function/example/int_div.cpp
@@ -0,0 +1,26 @@
+// Boost.Function library examples
+
+//  Copyright Douglas Gregor 2001-2003. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#include <iostream>
+#include <boost/function.hpp>
+
+struct int_div {
+  float operator()(int x, int y) const { return ((float)x)/y; };
+};
+
+int
+main()
+{
+  ndnboost::function<float (int, int)> f;
+  f = int_div();
+
+  std::cout << f(5, 3) << std::endl; // 1.66667
+
+  return 0;
+}
diff --git a/libs/function/example/sum_avg.cpp b/libs/function/example/sum_avg.cpp
new file mode 100644
index 0000000..488f380
--- /dev/null
+++ b/libs/function/example/sum_avg.cpp
@@ -0,0 +1,38 @@
+// Boost.Function library examples
+
+//  Copyright Douglas Gregor 2001-2003. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#include <iostream>
+#include <boost/function.hpp>
+
+void do_sum_avg(int values[], int n, int& sum, float& avg)
+{
+  sum = 0;
+  for (int i = 0; i < n; i++)
+    sum += values[i];
+  avg = (float)sum / n;
+}
+
+int
+main()
+{
+  // The second parameter should be int[], but some compilers (e.g., GCC)
+  // complain about this
+  ndnboost::function<void (int*, int, int&, float&)> sum_avg;
+
+  sum_avg = &do_sum_avg;
+
+  int values[5] = { 1, 1, 2, 3, 5 };
+  int sum;
+  float avg;
+  sum_avg(values, 5, sum, avg);
+
+  std::cout << "sum = " << sum << std::endl;
+  std::cout << "avg = " << avg << std::endl;
+  return 0;
+}
diff --git a/libs/function/index.html b/libs/function/index.html
new file mode 100644
index 0000000..b7d40d2
--- /dev/null
+++ b/libs/function/index.html
@@ -0,0 +1,20 @@
+<html>
+<!--
+   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)
+  -->
+<head>
+<meta http-equiv="refresh" content="0; URL=../../doc/html/function.html">
+</head>
+<body>
+Automatic redirection failed, please go to
+<a href="../../doc/html/function.html">../../doc/html/function.html</a> &nbsp;<hr>
+<p>© Copyright Beman Dawes, 2001</p>
+<p>Distributed under the Boost Software License, Version 1.0. (See accompanying 
+file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy 
+at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/libs/function/test/Jamfile.v2 b/libs/function/test/Jamfile.v2
new file mode 100644
index 0000000..fe4dfe3
--- /dev/null
+++ b/libs/function/test/Jamfile.v2
@@ -0,0 +1,67 @@
+# Function library
+
+# Copyright Douglas Gregor 2001-2003. Use, modification and
+# distribution is subject to 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)
+
+# For more information, see http://www.boost.org/
+
+project
+    : requirements <toolset>msvc:<asynch-exceptions>on
+    : source-location $(BOOST_ROOT)
+    ;
+
+# bring in rules for testing
+import testing ;
+
+{
+
+  test-suite function
+    : 
+  [ run libs/function/test/function_test.cpp :  :  :  : lib_function_test ]
+
+  [ run libs/function/test/function_n_test.cpp :  :  :  :  ]
+
+  [ run libs/function/test/allocator_test.cpp ../../../libs/test/build//ndnboost_test_exec_monitor :  :  :  :  ]
+
+  [ run libs/function/test/stateless_test.cpp ../../../libs/test/build//ndnboost_test_exec_monitor :  :  :  :  ]
+
+  [ run libs/function/test/lambda_test.cpp ../../../libs/test/build//ndnboost_test_exec_monitor :  :  :  :  ]
+
+  [ compile-fail libs/function/test/function_test_fail1.cpp :  :  :  :  ]
+
+  [ compile-fail libs/function/test/function_test_fail2.cpp :  :  :  :  ]
+
+  [ compile libs/function/test/function_30.cpp :  :  :  :  ] 
+
+  [ run libs/function/test/function_arith_cxx98.cpp :  :  :  :  ]
+
+  [ run libs/function/test/function_arith_portable.cpp :  :  :  :  ]
+
+  [ run libs/function/test/sum_avg_cxx98.cpp :  :  :  :  ]
+
+  [ run libs/function/test/sum_avg_portable.cpp :  :  :  :  ]
+
+  [ run libs/function/test/mem_fun_cxx98.cpp :  :  :  :  ]
+
+  [ run libs/function/test/mem_fun_portable.cpp :  :  :  :  ]
+
+  [ run libs/function/test/std_bind_cxx98.cpp :  :  :  :  ]
+
+  [ run libs/function/test/std_bind_portable.cpp :  :  :  :  ]
+
+  [ run libs/function/test/function_ref_cxx98.cpp :  :  :  :  ]
+
+  [ run libs/function/test/function_ref_portable.cpp :  :  :  :  ]
+  
+  [ run libs/function/test/contains_test.cpp : : : : ]
+   
+  [ run libs/function/test/contains2_test.cpp : : : : ]
+   
+  [ run libs/function/test/nothrow_swap.cpp :  :  :  :  ]
+
+  [ compile libs/function/test/function_typeof_test.cpp ]
+ ;
+}
+      
diff --git a/libs/function/test/allocator_test.cpp b/libs/function/test/allocator_test.cpp
new file mode 100644
index 0000000..de91e6b
--- /dev/null
+++ b/libs/function/test/allocator_test.cpp
@@ -0,0 +1,137 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2001-2003. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#include <boost/test/minimal.hpp>
+#include <cassert>
+#include <functional>
+#include <boost/function.hpp>
+
+using namespace std;
+using namespace ndnboost;
+
+static int alloc_count = 0;
+static int dealloc_count = 0;
+
+template<typename T>
+struct counting_allocator : public std::allocator<T>
+{
+  template<typename U>
+  struct rebind
+  {
+    typedef counting_allocator<U> other;
+  };
+
+  counting_allocator()
+  {
+  }
+
+  template<typename U>
+  counting_allocator( counting_allocator<U> )
+  {
+  }
+
+  T* allocate(std::size_t n)
+  {
+    alloc_count++;
+    return std::allocator<T>::allocate(n);
+  }
+
+  void deallocate(T* p, std::size_t n)
+  {
+    dealloc_count++;
+    std::allocator<T>::deallocate(p, n);
+  }
+};
+
+struct enable_small_object_optimization
+{
+};
+
+struct disable_small_object_optimization
+{
+  int unused_state_data[32];
+};
+
+template <typename base>
+struct plus_int: base
+{
+  int operator()(int x, int y) const { return x + y; }
+};
+
+static int do_minus(int x, int y) { return x-y; }
+
+template <typename base>
+struct DoNothing: base
+{
+  void operator()() const {}
+};
+
+static void do_nothing() {}
+
+int
+test_main(int, char*[])
+{
+  function2<int, int, int> f;
+  f.assign( plus_int<disable_small_object_optimization>(), counting_allocator<int>() );
+  f.clear();
+  BOOST_CHECK(alloc_count == 1);
+  BOOST_CHECK(dealloc_count == 1);
+  alloc_count = 0;
+  dealloc_count = 0;
+  f.assign( plus_int<enable_small_object_optimization>(), counting_allocator<int>() );
+  f.clear();
+  BOOST_CHECK(alloc_count == 0);
+  BOOST_CHECK(dealloc_count == 0);
+  f.assign( plus_int<disable_small_object_optimization>(), std::allocator<int>() );
+  f.clear();
+  f.assign( plus_int<enable_small_object_optimization>(), std::allocator<int>() );
+  f.clear();
+
+  alloc_count = 0;
+  dealloc_count = 0;
+  f.assign( &do_minus, counting_allocator<int>() );
+  f.clear();
+  BOOST_CHECK(alloc_count == 0);
+  BOOST_CHECK(dealloc_count == 0);
+  f.assign( &do_minus, std::allocator<int>() );
+  f.clear();
+
+  function0<void> fv;
+  alloc_count = 0;
+  dealloc_count = 0;
+  fv.assign( DoNothing<disable_small_object_optimization>(), counting_allocator<int>() );
+  fv.clear();
+  BOOST_CHECK(alloc_count == 1);
+  BOOST_CHECK(dealloc_count == 1);
+  alloc_count = 0;
+  dealloc_count = 0;
+  fv.assign( DoNothing<enable_small_object_optimization>(), counting_allocator<int>() );
+  fv.clear();
+  BOOST_CHECK(alloc_count == 0);
+  BOOST_CHECK(dealloc_count == 0);
+  fv.assign( DoNothing<disable_small_object_optimization>(), std::allocator<int>() );
+  fv.clear();
+  fv.assign( DoNothing<enable_small_object_optimization>(), std::allocator<int>() );
+  fv.clear();
+
+  alloc_count = 0;
+  dealloc_count = 0;
+  fv.assign( &do_nothing, counting_allocator<int>() );
+  fv.clear();
+  BOOST_CHECK(alloc_count == 0);
+  BOOST_CHECK(dealloc_count == 0);
+  fv.assign( &do_nothing, std::allocator<int>() );
+  fv.clear();
+  
+  function0<void> fv2;
+  fv.assign(&do_nothing, std::allocator<int>() );
+  fv2.assign(fv, std::allocator<int>() );
+
+  return 0;
+}
diff --git a/libs/function/test/contains2_test.cpp b/libs/function/test/contains2_test.cpp
new file mode 100644
index 0000000..2127eb8
--- /dev/null
+++ b/libs/function/test/contains2_test.cpp
@@ -0,0 +1,88 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2004.
+//  Copyright 2005 Peter Dimov
+
+//  Use, modification and distribution is subject to
+//  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)
+
+#include <boost/function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+static int forty_two()
+{
+    return 42;
+}
+
+struct Seventeen
+{
+    int operator()() const
+    {
+        return 17;
+    }
+};
+
+bool operator==(const Seventeen&, const Seventeen&)
+{
+    return true;
+}
+
+struct ReturnInt
+{
+    explicit ReturnInt(int value) : value(value)
+    {
+    }
+
+    int operator()() const
+    {
+        return value;
+    }
+
+    int value;
+};
+
+bool operator==(const ReturnInt& x, const ReturnInt& y)
+{
+    return x.value == y.value;
+}
+
+bool operator!=(const ReturnInt& x, const ReturnInt& y)
+{
+    return x.value != y.value;
+}
+
+int main()
+{
+    ndnboost::function0<int> fn;
+
+    fn = &forty_two;
+
+    BOOST_TEST( fn() == 42 );
+
+    BOOST_TEST( fn.contains(&forty_two) );
+    BOOST_TEST( !fn.contains( Seventeen() ) );
+    BOOST_TEST( !fn.contains( ReturnInt(0) ) );
+    BOOST_TEST( !fn.contains( ReturnInt(12) ) );
+
+    fn = Seventeen();
+
+    BOOST_TEST( fn() == 17 );
+
+    BOOST_TEST( !fn.contains( &forty_two ) );
+    BOOST_TEST( fn.contains( Seventeen() ) );
+    BOOST_TEST( !fn.contains( ReturnInt(0) ) );
+    BOOST_TEST( !fn.contains( ReturnInt(12) ) );
+
+    fn = ReturnInt(12);
+
+    BOOST_TEST( fn() == 12 );
+
+    BOOST_TEST( !fn.contains( &forty_two ) );
+    BOOST_TEST( !fn.contains( Seventeen() ) );
+    BOOST_TEST( !fn.contains( ReturnInt(0) ) );
+    BOOST_TEST( fn.contains( ReturnInt(12) ) );
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/function/test/contains_test.cpp b/libs/function/test/contains_test.cpp
new file mode 100644
index 0000000..56ea716
--- /dev/null
+++ b/libs/function/test/contains_test.cpp
@@ -0,0 +1,235 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2004. Use, modification and
+//  distribution is subject to 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)
+
+#include <boost/test/minimal.hpp>
+#include <boost/function.hpp>
+#include <boost/ref.hpp>
+
+static int forty_two() { return 42; }
+
+struct Seventeen
+{
+  int operator()() const { return 17; }
+};
+
+struct ReturnInt
+{
+  explicit ReturnInt(int value) : value(value) {}
+
+  int operator()() const { return value; }
+
+  int value;
+};
+
+bool operator==(const ReturnInt& x, const ReturnInt& y)
+{ return x.value == y.value; }
+
+bool operator!=(const ReturnInt& x, const ReturnInt& y)
+{ return x.value != y.value; }
+
+namespace contain_test {
+
+struct ReturnIntFE
+{
+  explicit ReturnIntFE(int value) : value(value) {}
+
+  int operator()() const { return value; }
+
+  int value;
+};
+
+}
+
+#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
+namespace contain_test {
+# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+bool function_equal(const ReturnIntFE& x, const ReturnIntFE& y)
+{ return x.value == y.value; }
+# else
+bool function_equal_impl(const ReturnIntFE& x, const ReturnIntFE& y, int)
+{ return x.value == y.value; }
+# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+}
+#else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+namespace ndnboost {
+# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+bool 
+function_equal(const contain_test::ReturnIntFE& x, 
+               const contain_test::ReturnIntFE& y)
+{ return x.value == y.value; }
+# else
+bool 
+function_equal_impl(const contain_test::ReturnIntFE& x, 
+                    const contain_test::ReturnIntFE& y, int)
+{ return x.value == y.value; }
+# endif
+}
+#endif
+
+static void target_test()
+{
+  ndnboost::function0<int> f;
+
+  f = &forty_two;
+  BOOST_CHECK(*f.target<int (*)()>() == &forty_two);
+  BOOST_CHECK(!f.target<Seventeen>());
+
+  f = Seventeen();
+  BOOST_CHECK(!f.target<int (*)()>());
+  BOOST_CHECK(f.target<Seventeen>());
+
+  Seventeen this_seventeen;
+  f = ndnboost::ref(this_seventeen);
+  BOOST_CHECK(!f.target<int (*)()>());
+  BOOST_CHECK(f.target<Seventeen>());
+  BOOST_CHECK(f.target<Seventeen>() == &this_seventeen);
+
+  const Seventeen const_seventeen = this_seventeen;
+  f = ndnboost::ref(const_seventeen);
+  BOOST_CHECK(!f.target<int (*)()>());
+  BOOST_CHECK(f.target<const Seventeen>());
+  BOOST_CHECK(f.target<const Seventeen>() == &const_seventeen);
+  BOOST_CHECK(f.target<const volatile Seventeen>());
+  BOOST_CHECK(!f.target<Seventeen>());
+  BOOST_CHECK(!f.target<volatile Seventeen>());
+}
+
+static void equal_test()
+{
+  ndnboost::function0<int> f;
+
+  f = &forty_two;
+  BOOST_CHECK(f == &forty_two);
+  BOOST_CHECK(f != ReturnInt(17));
+#if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
+  BOOST_CHECK(&forty_two == f);
+  BOOST_CHECK(ReturnInt(17) != f);
+#endif
+
+  BOOST_CHECK(f.contains(&forty_two));
+
+  f = ReturnInt(17);
+  BOOST_CHECK(f != &forty_two);
+  BOOST_CHECK(f == ReturnInt(17));
+  BOOST_CHECK(f != ReturnInt(16));
+#if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
+  BOOST_CHECK(&forty_two != f);
+  BOOST_CHECK(ReturnInt(17) == f);
+  BOOST_CHECK(ReturnInt(16) != f);
+#endif
+
+  BOOST_CHECK(f.contains(ReturnInt(17)));
+
+  f = contain_test::ReturnIntFE(17);
+  BOOST_CHECK(f != &forty_two);
+  BOOST_CHECK(f == contain_test::ReturnIntFE(17));
+  BOOST_CHECK(f != contain_test::ReturnIntFE(16));
+#if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
+  BOOST_CHECK(&forty_two != f);
+  BOOST_CHECK(contain_test::ReturnIntFE(17) == f);
+  BOOST_CHECK(contain_test::ReturnIntFE(16) != f);
+#endif
+
+  BOOST_CHECK(f.contains(contain_test::ReturnIntFE(17)));
+
+#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX)
+  ndnboost::function<int(void)> g;
+
+  g = &forty_two;
+  BOOST_CHECK(g == &forty_two);
+  BOOST_CHECK(g != ReturnInt(17));
+#  if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
+  BOOST_CHECK(&forty_two == g);
+  BOOST_CHECK(ReturnInt(17) != g);
+#  endif
+
+  g = ReturnInt(17);
+  BOOST_CHECK(g != &forty_two);
+  BOOST_CHECK(g == ReturnInt(17));
+  BOOST_CHECK(g != ReturnInt(16));
+#  if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
+  BOOST_CHECK(&forty_two != g);
+  BOOST_CHECK(ReturnInt(17) == g);
+  BOOST_CHECK(ReturnInt(16) != g);
+#  endif
+#endif
+}
+
+static void ref_equal_test()
+{
+  {
+    ReturnInt ri(17);
+    ndnboost::function0<int> f = ndnboost::ref(ri);
+
+    // References and values are equal
+    BOOST_CHECK(f == ndnboost::ref(ri));
+    BOOST_CHECK(f == ri);
+    BOOST_CHECK(ndnboost::ref(ri) == f);
+    BOOST_CHECK(!(f != ndnboost::ref(ri)));
+    BOOST_CHECK(!(f != ri));
+    BOOST_CHECK(!(ndnboost::ref(ri) != f));
+#if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
+    BOOST_CHECK(ri == f);
+    BOOST_CHECK(!(ri != f));
+#endif
+
+    // Values equal, references inequal
+    ReturnInt ri2(17);
+    BOOST_CHECK(f == ri2);
+    BOOST_CHECK(f != ndnboost::ref(ri2));
+    BOOST_CHECK(ndnboost::ref(ri2) != f);
+    BOOST_CHECK(!(f != ri2));
+    BOOST_CHECK(!(f == ndnboost::ref(ri2)));
+    BOOST_CHECK(!(ndnboost::ref(ri2) == f));
+#if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
+    BOOST_CHECK(ri2 == f);
+    BOOST_CHECK(!(ri2 != f));
+#endif 
+  }
+
+#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX)
+  {
+    ReturnInt ri(17);
+    ndnboost::function<int(void)> f = ndnboost::ref(ri);
+
+    // References and values are equal
+    BOOST_CHECK(f == ndnboost::ref(ri));
+    BOOST_CHECK(f == ri);
+    BOOST_CHECK(ndnboost::ref(ri) == f);
+    BOOST_CHECK(!(f != ndnboost::ref(ri)));
+    BOOST_CHECK(!(f != ri));
+    BOOST_CHECK(!(ndnboost::ref(ri) != f));
+#  if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
+    BOOST_CHECK(ri == f);
+    BOOST_CHECK(!(ri != f));
+#  endif
+
+    // Values equal, references inequal
+    ReturnInt ri2(17);
+    BOOST_CHECK(f == ri2);
+    BOOST_CHECK(f != ndnboost::ref(ri2));
+    BOOST_CHECK(ndnboost::ref(ri2) != f);
+    BOOST_CHECK(!(f != ri2));
+    BOOST_CHECK(!(f == ndnboost::ref(ri2)));
+    BOOST_CHECK(!(ndnboost::ref(ri2) == f));
+#  if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
+    BOOST_CHECK(ri2 == f);
+    BOOST_CHECK(!(ri2 != f));
+#  endif
+  }
+#endif
+}
+
+int test_main(int, char*[])
+{
+  target_test();
+  equal_test();
+  ref_equal_test();
+
+  return 0;
+}
diff --git a/libs/function/test/function_30.cpp b/libs/function/test/function_30.cpp
new file mode 100644
index 0000000..768b425
--- /dev/null
+++ b/libs/function/test/function_30.cpp
@@ -0,0 +1,25 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2002-2003. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+// Make sure we don't try to redefine function2
+#include <boost/function/function2.hpp>
+
+// Define all Boost.Function class templates up to 30 arguments
+#define BOOST_FUNCTION_MAX_ARGS 30
+#include <boost/function.hpp>
+
+int main()
+{
+  ndnboost::function0<float> f0;
+
+  ndnboost::function30<float, int, int, int, int, int, int, int, int, int, int,
+                    int, int, int, int, int, int, int, int, int, int,
+                    int, int, int, int, int, int, int, int, int, int> f30;
+  return 0;
+}
diff --git a/libs/function/test/function_arith_cxx98.cpp b/libs/function/test/function_arith_cxx98.cpp
new file mode 100644
index 0000000..3ef1f09
--- /dev/null
+++ b/libs/function/test/function_arith_cxx98.cpp
@@ -0,0 +1,34 @@
+// Function library
+
+// Copyright (C) 2001-2003 Douglas Gregor
+
+// Use, modification and distribution is subject to 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) 
+
+// For more information, see http://www.boost.org/
+
+    
+#include <boost/function.hpp>
+#include <iostream>
+
+
+float mul_ints(int x, int y) { return ((float)x) * y; }
+struct int_div { 
+  float operator()(int x, int y) const { return ((float)x)/y; }; 
+};
+
+int main()
+{
+    ndnboost::function<float (int x, int y)> f;
+    f = int_div();
+    std::cout << f(5, 3) << std::endl;
+    if (f)
+  std::cout << f(5, 3) << std::endl;
+else
+  std::cout << "f has no target, so it is unsafe to call" << std::endl;
+    f = 0;
+    f = &mul_ints;
+  
+    return 0;
+}
diff --git a/libs/function/test/function_arith_portable.cpp b/libs/function/test/function_arith_portable.cpp
new file mode 100644
index 0000000..04ebca5
--- /dev/null
+++ b/libs/function/test/function_arith_portable.cpp
@@ -0,0 +1,32 @@
+// Function library
+
+// Copyright (C) 2001-2003 Douglas Gregor
+
+// Use, modification and distribution is subject to 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) 
+
+// For more information, see http://www.boost.org/
+
+    
+#include <boost/function.hpp>
+#include <iostream>
+
+float mul_ints(int x, int y) { return ((float)x) * y; }
+struct int_div { 
+  float operator()(int x, int y) const { return ((float)x)/y; }; 
+};
+int main()
+{
+    ndnboost::function2<float, int, int> f;
+    f = int_div();
+    std::cout << f(5, 3) << std::endl;
+    if (f)
+  std::cout << f(5, 3) << std::endl;
+else
+  std::cout << "f has no target, so it is unsafe to call" << std::endl;
+    f = 0;
+    f = &mul_ints;
+
+    return 0;
+}
diff --git a/libs/function/test/function_n_test.cpp b/libs/function/test/function_n_test.cpp
new file mode 100644
index 0000000..11b4bf9
--- /dev/null
+++ b/libs/function/test/function_n_test.cpp
@@ -0,0 +1,697 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2001-2003. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#include <boost/test/minimal.hpp>
+#include <boost/function.hpp>
+#include <functional>
+#include <cassert>
+#include <string>
+
+using namespace ndnboost;
+using std::string;
+using std::negate;
+
+int global_int;
+
+struct write_five_obj { void operator()() const { global_int = 5; } };
+struct write_three_obj { int operator()() const { global_int = 3; return 7; }};
+static void write_five() { global_int = 5; }
+static void write_three() { global_int = 3; }
+struct generate_five_obj { int operator()() const { return 5; } };
+struct generate_three_obj { int operator()() const { return 3; } };
+static int generate_five() { return 5; }
+static int generate_three() { return 3; }
+static string identity_str(const string& s) { return s; }
+static string string_cat(const string& s1, const string& s2) { return s1+s2; }
+static int sum_ints(int x, int y) { return x+y; }
+
+struct write_const_1_nonconst_2
+{
+  void operator()() { global_int = 2; }
+  void operator()() const { global_int = 1; }
+};
+
+struct add_to_obj
+{
+  add_to_obj(int v) : value(v) {}
+
+  int operator()(int x) const { return value + x; }
+
+  int value;
+};
+
+static void
+test_zero_args()
+{
+  typedef function0<void> func_void_type;
+
+  write_five_obj five = write_five_obj(); // Initialization for Borland C++ 5.5
+  write_three_obj three = write_three_obj(); // Ditto
+
+  // Default construction
+  func_void_type v1;
+  BOOST_CHECK(v1.empty());
+
+  // Assignment to an empty function
+  v1 = five;
+  BOOST_CHECK(!v1.empty());
+
+  // Invocation of a function
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 5);
+
+  // clear() method
+  v1.clear();
+  BOOST_CHECK(!v1);
+
+  // Assignment to an empty function
+  v1 = three;
+  BOOST_CHECK(!v1.empty());
+
+  // Invocation and self-assignment
+  global_int = 0;
+  v1 = v1;
+  v1();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a non-empty function
+  v1 = five;
+
+  // Invocation and self-assignment
+  global_int = 0;
+  v1 = (v1);
+  v1();
+  BOOST_CHECK(global_int == 5);
+
+  // clear
+  v1 = 0;
+  BOOST_CHECK(v1.empty());
+
+  // Assignment to an empty function from a free function
+  v1 = &write_five;
+  BOOST_CHECK(!v1.empty());
+
+  // Invocation
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v1 = &write_three;
+  BOOST_CHECK(!v1.empty());
+
+  // Invocation
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment
+  v1 = five;
+  BOOST_CHECK(!v1.empty());
+
+  // Invocation
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v1 = write_three;
+  BOOST_CHECK(!v1.empty());
+
+  // Invocation
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 3);
+
+  // Construction from another function (that is empty)
+  v1.clear();
+  func_void_type v2(v1);
+  BOOST_CHECK(!v2? true : false);
+
+  // Assignment to an empty function
+  v2 = three;
+  BOOST_CHECK(!v2.empty());
+
+  // Invocation
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a non-empty function
+  v2 = (five);
+
+  // Invocation
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 5);
+
+  v2.clear();
+  BOOST_CHECK(v2.empty());
+
+  // Assignment to an empty function from a free function
+  v2 = (&write_five);
+  BOOST_CHECK(v2? true : false);
+
+  // Invocation
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v2 = &write_three;
+  BOOST_CHECK(!v2.empty());
+
+  // Invocation
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 3);
+
+  // Swapping
+  v1 = five;
+  swap(v1, v2);
+  v2();
+  BOOST_CHECK(global_int == 5);
+  v1();
+  BOOST_CHECK(global_int == 3);
+  swap(v1, v2);
+  v1.clear();
+
+  // Assignment
+  v2 = five;
+  BOOST_CHECK(!v2.empty());
+
+  // Invocation
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v2 = &write_three;
+  BOOST_CHECK(!v2.empty());
+
+  // Invocation
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a function from an empty function
+  v2 = v1;
+  BOOST_CHECK(v2.empty());
+
+  // Assignment to a function from a function with a functor
+  v1 = three;
+  v2 = v1;
+  BOOST_CHECK(!v1.empty());
+  BOOST_CHECK(!v2.empty());
+
+  // Invocation
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 3);
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 3);
+
+  // Assign to a function from a function with a function
+  v2 = &write_five;
+  v1 = v2;
+  BOOST_CHECK(!v1.empty());
+  BOOST_CHECK(!v2.empty());
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 5);
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 5);
+
+  // Construct a function given another function containing a function
+  func_void_type v3(v1);
+
+  // Invocation of a function
+  global_int = 0;
+  v3();
+  BOOST_CHECK(global_int == 5);
+
+  // clear() method
+  v3.clear();
+  BOOST_CHECK(!v3? true : false);
+
+  // Assignment to an empty function
+  v3 = three;
+  BOOST_CHECK(!v3.empty());
+
+  // Invocation
+  global_int = 0;
+  v3();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a non-empty function
+  v3 = five;
+
+  // Invocation
+  global_int = 0;
+  v3();
+  BOOST_CHECK(global_int == 5);
+
+  // clear()
+  v3.clear();
+  BOOST_CHECK(v3.empty());
+
+  // Assignment to an empty function from a free function
+  v3 = &write_five;
+  BOOST_CHECK(!v3.empty());
+
+  // Invocation
+  global_int = 0;
+  v3();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v3 = &write_three;
+  BOOST_CHECK(!v3.empty());
+
+  // Invocation
+  global_int = 0;
+  v3();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment
+  v3 = five;
+  BOOST_CHECK(!v3.empty());
+
+  // Invocation
+  global_int = 0;
+  v3();
+  BOOST_CHECK(global_int == 5);
+
+  // Construction of a function from a function containing a functor
+  func_void_type v4(v3);
+
+  // Invocation of a function
+  global_int = 0;
+  v4();
+  BOOST_CHECK(global_int == 5);
+
+  // clear() method
+  v4.clear();
+  BOOST_CHECK(v4.empty());
+
+  // Assignment to an empty function
+  v4 = three;
+  BOOST_CHECK(!v4.empty());
+
+  // Invocation
+  global_int = 0;
+  v4();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a non-empty function
+  v4 = five;
+
+  // Invocation
+  global_int = 0;
+  v4();
+  BOOST_CHECK(global_int == 5);
+
+  // clear()
+  v4.clear();
+  BOOST_CHECK(v4.empty());
+
+  // Assignment to an empty function from a free function
+  v4 = &write_five;
+  BOOST_CHECK(!v4.empty());
+
+  // Invocation
+  global_int = 0;
+  v4();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v4 = &write_three;
+  BOOST_CHECK(!v4.empty());
+
+  // Invocation
+  global_int = 0;
+  v4();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment
+  v4 = five;
+  BOOST_CHECK(!v4.empty());
+
+  // Invocation
+  global_int = 0;
+  v4();
+  BOOST_CHECK(global_int == 5);
+
+  // Construction of a function from a functor
+  func_void_type v5(five);
+
+  // Invocation of a function
+  global_int = 0;
+  v5();
+  BOOST_CHECK(global_int == 5);
+
+  // clear() method
+  v5.clear();
+  BOOST_CHECK(v5.empty());
+
+  // Assignment to an empty function
+  v5 = three;
+  BOOST_CHECK(!v5.empty());
+
+  // Invocation
+  global_int = 0;
+  v5();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a non-empty function
+  v5 = five;
+
+  // Invocation
+  global_int = 0;
+  v5();
+  BOOST_CHECK(global_int == 5);
+
+  // clear()
+  v5.clear();
+  BOOST_CHECK(v5.empty());
+
+  // Assignment to an empty function from a free function
+  v5 = &write_five;
+  BOOST_CHECK(!v5.empty());
+
+  // Invocation
+  global_int = 0;
+  v5();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v5 = &write_three;
+  BOOST_CHECK(!v5.empty());
+
+  // Invocation
+  global_int = 0;
+  v5();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment
+  v5 = five;
+  BOOST_CHECK(!v5.empty());
+
+  // Invocation
+  global_int = 0;
+  v5();
+  BOOST_CHECK(global_int == 5);
+
+  // Construction of a function from a function
+  func_void_type v6(&write_five);
+
+  // Invocation of a function
+  global_int = 0;
+  v6();
+  BOOST_CHECK(global_int == 5);
+
+  // clear() method
+  v6.clear();
+  BOOST_CHECK(v6.empty());
+
+  // Assignment to an empty function
+  v6 = three;
+  BOOST_CHECK(!v6.empty());
+
+  // Invocation
+  global_int = 0;
+  v6();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a non-empty function
+  v6 = five;
+
+  // Invocation
+  global_int = 0;
+  v6();
+  BOOST_CHECK(global_int == 5);
+
+  // clear()
+  v6.clear();
+  BOOST_CHECK(v6.empty());
+
+  // Assignment to an empty function from a free function
+  v6 = &write_five;
+  BOOST_CHECK(!v6.empty());
+
+  // Invocation
+  global_int = 0;
+  v6();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v6 = &write_three;
+  BOOST_CHECK(!v6.empty());
+
+  // Invocation
+  global_int = 0;
+  v6();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment
+  v6 = five;
+  BOOST_CHECK(!v6.empty());
+
+  // Invocation
+  global_int = 0;
+  v6();
+  BOOST_CHECK(global_int == 5);
+
+  // Const vs. non-const
+  // Initialization for Borland C++ 5.5
+  write_const_1_nonconst_2 one_or_two = write_const_1_nonconst_2(); 
+  const function0<void> v7(one_or_two);
+  function0<void> v8(one_or_two);
+
+  global_int = 0;
+  v7();
+  BOOST_CHECK(global_int == 2);
+
+  global_int = 0;
+  v8();
+  BOOST_CHECK(global_int == 2);
+
+  // Test construction from 0 and comparison to 0
+  func_void_type v9(0);
+  BOOST_CHECK(v9 == 0);
+# if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540 || defined(BOOST_STRICT_CONFIG)
+  BOOST_CHECK(0 == v9);
+#else
+  BOOST_CHECK(v9.empty());
+#endif
+
+  // Test return values
+  typedef function0<int> func_int_type;
+  // Initialization for Borland C++ 5.5
+  generate_five_obj gen_five = generate_five_obj();
+  generate_three_obj gen_three = generate_three_obj();
+  func_int_type i0(gen_five);
+
+  BOOST_CHECK(i0() == 5);
+  i0 = gen_three;
+  BOOST_CHECK(i0() == 3);
+  i0 = &generate_five;
+  BOOST_CHECK(i0() == 5);
+  i0 = &generate_three;
+  BOOST_CHECK(i0() == 3);
+  BOOST_CHECK(i0? true : false);
+  i0.clear();
+  BOOST_CHECK(!i0? true : false);
+
+  // Test return values with compatible types
+  typedef function0<long> func_long_type;
+  func_long_type i1(gen_five);
+
+  BOOST_CHECK(i1() == 5);
+  i1 = gen_three;
+  BOOST_CHECK(i1() == 3);
+  i1 = &generate_five;
+  BOOST_CHECK(i1() == 5);
+  i1 = &generate_three;
+  BOOST_CHECK(i1() == 3);
+  BOOST_CHECK(i1? true : false);
+  i1.clear();
+  BOOST_CHECK(!i1? true : false);
+}
+
+static void
+test_one_arg()
+{
+  negate<int> neg = negate<int>(); // Initialization for Borland C++ 5.5
+
+  function1<int, int> f1(neg);
+  BOOST_CHECK(f1(5) == -5);
+
+  function1<string, string> id(&identity_str);
+  BOOST_CHECK(id("str") == "str");
+
+  function1<std::string, const char*> id2(&identity_str);
+  BOOST_CHECK(id2("foo") == "foo");
+
+  add_to_obj add_to(5);
+  function1<int, int> f2(add_to);
+  BOOST_CHECK(f2(3) == 8);
+
+  const function1<int, int> cf2(add_to);
+  BOOST_CHECK(cf2(3) == 8);
+}
+
+static void
+test_two_args()
+{
+  function2<string, const string&, const string&> cat(&string_cat);
+  BOOST_CHECK(cat("str", "ing") == "string");
+
+  function2<int, short, short> sum(&sum_ints);
+  BOOST_CHECK(sum(2, 3) == 5);
+}
+
+static void
+test_emptiness()
+{
+  function0<float> f1;
+  BOOST_CHECK(f1.empty());
+
+  function0<float> f2;
+  f2 = f1;
+  BOOST_CHECK(f2.empty());
+
+  function0<double> f3;
+  f3 = f2;
+  BOOST_CHECK(f3.empty());
+}
+
+struct X {
+  X(int v) : value(v) {}
+
+  int twice() const { return 2*value; }
+  int plus(int v) { return value + v; }
+
+  int value;
+};
+
+static void
+test_member_functions()
+{
+
+  ndnboost::function1<int, X*> f1(&X::twice);
+
+  X one(1);
+  X five(5);
+
+  BOOST_CHECK(f1(&one) == 2);
+  BOOST_CHECK(f1(&five) == 10);
+
+  ndnboost::function1<int, X*> f1_2;
+  f1_2 = &X::twice;
+
+  BOOST_CHECK(f1_2(&one) == 2);
+  BOOST_CHECK(f1_2(&five) == 10);
+
+  ndnboost::function2<int, X&, int> f2(&X::plus);
+  BOOST_CHECK(f2(one, 3) == 4);
+  BOOST_CHECK(f2(five, 4) == 9);
+}
+
+struct add_with_throw_on_copy {
+  int operator()(int x, int y) const { return x+y; }
+
+  add_with_throw_on_copy() {}
+
+  add_with_throw_on_copy(const add_with_throw_on_copy&)
+  {
+    throw std::runtime_error("But this CAN'T throw");
+  }
+
+  add_with_throw_on_copy& operator=(const add_with_throw_on_copy&)
+  {
+    throw std::runtime_error("But this CAN'T throw");
+  }
+};
+
+static void
+test_ref()
+{
+  add_with_throw_on_copy atc;
+  try {
+    ndnboost::function2<int, int, int> f(ref(atc));
+    BOOST_CHECK(f(1, 3) == 4);
+  }
+  catch(std::runtime_error e) {
+    BOOST_ERROR("Nonthrowing constructor threw an exception");
+  }
+}
+
+static unsigned construction_count = 0;
+static unsigned destruction_count = 0;
+
+struct MySmallFunctor {
+  MySmallFunctor() { ++construction_count; }
+  MySmallFunctor(const MySmallFunctor &) { ++construction_count; }
+  ~MySmallFunctor() { ++destruction_count; }
+  int operator()() { return 0; }
+ };
+
+struct MyLargeFunctor {
+  MyLargeFunctor() { ++construction_count; }
+  MyLargeFunctor(const MyLargeFunctor &) { ++construction_count; }
+  ~MyLargeFunctor() { ++destruction_count; }
+  int operator()() { return 0; }
+
+  float data[128];
+ };
+
+void test_construct_destroy_count()
+{
+  {
+    ndnboost::function0<int> f;
+    ndnboost::function0<int> g;
+    f = MySmallFunctor();
+    g = MySmallFunctor();
+    f.swap(g);
+  }
+
+  // MySmallFunctor objects should be constructed as many times as
+  // they are destroyed.
+  BOOST_CHECK(construction_count == destruction_count);
+ 
+  construction_count = 0;
+  destruction_count = 0;
+  {
+    ndnboost::function0<int> f;
+    ndnboost::function0<int> g;
+    f = MyLargeFunctor();
+    g = MyLargeFunctor();
+    f.swap(g);
+   }
+
+   // MyLargeFunctor objects should be constructed as many times as
+   // they are destroyed.
+   BOOST_CHECK(construction_count == destruction_count);
+}
+
+int test_main(int, char* [])
+{
+  test_zero_args();
+  test_one_arg();
+  test_two_args();
+  test_emptiness();
+  test_member_functions();
+  test_ref();
+  test_construct_destroy_count();
+  return 0;
+}
diff --git a/libs/function/test/function_ref_cxx98.cpp b/libs/function/test/function_ref_cxx98.cpp
new file mode 100644
index 0000000..2d79c9d
--- /dev/null
+++ b/libs/function/test/function_ref_cxx98.cpp
@@ -0,0 +1,27 @@
+// Function library
+
+// Copyright (C) 2001-2003 Douglas Gregor
+
+// Use, modification and distribution is subject to 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) 
+
+// For more information, see http://www.boost.org/
+
+
+#include <boost/function.hpp>
+#include <iostream>
+
+
+struct stateful_type { int operator()(int) const { return 0; } };
+
+int main()
+{
+    stateful_type a_function_object;
+  ndnboost::function<int (int)> f;
+  f = ndnboost::ref(a_function_object);
+
+  ndnboost::function<int (int)> f2(f);
+
+    return 0;
+}
diff --git a/libs/function/test/function_ref_portable.cpp b/libs/function/test/function_ref_portable.cpp
new file mode 100644
index 0000000..5ac84a2
--- /dev/null
+++ b/libs/function/test/function_ref_portable.cpp
@@ -0,0 +1,27 @@
+// Function library
+
+// Copyright (C) 2001-2003 Douglas Gregor
+
+// Use, modification and distribution is subject to 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) 
+
+// For more information, see http://www.boost.org/
+
+
+#include <boost/function.hpp>
+#include <iostream>
+
+
+struct stateful_type { int operator()(int) const { return 0; } };
+
+int main()
+{
+    stateful_type a_function_object;
+  ndnboost::function1<int, int> f;
+  f = ndnboost::ref(a_function_object);
+
+  ndnboost::function1<int, int> f2(f);
+
+    return 0;
+}
diff --git a/libs/function/test/function_test.cpp b/libs/function/test/function_test.cpp
new file mode 100644
index 0000000..b1c7cb8
--- /dev/null
+++ b/libs/function/test/function_test.cpp
@@ -0,0 +1,798 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2001-2003. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#include <boost/test/minimal.hpp>
+#include <boost/function.hpp>
+#include <functional>
+#include <string>
+#include <utility>
+
+using ndnboost::function;
+using std::string;
+
+int global_int;
+
+struct write_five_obj { void operator()() const { global_int = 5; } };
+struct write_three_obj { int operator()() const { global_int = 3; return 7; }};
+static void write_five() { global_int = 5; }
+static void write_three() { global_int = 3; }
+struct generate_five_obj { int operator()() const { return 5; } };
+struct generate_three_obj { int operator()() const { return 3; } };
+static int generate_five() { return 5; }
+static int generate_three() { return 3; }
+static string identity_str(const string& s) { return s; }
+static string string_cat(const string& s1, const string& s2) { return s1+s2; }
+static int sum_ints(int x, int y) { return x+y; }
+
+struct write_const_1_nonconst_2
+{
+  void operator()() { global_int = 2; }
+  void operator()() const { global_int = 1; }
+};
+
+struct add_to_obj
+{
+  add_to_obj(int v) : value(v) {}
+
+  int operator()(int x) const { return value + x; }
+
+  int value;
+};
+
+static void
+test_zero_args()
+{
+  typedef function<void ()> func_void_type;
+
+  write_five_obj five;
+  write_three_obj three;
+
+  // Default construction
+  func_void_type v1;
+  BOOST_CHECK(v1.empty());
+
+  // Assignment to an empty function
+  v1 = five;
+  BOOST_CHECK(v1 != 0);
+
+  // Invocation of a function
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 5);
+
+  // clear() method
+  v1.clear();
+  BOOST_CHECK(v1 == 0);
+
+  // Assignment to an empty function
+  v1 = three;
+  BOOST_CHECK(!v1.empty());
+
+  // Invocation and self-assignment
+  global_int = 0;
+  v1 = v1;
+  v1();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a non-empty function
+  v1 = five;
+
+  // Invocation and self-assignment
+  global_int = 0;
+  v1 = (v1);
+  v1();
+  BOOST_CHECK(global_int == 5);
+
+  // clear
+  v1 = 0;
+  BOOST_CHECK(0 == v1);
+
+  // Assignment to an empty function from a free function
+  v1 = BOOST_FUNCTION_TARGET_FIX(&) write_five;
+  BOOST_CHECK(0 != v1);
+
+  // Invocation
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v1 = BOOST_FUNCTION_TARGET_FIX(&) write_three;
+  BOOST_CHECK(!v1.empty());
+
+  // Invocation
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment
+  v1 = five;
+  BOOST_CHECK(!v1.empty());
+
+  // Invocation
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v1 = &write_three;
+  BOOST_CHECK(!v1.empty());
+
+  // Invocation
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 3);
+
+  // Construction from another function (that is empty)
+  v1.clear();
+  func_void_type v2(v1);
+  BOOST_CHECK(!v2? true : false);
+
+  // Assignment to an empty function
+  v2 = three;
+  BOOST_CHECK(!v2.empty());
+
+  // Invocation
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a non-empty function
+  v2 = (five);
+
+  // Invocation
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 5);
+
+  v2.clear();
+  BOOST_CHECK(v2.empty());
+
+  // Assignment to an empty function from a free function
+  v2 = (BOOST_FUNCTION_TARGET_FIX(&) write_five);
+  BOOST_CHECK(v2? true : false);
+
+  // Invocation
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v2 = BOOST_FUNCTION_TARGET_FIX(&) write_three;
+  BOOST_CHECK(!v2.empty());
+
+  // Invocation
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 3);
+
+  // Swapping
+  v1 = five;
+  swap(v1, v2);
+  v2();
+  BOOST_CHECK(global_int == 5);
+  v1();
+  BOOST_CHECK(global_int == 3);
+  swap(v1, v2);
+  v1.clear();
+
+  // Assignment
+  v2 = five;
+  BOOST_CHECK(!v2.empty());
+
+  // Invocation
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v2 = &write_three;
+  BOOST_CHECK(!v2.empty());
+
+  // Invocation
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a function from an empty function
+  v2 = v1;
+  BOOST_CHECK(v2.empty());
+
+  // Assignment to a function from a function with a functor
+  v1 = three;
+  v2 = v1;
+  BOOST_CHECK(!v1.empty());
+  BOOST_CHECK(!v2.empty());
+
+  // Invocation
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 3);
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 3);
+
+  // Assign to a function from a function with a function
+  v2 = BOOST_FUNCTION_TARGET_FIX(&) write_five;
+  v1 = v2;
+  BOOST_CHECK(!v1.empty());
+  BOOST_CHECK(!v2.empty());
+  global_int = 0;
+  v1();
+  BOOST_CHECK(global_int == 5);
+  global_int = 0;
+  v2();
+  BOOST_CHECK(global_int == 5);
+
+  // Construct a function given another function containing a function
+  func_void_type v3(v1);
+
+  // Invocation of a function
+  global_int = 0;
+  v3();
+  BOOST_CHECK(global_int == 5);
+
+  // clear() method
+  v3.clear();
+  BOOST_CHECK(!v3? true : false);
+
+  // Assignment to an empty function
+  v3 = three;
+  BOOST_CHECK(!v3.empty());
+
+  // Invocation
+  global_int = 0;
+  v3();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a non-empty function
+  v3 = five;
+
+  // Invocation
+  global_int = 0;
+  v3();
+  BOOST_CHECK(global_int == 5);
+
+  // clear()
+  v3.clear();
+  BOOST_CHECK(v3.empty());
+
+  // Assignment to an empty function from a free function
+  v3 = &write_five;
+  BOOST_CHECK(!v3.empty());
+
+  // Invocation
+  global_int = 0;
+  v3();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v3 = &write_three;
+  BOOST_CHECK(!v3.empty());
+
+  // Invocation
+  global_int = 0;
+  v3();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment
+  v3 = five;
+  BOOST_CHECK(!v3.empty());
+
+  // Invocation
+  global_int = 0;
+  v3();
+  BOOST_CHECK(global_int == 5);
+
+  // Construction of a function from a function containing a functor
+  func_void_type v4(v3);
+
+  // Invocation of a function
+  global_int = 0;
+  v4();
+  BOOST_CHECK(global_int == 5);
+
+  // clear() method
+  v4.clear();
+  BOOST_CHECK(v4.empty());
+
+  // Assignment to an empty function
+  v4 = three;
+  BOOST_CHECK(!v4.empty());
+
+  // Invocation
+  global_int = 0;
+  v4();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a non-empty function
+  v4 = five;
+
+  // Invocation
+  global_int = 0;
+  v4();
+  BOOST_CHECK(global_int == 5);
+
+  // clear()
+  v4.clear();
+  BOOST_CHECK(v4.empty());
+
+  // Assignment to an empty function from a free function
+  v4 = &write_five;
+  BOOST_CHECK(!v4.empty());
+
+  // Invocation
+  global_int = 0;
+  v4();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v4 = &write_three;
+  BOOST_CHECK(!v4.empty());
+
+  // Invocation
+  global_int = 0;
+  v4();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment
+  v4 = five;
+  BOOST_CHECK(!v4.empty());
+
+  // Invocation
+  global_int = 0;
+  v4();
+  BOOST_CHECK(global_int == 5);
+
+  // Construction of a function from a functor
+  func_void_type v5(five);
+
+  // Invocation of a function
+  global_int = 0;
+  v5();
+  BOOST_CHECK(global_int == 5);
+
+  // clear() method
+  v5.clear();
+  BOOST_CHECK(v5.empty());
+
+  // Assignment to an empty function
+  v5 = three;
+  BOOST_CHECK(!v5.empty());
+
+  // Invocation
+  global_int = 0;
+  v5();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a non-empty function
+  v5 = five;
+
+  // Invocation
+  global_int = 0;
+  v5();
+  BOOST_CHECK(global_int == 5);
+
+  // clear()
+  v5.clear();
+  BOOST_CHECK(v5.empty());
+
+  // Assignment to an empty function from a free function
+  v5 = &write_five;
+  BOOST_CHECK(!v5.empty());
+
+  // Invocation
+  global_int = 0;
+  v5();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v5 = &write_three;
+  BOOST_CHECK(!v5.empty());
+
+  // Invocation
+  global_int = 0;
+  v5();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment
+  v5 = five;
+  BOOST_CHECK(!v5.empty());
+
+  // Invocation
+  global_int = 0;
+  v5();
+  BOOST_CHECK(global_int == 5);
+
+  // Construction of a function from a function
+  func_void_type v6(&write_five);
+
+  // Invocation of a function
+  global_int = 0;
+  v6();
+  BOOST_CHECK(global_int == 5);
+
+  // clear() method
+  v6.clear();
+  BOOST_CHECK(v6.empty());
+
+  // Assignment to an empty function
+  v6 = three;
+  BOOST_CHECK(!v6.empty());
+
+  // Invocation
+  global_int = 0;
+  v6();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment to a non-empty function
+  v6 = five;
+
+  // Invocation
+  global_int = 0;
+  v6();
+  BOOST_CHECK(global_int == 5);
+
+  // clear()
+  v6.clear();
+  BOOST_CHECK(v6.empty());
+
+  // Assignment to an empty function from a free function
+  v6 = &write_five;
+  BOOST_CHECK(!v6.empty());
+
+  // Invocation
+  global_int = 0;
+  v6();
+  BOOST_CHECK(global_int == 5);
+
+  // Assignment to a non-empty function from a free function
+  v6 = &write_three;
+  BOOST_CHECK(!v6.empty());
+
+  // Invocation
+  global_int = 0;
+  v6();
+  BOOST_CHECK(global_int == 3);
+
+  // Assignment
+  v6 = five;
+  BOOST_CHECK(!v6.empty());
+
+  // Invocation
+  global_int = 0;
+  v6();
+  BOOST_CHECK(global_int == 5);
+
+  // Const vs. non-const
+  write_const_1_nonconst_2 one_or_two;
+  const function<void ()> v7(one_or_two);
+  function<void ()> v8(one_or_two);
+
+  global_int = 0;
+  v7();
+  BOOST_CHECK(global_int == 2);
+
+  global_int = 0;
+  v8();
+  BOOST_CHECK(global_int == 2);
+
+  // Test construction from 0 and comparison to 0
+  func_void_type v9(0);
+  BOOST_CHECK(v9 == 0);
+  BOOST_CHECK(0 == v9);
+
+  // Test return values
+  typedef function<int ()> func_int_type;
+  generate_five_obj gen_five;
+  generate_three_obj gen_three;
+
+  func_int_type i0(gen_five);
+
+  BOOST_CHECK(i0() == 5);
+  i0 = gen_three;
+  BOOST_CHECK(i0() == 3);
+  i0 = &generate_five;
+  BOOST_CHECK(i0() == 5);
+  i0 = &generate_three;
+  BOOST_CHECK(i0() == 3);
+  BOOST_CHECK(i0? true : false);
+  i0.clear();
+  BOOST_CHECK(!i0? true : false);
+
+  // Test return values with compatible types
+  typedef function<long ()> func_long_type;
+  func_long_type i1(gen_five);
+
+  BOOST_CHECK(i1() == 5);
+  i1 = gen_three;
+  BOOST_CHECK(i1() == 3);
+  i1 = &generate_five;
+  BOOST_CHECK(i1() == 5);
+  i1 = &generate_three;
+  BOOST_CHECK(i1() == 3);
+  BOOST_CHECK(i1? true : false);
+  i1.clear();
+  BOOST_CHECK(!i1? true : false);
+}
+
+static void
+test_one_arg()
+{
+  std::negate<int> neg;
+
+  function<int (int)> f1(neg);
+  BOOST_CHECK(f1(5) == -5);
+
+  function<string (string)> id(&identity_str);
+  BOOST_CHECK(id("str") == "str");
+
+  function<string (const char*)> id2(&identity_str);
+  BOOST_CHECK(id2("foo") == "foo");
+
+  add_to_obj add_to(5);
+  function<int (int)> f2(add_to);
+  BOOST_CHECK(f2(3) == 8);
+
+  const function<int (int)> cf2(add_to);
+  BOOST_CHECK(cf2(3) == 8);
+}
+
+static void
+test_two_args()
+{
+  function<string (const string&, const string&)> cat(&string_cat);
+  BOOST_CHECK(cat("str", "ing") == "string");
+
+  function<int (short, short)> sum(&sum_ints);
+  BOOST_CHECK(sum(2, 3) == 5);
+}
+
+static void
+test_emptiness()
+{
+  function<float ()> f1;
+  BOOST_CHECK(f1.empty());
+
+  function<float ()> f2;
+  f2 = f1;
+  BOOST_CHECK(f2.empty());
+
+  function<double ()> f3;
+  f3 = f2;
+  BOOST_CHECK(f3.empty());
+}
+
+struct X {
+  X(int v) : value(v) {}
+
+  int twice() const { return 2*value; }
+  int plus(int v) { return value + v; }
+
+  int value;
+};
+
+static void
+test_member_functions()
+{
+  ndnboost::function<int (X*)> f1(&X::twice);
+
+  X one(1);
+  X five(5);
+
+  BOOST_CHECK(f1(&one) == 2);
+  BOOST_CHECK(f1(&five) == 10);
+
+  ndnboost::function<int (X*)> f1_2;
+  f1_2 = &X::twice;
+
+  BOOST_CHECK(f1_2(&one) == 2);
+  BOOST_CHECK(f1_2(&five) == 10);
+
+  ndnboost::function<int (X&, int)> f2(&X::plus);
+  BOOST_CHECK(f2(one, 3) == 4);
+  BOOST_CHECK(f2(five, 4) == 9);
+}
+
+struct add_with_throw_on_copy {
+  int operator()(int x, int y) const { return x+y; }
+
+  add_with_throw_on_copy() {}
+
+  add_with_throw_on_copy(const add_with_throw_on_copy&)
+  {
+    throw std::runtime_error("But this CAN'T throw");
+  }
+
+  add_with_throw_on_copy& operator=(const add_with_throw_on_copy&)
+  {
+    throw std::runtime_error("But this CAN'T throw");
+  }
+};
+
+static void
+test_ref()
+{
+  add_with_throw_on_copy atc;
+  try {
+    ndnboost::function<int (int, int)> f(ndnboost::ref(atc));
+    BOOST_CHECK(f(1, 3) == 4);
+  }
+  catch(std::runtime_error e) {
+    BOOST_ERROR("Nonthrowing constructor threw an exception");
+  }
+}
+
+static void dummy() {}
+
+static void test_empty_ref()
+{
+  ndnboost::function<void()> f1;
+  ndnboost::function<void()> f2(ndnboost::ref(f1));
+
+  try {
+    f2();
+    BOOST_ERROR("Exception didn't throw for reference to empty function.");
+  }
+  catch(std::runtime_error e) {}
+
+  f1 = dummy;
+
+  try {
+    f2();
+  }
+  catch(std::runtime_error e) {
+    BOOST_ERROR("Error calling referenced function.");
+  }
+}
+
+
+static void test_exception()
+{
+  ndnboost::function<int (int, int)> f;
+  try {
+    f(5, 4);
+    BOOST_CHECK(false);
+  }
+  catch(ndnboost::bad_function_call) {
+    // okay
+  }
+}
+
+typedef ndnboost::function< void * (void * reader) > reader_type;
+typedef std::pair<int, reader_type> mapped_type;
+
+static void test_implicit()
+{
+  mapped_type m;
+  m = mapped_type();
+}
+
+static void test_call_obj(ndnboost::function<int (int, int)> f)
+{
+  BOOST_CHECK(!f.empty());
+}
+
+static void test_call_cref(const ndnboost::function<int (int, int)>& f)
+{
+  BOOST_CHECK(!f.empty());
+}
+
+static void test_call()
+{
+  test_call_obj(std::plus<int>());
+  test_call_cref(std::plus<int>());
+}
+
+struct big_aggregating_structure {
+  int disable_small_objects_optimizations[32];
+    
+  big_aggregating_structure()
+  {
+    ++ global_int;
+  }
+    
+  big_aggregating_structure(const big_aggregating_structure&)
+  {
+    ++ global_int;
+  }
+
+  ~big_aggregating_structure()
+  {
+    -- global_int;
+  }
+    
+  void operator()() 
+  {
+    ++ global_int;
+  }
+
+  void operator()(int) 
+  {
+    ++ global_int;
+  }
+};
+
+template <class FunctionT>
+static void test_move_semantics() 
+{
+  typedef FunctionT f1_type;
+
+  big_aggregating_structure obj;
+  
+  f1_type f1 = obj;
+  global_int = 0;
+  f1();
+  
+  BOOST_CHECK(!f1.empty());
+  BOOST_CHECK(global_int == 1);
+  
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+  // Testing rvalue constructors
+  f1_type f2(static_cast<f1_type&&>(f1));
+  BOOST_CHECK(f1.empty());
+  BOOST_CHECK(!f2.empty());
+  BOOST_CHECK(global_int == 1);
+  f2();
+  BOOST_CHECK(global_int == 2);
+  
+  f1_type f3(static_cast<f1_type&&>(f2));
+  BOOST_CHECK(f1.empty());
+  BOOST_CHECK(f2.empty());
+  BOOST_CHECK(!f3.empty());
+  BOOST_CHECK(global_int == 2);
+  f3();
+  BOOST_CHECK(global_int == 3);
+    
+  // Testing move assignment
+  f1_type f4;
+  BOOST_CHECK(f4.empty());
+  f4 = static_cast<f1_type&&>(f3);
+  BOOST_CHECK(f1.empty());
+  BOOST_CHECK(f2.empty());
+  BOOST_CHECK(f3.empty());
+  BOOST_CHECK(!f4.empty());
+  BOOST_CHECK(global_int == 3);
+  f4();
+  BOOST_CHECK(global_int == 4);
+  
+  // Testing self move assignment
+  f4 = static_cast<f1_type&&>(f4);
+  BOOST_CHECK(!f4.empty());
+  BOOST_CHECK(global_int == 4);
+
+  // Testing, that no memory leaked when assigning to nonempty function
+  f4 = obj;
+  BOOST_CHECK(!f4.empty());
+  BOOST_CHECK(global_int == 4);
+  f1_type f5 = obj;
+  BOOST_CHECK(global_int == 5);
+  f4 = static_cast<f1_type&&>(f5);
+  BOOST_CHECK(global_int == 4);
+  
+#endif  
+}
+
+int test_main(int, char* [])
+{
+  test_zero_args();
+  test_one_arg();
+  test_two_args();
+  test_emptiness();
+  test_member_functions();
+  test_ref();
+  test_empty_ref();
+  test_exception();
+  test_implicit();
+  test_call();
+  test_move_semantics<function<void()> >();
+  test_move_semantics<ndnboost::function0<void> >();
+
+  return 0;
+}
diff --git a/libs/function/test/function_test_fail1.cpp b/libs/function/test/function_test_fail1.cpp
new file mode 100644
index 0000000..d9fc804
--- /dev/null
+++ b/libs/function/test/function_test_fail1.cpp
@@ -0,0 +1,28 @@
+// Boost.Function library
+
+//  Copyright (C) Douglas Gregor 2001-2005. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#include <boost/test/minimal.hpp>
+#include <boost/function.hpp>
+
+using namespace std;
+using namespace ndnboost;
+
+int
+test_main(int, char*[])
+{
+  function0<int> f1;
+  function0<int> f2;
+
+  if (f1 == f2) {
+  }
+
+  BOOST_ERROR("This should not have compiled.");
+
+  return 0;
+}
diff --git a/libs/function/test/function_test_fail2.cpp b/libs/function/test/function_test_fail2.cpp
new file mode 100644
index 0000000..634c04a
--- /dev/null
+++ b/libs/function/test/function_test_fail2.cpp
@@ -0,0 +1,27 @@
+// Boost.Function library
+
+//  Copyright (C) Douglas Gregor 2001-2005. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#include <boost/test/minimal.hpp>
+#include <boost/function.hpp>
+
+using namespace std;
+using namespace ndnboost;
+
+static int bad_fn(float f) { return static_cast<int>(f); }
+
+int
+test_main(int, char*[])
+{
+  function0<int> f1;
+  f1 = bad_fn;
+
+  BOOST_ERROR("This should not have compiled.");
+
+  return 0;
+}
diff --git a/libs/function/test/function_typeof_test.cpp b/libs/function/test/function_typeof_test.cpp
new file mode 100644
index 0000000..6bd0d9d
--- /dev/null
+++ b/libs/function/test/function_typeof_test.cpp
@@ -0,0 +1,18 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2008. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+#include <boost/function/function_typeof.hpp>
+#include <boost/function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/static_assert.hpp>
+
+void f(ndnboost::function0<void> f, ndnboost::function0<void> g)
+{
+  BOOST_STATIC_ASSERT((ndnboost::is_same<ndnboost::function0<void>, BOOST_TYPEOF(f = g)>::value));
+}
diff --git a/libs/function/test/lambda_test.cpp b/libs/function/test/lambda_test.cpp
new file mode 100644
index 0000000..86281fa
--- /dev/null
+++ b/libs/function/test/lambda_test.cpp
@@ -0,0 +1,38 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2002-2003. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#include <iostream>
+#include <cstdlib>
+
+#include <boost/test/minimal.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+#include <boost/function.hpp>
+
+static unsigned
+func_impl(int arg1, bool arg2, double arg3)
+{
+  using namespace std;
+  return abs (static_cast<int>((arg2 ? arg1 : 2 * arg1) * arg3));
+}
+
+int test_main(int, char*[])
+{
+  using ndnboost::function;
+  using namespace ndnboost::lambda;
+
+  function <unsigned(bool, double)> f1 = bind(func_impl, 15, _1, _2);
+  function <unsigned(double)>       f2 = ndnboost::lambda::bind(f1, false, _1);
+  function <unsigned()>             f3 = ndnboost::lambda::bind(f2, 4.0);
+
+  f3();
+
+  return 0;
+}
+
diff --git a/libs/function/test/mem_fun_cxx98.cpp b/libs/function/test/mem_fun_cxx98.cpp
new file mode 100644
index 0000000..c55baa4
--- /dev/null
+++ b/libs/function/test/mem_fun_cxx98.cpp
@@ -0,0 +1,37 @@
+// Function library
+
+// Copyright (C) 2001-2003 Douglas Gregor
+
+// Use, modification and distribution is subject to 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) 
+
+// For more information, see http://www.boost.org/
+
+    
+#include <boost/function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <iostream>
+#include <functional>
+
+struct X {
+  int foo(int);
+  std::ostream& foo2(std::ostream&) const;
+};
+int X::foo(int x) { return -x; }
+std::ostream& X::foo2(std::ostream& x) const { return x; }
+
+int main()
+{
+    ndnboost::function<int (X*, int)> f;
+    ndnboost::function<std::ostream& (X*, std::ostream&)> f2;
+
+    f = &X::foo;
+    f2 = &X::foo2;
+
+    X x;
+    BOOST_TEST(f(&x, 5) == -5);
+    BOOST_TEST(f2(&x, ndnboost::ref(std::cout)) == std::cout);
+
+    return ::ndnboost::report_errors();
+}
diff --git a/libs/function/test/mem_fun_portable.cpp b/libs/function/test/mem_fun_portable.cpp
new file mode 100644
index 0000000..af8f75f
--- /dev/null
+++ b/libs/function/test/mem_fun_portable.cpp
@@ -0,0 +1,37 @@
+// Function library
+
+// Copyright (C) 2001-2003 Douglas Gregor
+
+// Use, modification and distribution is subject to 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) 
+
+// For more information, see http://www.boost.org/
+
+    
+#include <boost/function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <iostream>
+#include <functional>
+
+struct X {
+  int foo(int);
+  std::ostream& foo2(std::ostream&) const;
+};
+int X::foo(int x) { return -x; }
+std::ostream& X::foo2(std::ostream& x) const { return x; }
+
+int main()
+{
+    ndnboost::function2<int, X*, int> f;
+    ndnboost::function2<std::ostream&, X*, std::ostream&> f2;
+
+    f = &X::foo;
+    f2 = &X::foo2;
+
+    X x;
+    BOOST_TEST(f(&x, 5) == -5);
+    BOOST_TEST(f2(&x, ndnboost::ref(std::cout)) == std::cout);
+
+    return ::ndnboost::report_errors();
+}
diff --git a/libs/function/test/nothrow_swap.cpp b/libs/function/test/nothrow_swap.cpp
new file mode 100644
index 0000000..568d05d
--- /dev/null
+++ b/libs/function/test/nothrow_swap.cpp
@@ -0,0 +1,60 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2008. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#include <boost/test/minimal.hpp>
+#include <boost/function.hpp>
+
+struct tried_to_copy { };
+
+struct MaybeThrowOnCopy {
+  MaybeThrowOnCopy(int value = 0) : value(value) { }
+
+  MaybeThrowOnCopy(const MaybeThrowOnCopy& other) : value(other.value) {
+    if (throwOnCopy)
+      throw tried_to_copy();
+  }
+
+  MaybeThrowOnCopy& operator=(const MaybeThrowOnCopy& other) {
+    if (throwOnCopy)
+      throw tried_to_copy();
+    value = other.value;
+    return *this;
+  }
+
+  int operator()() { return value; }
+
+  int value;
+
+  // Make sure that this function object doesn't trigger the
+  // small-object optimization in Function.
+  float padding[100];
+
+  static bool throwOnCopy;
+};
+
+bool MaybeThrowOnCopy::throwOnCopy = false;
+
+int test_main(int, char* [])
+{
+  ndnboost::function0<int> f;
+  ndnboost::function0<int> g;
+
+  MaybeThrowOnCopy::throwOnCopy = false;
+  f = MaybeThrowOnCopy(1);
+  g = MaybeThrowOnCopy(2);
+  BOOST_CHECK(f() == 1);
+  BOOST_CHECK(g() == 2);
+
+  MaybeThrowOnCopy::throwOnCopy = true;
+  f.swap(g);
+  BOOST_CHECK(f() == 2);
+  BOOST_CHECK(g() == 1);
+  
+  return 0;
+}
diff --git a/libs/function/test/regression.cfg b/libs/function/test/regression.cfg
new file mode 100644
index 0000000..7e44253
--- /dev/null
+++ b/libs/function/test/regression.cfg
@@ -0,0 +1,14 @@
+// Boost.Function regression test configuration file
+
+// From the boost/status directory, run
+// ./regression --tests ../libs/function/test/regression.cfg -o function.html
+
+
+run libs/function/test/allocator_test.cpp
+run libs/function/test/function_n_test.cpp
+run libs/function/test/function_test.cpp
+compile-fail libs/function/test/function_test_fail1.cpp
+compile-fail libs/function/test/function_test_fail2.cpp
+run libs/function/test/mixin_test.cpp
+run libs/function/test/policy_test.cpp
+run libs/function/test/stateless_test.cpp
diff --git a/libs/function/test/stateless_test.cpp b/libs/function/test/stateless_test.cpp
new file mode 100644
index 0000000..1767c7d
--- /dev/null
+++ b/libs/function/test/stateless_test.cpp
@@ -0,0 +1,38 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2001-2003. Use, modification and
+//  distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#include <boost/test/minimal.hpp>
+#include <boost/function.hpp>
+#include <stdexcept>
+
+struct stateless_integer_add {
+  int operator()(int x, int y) const { return x+y; }
+
+  void* operator new(std::size_t)
+  {
+    throw std::runtime_error("Cannot allocate a stateless_integer_add");
+  }
+
+  void* operator new(std::size_t, void* p)
+  {
+    return p;
+  }
+
+  void operator delete(void*) throw()
+  {
+  }
+};
+
+int test_main(int, char*[])
+{
+  ndnboost::function2<int, int, int> f;
+  f = stateless_integer_add();
+
+  return 0;
+}
diff --git a/libs/function/test/std_bind_cxx98.cpp b/libs/function/test/std_bind_cxx98.cpp
new file mode 100644
index 0000000..7ba3cee
--- /dev/null
+++ b/libs/function/test/std_bind_cxx98.cpp
@@ -0,0 +1,30 @@
+// Function library
+
+// Copyright (C) 2001-2003 Douglas Gregor
+
+// Use, modification and distribution is subject to 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) 
+
+// For more information, see http://www.boost.org/
+
+    
+#include <boost/function.hpp>
+#include <iostream>
+#include <functional>
+
+struct X {
+  int foo(int);
+};
+int X::foo(int x) { return -x; }
+
+int main()
+{
+      ndnboost::function<int (int)> f;
+  X x;
+  f = std::bind1st(
+        std::mem_fun(&X::foo), &x);
+  f(5); // Call x.foo(5)
+
+    return 0;
+}
diff --git a/libs/function/test/std_bind_portable.cpp b/libs/function/test/std_bind_portable.cpp
new file mode 100644
index 0000000..7aca746
--- /dev/null
+++ b/libs/function/test/std_bind_portable.cpp
@@ -0,0 +1,30 @@
+// Function library
+
+// Copyright (C) 2001-2003 Douglas Gregor
+
+// Use, modification and distribution is subject to 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) 
+
+// For more information, see http://www.boost.org/
+
+    
+#include <boost/function.hpp>
+#include <iostream>
+#include <functional>
+
+struct X {
+  int foo(int);
+};
+int X::foo(int x) { return -x; }
+
+int main()
+{
+      ndnboost::function1<int, int> f;
+  X x;
+  f = std::bind1st(
+        std::mem_fun(&X::foo), &x);
+  f(5); // Call x.foo(5)
+
+    return 0;
+}
diff --git a/libs/function/test/sum_avg_cxx98.cpp b/libs/function/test/sum_avg_cxx98.cpp
new file mode 100644
index 0000000..a49d4ea
--- /dev/null
+++ b/libs/function/test/sum_avg_cxx98.cpp
@@ -0,0 +1,28 @@
+// Function library
+
+// Copyright (C) 2001-2003 Douglas Gregor
+
+// Use, modification and distribution is subject to 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) 
+
+// For more information, see http://www.boost.org/
+
+    
+#include <boost/function.hpp>
+#include <iostream>
+
+void do_sum_avg(int values[], int n, int& sum, float& avg)
+{
+  sum = 0;
+  for (int i = 0; i < n; i++)
+    sum += values[i];
+  avg = (float)sum / n;
+}
+int main()
+{
+    ndnboost::function<void (int values[], int n, int& sum, float& avg)> sum_avg;
+    sum_avg = &do_sum_avg;
+
+    return 0;
+}
diff --git a/libs/function/test/sum_avg_portable.cpp b/libs/function/test/sum_avg_portable.cpp
new file mode 100644
index 0000000..76de8fe
--- /dev/null
+++ b/libs/function/test/sum_avg_portable.cpp
@@ -0,0 +1,28 @@
+// Function library
+
+// Copyright (C) 2001-2003 Douglas Gregor
+
+// Use, modification and distribution is subject to 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) 
+
+// For more information, see http://www.boost.org/
+
+    
+#include <boost/function.hpp>
+#include <iostream>
+
+void do_sum_avg(int values[], int n, int& sum, float& avg)
+{
+  sum = 0;
+  for (int i = 0; i < n; i++)
+    sum += values[i];
+  avg = (float)sum / n;
+}
+int main()
+{
+    ndnboost::function4<void, int*, int, int&, float&> sum_avg;
+    sum_avg = &do_sum_avg;
+
+    return 0;
+}
diff --git a/libs/functional/binders.html b/libs/functional/binders.html
new file mode 100644
index 0000000..30c2c4b
--- /dev/null
+++ b/libs/functional/binders.html
@@ -0,0 +1,161 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+  <meta http-equiv="Content-Language" content="en-us">
+  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+
+  <title>Boost Function Object Adapter Library</title>
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+  <table border="1" bgcolor="#007F7F" cellpadding="2" summary="">
+    <tr>
+      <td bgcolor="#FFFFFF"><img src="../../boost.png" alt=
+      "boost.png (6897 bytes)" width="277" height="86"></td>
+
+      <td><a href="../../index.htm"><font face="Arial" color=
+      "#FFFFFF"><big>Home</big></font></a></td>
+
+      <td><a href="../libraries.htm"><font face="Arial" color=
+      "#FFFFFF"><big>Libraries</big></font></a></td>
+
+      <td><a href="http://www.boost.org/people/people.htm"><font face="Arial" color=
+      "#FFFFFF"><big>People</big></font></a></td>
+
+      <td><a href="http://www.boost.org/more/faq.htm"><font face="Arial" color=
+      "#FFFFFF"><big>FAQ</big></font></a></td>
+
+      <td><a href="../../more/index.htm"><font face="Arial" color=
+      "#FFFFFF"><big>More</big></font></a></td>
+    </tr>
+  </table>
+
+  <h1>Binders</h1>
+
+  <p>The header <a href="../../boost/functional.hpp">functional.hpp</a>
+  provides enhanced versions of both the binder function object adapters from
+  the C++ Standard Library (&sect;20.3.6):</p>
+
+  <ul>
+    <li><tt>binder1st</tt></li>
+
+    <li><tt>binder2nd</tt></li>
+  </ul>
+
+  <p>As well as the corresponding helper functions</p>
+
+  <ul>
+    <li><tt>bind1st</tt></li>
+
+    <li><tt>bind2nd</tt></li>
+  </ul>
+
+  <p>The key benefit of these adapters over those in the Standard Library is
+  they avoid the problem of <a href="#refref">references to
+  references.</a></p>
+
+  <h3>Usage</h3>
+
+  <p>Usage is identical to the standard binders. For example,</p>
+
+  <blockquote>
+    <pre>
+class Foo {
+public:
+  void bar(std::ostream &amp;);
+  // ...
+};
+// ...
+std::vector&lt;Foo&gt; c;
+// ...
+std::for_each(c.begin(), c.end(), 
+              boost::bind2nd(boost::mem_fun_ref(&amp;Foo::bar), std::cout));
+</pre>
+  </blockquote>
+
+  <h3 id="refref">References to References</h3>
+
+  <p>Consider the usage example above</p>
+
+  <blockquote>
+    <pre>
+class Foo {
+public:
+  void bar(<strong>std::ostream &amp;</strong>);
+  // ...
+};
+// ...
+std::for_each(c.begin(), c.end(), 
+              boost::bind2nd(boost::mem_fun_ref(&amp;Foo::bar), std::cout));
+</pre>
+  </blockquote>
+
+  <p>If this had been written using <tt>std::bind2nd</tt> and
+  <tt>std::mem_fun_ref</tt>, it would be unlikely to compile.</p>
+
+  <p>The problem arises because <tt>bar</tt> takes a reference argument. The
+  Standard defines <tt>std::mem_fun_ref</tt> such that it creates a function
+  object whose <tt>second_argument_type</tt> will be
+  <tt>std::ostream&amp;</tt>.</p>
+
+  <p>The call to <tt>bind2nd</tt> creates a <tt>binder2nd</tt> which the
+  Standard defines as follows:</p>
+
+  <blockquote>
+    <pre>
+template &lt;class Operation&gt;
+class binder2nd
+    : public unary_function&lt;typename Operation::first_argument_type,
+                            typename Operation::result_type&gt; {
+...
+public:
+  binder2nd(const Operation&amp; x,
+            <strong>const typename Operation::second_argument_type&amp; y</strong>);
+  ...
+</pre>
+  </blockquote>
+
+  <p>Since our operation's <tt>second_argument_type</tt> is
+  <tt>std::ostream&amp;</tt>, the type of <tt>y</tt> in the constructor would
+  be <tt>std::ostream&amp;&amp;</tt>. Since you cannot have a reference to a
+  reference, at this point we should get a compilation error because
+  references to references are illegal in C++ (but see <a href=
+  "http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#106">C++
+  Standard core language active issues list</a>).</p>
+
+  <p>The binders in this library avoid this problem by using the Boost
+  <tt><a href="../utility/call_traits.htm">call_traits</a></tt>
+  templates.</p>
+
+  <p>Our constructor is declared</p>
+
+  <blockquote>
+    <pre>
+binder2nd(const Operation&amp; x,
+          <strong>typename call_traits&lt;
+             typename binary_traits&lt;Operation&gt;::second_argument_type
+          &gt;::param_type y</strong>)
+</pre>
+  </blockquote>
+
+  <p>As a result, <tt>y</tt> has a type of <tt>std::ostream&amp;</tt>, and
+  our example compiles.</p>
+  <hr>
+
+  <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
+  "../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
+  height="31" width="88"></a></p>
+
+  <p>Revised 
+  <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->02
+  December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38510" --></p>
+
+  <p><i>Copyright &copy; 2000 Cadenza New Zealand Ltd.</i></p>
+
+  <p><i>Distributed under the Boost Software License, Version 1.0. (See
+  accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
+  copy at <a href=
+  "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
+</body>
+</html>
diff --git a/libs/functional/factory/doc/Jamfile b/libs/functional/factory/doc/Jamfile
new file mode 100644
index 0000000..1653336
--- /dev/null
+++ b/libs/functional/factory/doc/Jamfile
@@ -0,0 +1,20 @@
+
+# (C) Copyright Tobias Schwinger
+#
+# Use modification and distribution are subject to the boost Software License,
+# Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt).
+
+using quickbook ;
+
+xml factory : factory.qbk ;
+boostbook standalone : factory
+  :
+        <xsl:param>boost.root=../../../../..
+        <xsl:param>boost.libraries=../../../../libraries.htm
+        <xsl:param>chunk.section.depth=0
+        <xsl:param>chunk.first.sections=0
+        <xsl:param>generate.section.toc.level=2
+        <xsl:param>toc.max.depth=1
+  ;
+
+
diff --git a/libs/functional/factory/doc/factory.qbk b/libs/functional/factory/doc/factory.qbk
new file mode 100644
index 0000000..7aa3faf
--- /dev/null
+++ b/libs/functional/factory/doc/factory.qbk
@@ -0,0 +1,386 @@
+[library Boost.Functional/Factory
+  [quickbook 1.3]
+  [version 1.0]
+  [authors [Schwinger, Tobias]]
+  [copyright 2007 2008 Tobias Schwinger]
+  [license
+        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])
+  ]
+  [purpose Function object templates for object creation.]
+  [category higher-order]
+  [category generic]
+  [last-revision $Date: 2008/11/01 21:44:52 $]
+]
+
+[def __boost_bind__ [@http://www.boost.org/libs/bind/bind.html Boost.Bind]]
+[def __boost__bind__ [@http://www.boost.org/libs/bind/bind.html `boost::bind`]]
+
+[def __boost__forward_adapter__ [@http://www.boost.org/libs/functional/forward/doc/index.html `boost::forward_adapter`]]
+[def __fusion_functional_adapters__ [@http://www.boost.org/libs/fusion/doc/html/functional.html Fusion Functional Adapters]]
+
+[def __boost_function__ [@http://www.boost.org/doc/html/function.html Boost.Function]]
+[def __boost__function__ [@http://www.boost.org/doc/html/function.html `boost::function`]]
+
+[def __smart_pointer__ [@http://www.boost.org/libs/smart_ptr/index.html Smart Pointer]]
+[def __smart_pointers__ [@http://www.boost.org/libs/smart_ptr/index.html Smart Pointers]]
+[def __boost__shared_ptr__ [@http://www.boost.org/libs/smart_ptr/shared_ptr.htm `boost::shared_ptr`]]
+
+[def __std__map__ [@http://www.sgi.com/tech/stl/map.html `std::map`]]
+[def __std__string__ [@http://www.sgi.com/tech/stl/string.html `std::string`]]
+[def __allocator__ [@http://www.sgi.com/tech/stl/concepts/allocator.html Allocator]]
+[def __std_allocator__ [@http://www.sgi.com/tech/stl/concepts/allocator.html Allocator]]
+[def __std_allocators__ [@http://www.sgi.com/tech/stl/concepts/allocator.html Allocators]]
+
+[def __boost__ptr_map__ [@http://www.boost.org/libs/ptr_container/doc/ptr_map.html `boost::ptr_map`]]
+
+[def __boost__factory__ `boost::factory`]
+[def __boost__value_factory__ `boost::value_factory`]
+
+[def __factory__ `factory`]
+[def __value_factory__ `value_factory`]
+
+
+[section Brief Description]
+
+The template __boost__factory__ lets you encapsulate a `new` expression
+as a function object, __boost__value_factory__ encapsulates a constructor
+invocation without `new`.
+
+    __boost__factory__<T*>()(arg1,arg2,arg3) 
+    // same as new T(arg1,arg2,arg3)
+
+    __boost__value_factory__<T>()(arg1,arg2,arg3)
+    // same as T(arg1,arg2,arg3)
+
+For technical reasons the arguments to the function objects have to be
+LValues. A factory that also accepts RValues can be composed using the
+__boost__forward_adapter__ or __boost__bind__.
+
+[endsect]
+
+[section Background]
+
+In traditional Object Oriented Programming a Factory is an object implementing
+an interface of one or more methods that construct objects conforming to known
+interfaces.
+
+    // assuming a_concrete_class and another_concrete_class are derived
+    // from an_abstract_class
+
+    class a_factory
+    {
+      public:
+        virtual an_abstract_class* create() const = 0;
+        virtual ~a_factory() { }
+    };
+
+    class a_concrete_factory : public a_factory
+    {
+      public:
+        virtual an_abstract_class* create() const
+        {
+            return new a_concrete_class();
+        }
+    };
+
+    class another_concrete_factory : public a_factory
+    {
+      public:
+        virtual an_abstract_class* create() const
+        {
+            return new another_concrete_class();
+        }
+    };
+
+    // [...]
+
+    int main()
+    {
+        __boost__ptr_map__<__std__string__,a_factory> factories;
+
+        // [...]
+
+        factories.insert("a_name",std::auto_ptr<a_factory>(
+            new a_concrete_factory));
+        factories.insert("another_name",std::auto_ptr<a_factory>(
+            new another_concrete_factory));
+
+        // [...]
+
+        std::auto_ptr<an_abstract_class> x(factories.at(some_name).create());
+
+        // [...]
+    }
+
+This approach has several drawbacks. The most obvious one is that there is
+lots of boilerplate code. In other words there is too much code to express
+a rather simple intention. We could use templates to get rid of some of it
+but the approach remains inflexible: 
+
+* We may want a factory that takes some arguments that are forwarded to
+  the constructor,
+* we will probably want to use smart pointers,
+* we may want several member functions to create different kinds of
+  objects,
+* we might not necessarily need a polymorphic base class for the objects,
+* as we will see, we do not need a factory base class at all, 
+* we might want to just call the constructor - without `new` to create
+  an object on the stack, and
+* finally we might want to use customized memory management.
+
+Experience has shown that using function objects and generic Boost components
+for their composition, Design Patterns that describe callback mechanisms
+(typically requiring a high percentage of boilerplate code with pure Object
+Oriented methodology) become implementable with just few code lines and without
+extra classes. 
+
+Factories are callback mechanisms for constructors, so we provide two class
+templates, __boost__value_factory__ and __boost__factory__, that encapsulate
+object construction via direct application of the constructor and the `new`
+operator, respectively. 
+
+We let the function objects forward their arguments to the construction
+expressions they encapsulate. Over this __boost__factory__ optionally allows
+the use of smart pointers and __std_allocators__.
+
+Compile-time polymorphism can be used where appropriate,
+
+    template< class T >
+    void do_something()
+    {
+        // [...]
+        T x = T(a,b);
+
+        // for conceptually similar objects x we neither need virtual
+        // functions nor a common base class in this context.
+        // [...]
+    }
+
+Now, to allow inhomogeneous signatures for the constructors of the types passed
+in for `T` we can use __value_factory__ and __boost__bind__ to normalize between
+them. 
+
+    template< class ValueFactory > 
+    void do_something(ValueFactory make_obj = ValueFactory())
+    {
+        // [...]
+        typename ValueFactory::result_type x = make_obj(a,b);
+
+        // for conceptually similar objects x we neither need virtual
+        // functions nor a common base class in this context.
+        // [...]
+    }
+
+    int main()
+    {
+        // [...]
+
+        do_something(__boost__value_factory__<X>());
+        do_something(boost::bind(__boost__value_factory__<Y>(),_1,5,_2));
+        // construct X(a,b) and Y(a,5,b), respectively.
+
+        // [...]
+    }
+
+Maybe we want our objects to outlive the function's scope, in this case we
+have to use dynamic allocation;
+
+    template< class Factory >
+    whatever do_something(Factory new_obj = Factory())
+    {
+        typename Factory::result_type ptr = new_obj(a,b);
+
+        // again, no common base class or virtual functions needed,
+        // we could enforce a polymorphic base by writing e.g.
+        //    boost::shared_ptr<base>
+        // instead of
+        //    typename Factory::result_type
+        // above.
+        // Note that we are also free to have the type erasure happen 
+        // somewhere else (e.g. in the constructor of this function's
+        // result type).
+
+        // [...]
+    }
+
+    // [... call do_something like above but with __factory__ instead
+    // of __value_factory__]
+
+Although we might have created polymorphic objects in the previous example,
+we have used compile time polymorphism for the factory. If we want to erase
+the type of the factory and thus allow polymorphism at run time, we can
+use __boost_function__ to do so. The first example can be rewritten as 
+follows.
+
+    typedef boost::function< an_abstract_class*() > a_factory;
+
+    // [...]
+
+    int main()
+    {
+        __std__map__<__std__string__,a_factory> factories;
+
+        // [...]
+
+        factories["a_name"] = __boost__factory__<a_concrete_class*>();
+        factories["another_name"] = 
+            __boost__factory__<another_concrete_class*>();
+
+        // [...]
+    } 
+
+Of course we can just as easy create factories that take arguments and/or
+return __smart_pointers__.
+
+[endsect]
+
+
+[section:reference Reference]
+
+
+[section value_factory]
+
+[heading Description]
+
+Function object template that invokes the constructor of the type `T`.
+
+[heading Header]
+    #include <boost/functional/value_factory.hpp>
+
+[heading Synopsis]
+
+    namespace boost
+    {
+        template< typename T >
+        class value_factory;
+    }
+
+[variablelist Notation
+    [[`T`]         [an arbitrary type with at least one public constructor]]
+    [[`a0`...`aN`] [argument LValues to a constructor of `T`]]
+    [[`F`]         [the type `value_factory<F>`]]
+    [[`f`]         [an instance object of `F`]]
+]
+
+[heading Expression Semantics]
+
+[table
+    [[Expression]       [Semantics]]
+    [[`F()`]            [creates an object of type `F`.]]
+    [[`F(f)`]           [creates an object of type `F`.]]
+    [[`f(a0`...`aN)`]   [returns `T(a0`...`aN)`.]]
+    [[`F::result_type`] [is the type `T`.]]
+]
+
+[heading Limits]
+
+The macro BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY can be defined to set the
+maximum arity. It defaults to 10.
+
+[endsect]
+
+
+[section factory]
+
+[heading Description]
+
+Function object template that dynamically constructs a pointee object for
+the type of pointer given as template argument. Smart pointers may be used
+for the template argument, given that `boost::pointee<Pointer>::type` yields
+the pointee type.
+
+If an __allocator__ is given, it is used for memory allocation and the 
+placement form of the `new` operator is used to construct the object.
+A function object that calls the destructor and deallocates the memory
+with a copy of the Allocator is used for the second constructor argument
+of `Pointer` (thus it must be a __smart_pointer__ that provides a suitable 
+constructor, such as __boost__shared_ptr__).
+
+If a third template argument is `factory_passes_alloc_to_smart_pointer`,
+the allocator itself is used for the third constructor argument of `Pointer`
+(__boost__shared_ptr__ then uses the allocator to manage the memory of its
+separately allocated reference counter).
+
+[heading Header]
+    #include <boost/functional/factory.hpp>
+
+[heading Synopsis]
+
+    namespace boost
+    {
+        enum factory_alloc_propagation
+        {
+            factory_alloc_for_pointee_and_deleter,
+            factory_passes_alloc_to_smart_pointer
+        };
+
+        template< typename Pointer, 
+            class Allocator = boost::none_t,
+            factory_alloc_propagation AllocProp =
+                factory_alloc_for_pointee_and_deleter >
+        class factory;
+    }
+
+[variablelist Notation
+    [[`T`]         [an arbitrary type with at least one public constructor]]
+    [[`P`]         [pointer or smart pointer to `T`]]
+    [[`a0`...`aN`] [argument LValues to a constructor of `T`]]
+    [[`F`]         [the type `factory<P>`]]
+    [[`f`]         [an instance object of `F`]]
+]
+
+[heading Expression Semantics]
+
+[table
+    [[Expression]       [Semantics]]
+    [[`F()`]            [creates an object of type `F`.]]
+    [[`F(f)`]           [creates an object of type `F`.]]
+    [[`f(a0`...`aN)`]   [dynamically creates an object of type `T` using 
+        `a0`...`aN` as arguments for the constructor invocation.]]
+    [[`F::result_type`] [is the type `P` with top-level cv-qualifiers removed.]]
+]
+
+[heading Limits]
+
+The macro BOOST_FUNCTIONAL_FACTORY_MAX_ARITY can be defined to set the
+maximum arity. It defaults to 10.
+
+[endsect]
+
+[endsect]
+
+[section Acknowledgements]
+
+Eric Niebler requested a function to invoke a type's constructor (with the 
+arguments supplied as a Tuple) as a Fusion feature. These Factory utilities are
+a factored-out generalization of this idea.
+
+Dave Abrahams suggested Smart Pointer support for exception safety, providing
+useful hints for the implementation.
+
+Joel de Guzman's documentation style was copied from Fusion.
+
+Further, I want to thank Peter Dimov for sharing his insights on language
+details and their evolution.
+
+[endsect]
+
+[section References]
+
+# [@http://en.wikipedia.org/wiki/Design_Patterns Design Patterns],
+  Gamma et al. - Addison Wesley Publishing, 1995
+
+# [@http://www.sgi.com/tech/stl/ Standard Template Library Programmer's Guide], 
+  Hewlett-Packard Company, 1994
+
+# [@http://www.boost.org/libs/bind/bind.html Boost.Bind], 
+  Peter Dimov, 2001-2005
+
+# [@http://www.boost.org/doc/html/function.html Boost.Function],
+  Douglas Gregor, 2001-2004
+
+[endsect]
+
+
diff --git a/libs/functional/factory/doc/html/index.html b/libs/functional/factory/doc/html/index.html
new file mode 100644
index 0000000..1131629
--- /dev/null
+++ b/libs/functional/factory/doc/html/index.html
@@ -0,0 +1,620 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Chapter&#160;1.&#160;Boost.Functional/Factory 1.0</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.Functional/Factory 1.0">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+<div class="chapter">
+<div class="titlepage"><div>
+<div><h2 class="title">
+<a name="boost_functional_factory"></a>Chapter&#160;1.&#160;Boost.Functional/Factory 1.0</h2></div>
+<div><div class="author"><h3 class="author">
+<span class="firstname">Tobias</span> <span class="surname">Schwinger</span>
+</h3></div></div>
+<div><p class="copyright">Copyright &#169; 2007, 2008 Tobias Schwinger</p></div>
+<div><div class="legalnotice">
+<a name="boost_functional_factory.legal"></a><p>
+        Distributed under the Boost Software License, Version 1.0. (See accompanying
+        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>)
+      </p>
+</div></div>
+</div></div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl class="toc">
+<dt><span class="section"><a href="index.html#boost_functional_factory.brief_description">Brief Description</a></span></dt>
+<dt><span class="section"><a href="index.html#boost_functional_factory.background">Background</a></span></dt>
+<dt><span class="section"><a href="index.html#boost_functional_factory.reference">Reference</a></span></dt>
+<dt><span class="section"><a href="index.html#boost_functional_factory.acknowledgements">Acknowledgements</a></span></dt>
+<dt><span class="section"><a href="index.html#boost_functional_factory.references">References</a></span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_factory.brief_description"></a><a class="link" href="index.html#boost_functional_factory.brief_description" title="Brief Description">Brief Description</a>
+</h2></div></div></div>
+<p>
+      The template <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">factory</span></code> lets you encapsulate a <code class="computeroutput"><span class="keyword">new</span></code> expression as a function object, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">value_factory</span></code>
+      encapsulates a constructor invocation without <code class="computeroutput"><span class="keyword">new</span></code>.
+    </p>
+<pre class="programlisting"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">factory</span></code><span class="special">&lt;</span><span class="identifier">T</span><span class="special">*&gt;()(</span><span class="identifier">arg1</span><span class="special">,</span><span class="identifier">arg2</span><span class="special">,</span><span class="identifier">arg3</span><span class="special">)</span>
+<span class="comment">// same as new T(arg1,arg2,arg3)</span>
+
+<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">value_factory</span></code><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;()(</span><span class="identifier">arg1</span><span class="special">,</span><span class="identifier">arg2</span><span class="special">,</span><span class="identifier">arg3</span><span class="special">)</span>
+<span class="comment">// same as T(arg1,arg2,arg3)</span>
+</pre>
+<p>
+      For technical reasons the arguments to the function objects have to be LValues.
+      A factory that also accepts RValues can be composed using the <a href="http://www.boost.org/libs/functional/forward/doc/index.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">forward_adapter</span></code></a>
+      or <a href="http://www.boost.org/libs/bind/bind.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span></code></a>.
+    </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_factory.background"></a><a class="link" href="index.html#boost_functional_factory.background" title="Background">Background</a>
+</h2></div></div></div>
+<p>
+      In traditional Object Oriented Programming a Factory is an object implementing
+      an interface of one or more methods that construct objects conforming to known
+      interfaces.
+    </p>
+<pre class="programlisting"><span class="comment">// assuming a_concrete_class and another_concrete_class are derived</span>
+<span class="comment">// from an_abstract_class</span>
+
+<span class="keyword">class</span> <span class="identifier">a_factory</span>
+<span class="special">{</span>
+  <span class="keyword">public</span><span class="special">:</span>
+    <span class="keyword">virtual</span> <span class="identifier">an_abstract_class</span><span class="special">*</span> <span class="identifier">create</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+    <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">a_factory</span><span class="special">()</span> <span class="special">{</span> <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="keyword">class</span> <span class="identifier">a_concrete_factory</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">a_factory</span>
+<span class="special">{</span>
+  <span class="keyword">public</span><span class="special">:</span>
+    <span class="keyword">virtual</span> <span class="identifier">an_abstract_class</span><span class="special">*</span> <span class="identifier">create</span><span class="special">()</span> <span class="keyword">const</span>
+    <span class="special">{</span>
+        <span class="keyword">return</span> <span class="keyword">new</span> <span class="identifier">a_concrete_class</span><span class="special">();</span>
+    <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="keyword">class</span> <span class="identifier">another_concrete_factory</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">a_factory</span>
+<span class="special">{</span>
+  <span class="keyword">public</span><span class="special">:</span>
+    <span class="keyword">virtual</span> <span class="identifier">an_abstract_class</span><span class="special">*</span> <span class="identifier">create</span><span class="special">()</span> <span class="keyword">const</span>
+    <span class="special">{</span>
+        <span class="keyword">return</span> <span class="keyword">new</span> <span class="identifier">another_concrete_class</span><span class="special">();</span>
+    <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="comment">// [...]</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+    <a href="http://www.boost.org/libs/ptr_container/doc/ptr_map.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ptr_map</span></code></a><span class="special">&lt;</span><a href="http://www.sgi.com/tech/stl/string.html" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code></a><span class="special">,</span><span class="identifier">a_factory</span><span class="special">&gt;</span> <span class="identifier">factories</span><span class="special">;</span>
+
+    <span class="comment">// [...]</span>
+
+    <span class="identifier">factories</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="string">"a_name"</span><span class="special">,</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">auto_ptr</span><span class="special">&lt;</span><span class="identifier">a_factory</span><span class="special">&gt;(</span>
+        <span class="keyword">new</span> <span class="identifier">a_concrete_factory</span><span class="special">));</span>
+    <span class="identifier">factories</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="string">"another_name"</span><span class="special">,</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">auto_ptr</span><span class="special">&lt;</span><span class="identifier">a_factory</span><span class="special">&gt;(</span>
+        <span class="keyword">new</span> <span class="identifier">another_concrete_factory</span><span class="special">));</span>
+
+    <span class="comment">// [...]</span>
+
+    <span class="identifier">std</span><span class="special">::</span><span class="identifier">auto_ptr</span><span class="special">&lt;</span><span class="identifier">an_abstract_class</span><span class="special">&gt;</span> <span class="identifier">x</span><span class="special">(</span><span class="identifier">factories</span><span class="special">.</span><span class="identifier">at</span><span class="special">(</span><span class="identifier">some_name</span><span class="special">).</span><span class="identifier">create</span><span class="special">());</span>
+
+    <span class="comment">// [...]</span>
+<span class="special">}</span>
+</pre>
+<p>
+      This approach has several drawbacks. The most obvious one is that there is
+      lots of boilerplate code. In other words there is too much code to express
+      a rather simple intention. We could use templates to get rid of some of it
+      but the approach remains inflexible:
+    </p>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+          We may want a factory that takes some arguments that are forwarded to the
+          constructor,
+        </li>
+<li class="listitem">
+          we will probably want to use smart pointers,
+        </li>
+<li class="listitem">
+          we may want several member functions to create different kinds of objects,
+        </li>
+<li class="listitem">
+          we might not necessarily need a polymorphic base class for the objects,
+        </li>
+<li class="listitem">
+          as we will see, we do not need a factory base class at all,
+        </li>
+<li class="listitem">
+          we might want to just call the constructor - without <code class="computeroutput"><span class="keyword">new</span></code>
+          to create an object on the stack, and
+        </li>
+<li class="listitem">
+          finally we might want to use customized memory management.
+        </li>
+</ul></div>
+<p>
+      Experience has shown that using function objects and generic Boost components
+      for their composition, Design Patterns that describe callback mechanisms (typically
+      requiring a high percentage of boilerplate code with pure Object Oriented methodology)
+      become implementable with just few code lines and without extra classes.
+    </p>
+<p>
+      Factories are callback mechanisms for constructors, so we provide two class
+      templates, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">value_factory</span></code> and <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">factory</span></code>,
+      that encapsulate object construction via direct application of the constructor
+      and the <code class="computeroutput"><span class="keyword">new</span></code> operator, respectively.
+    </p>
+<p>
+      We let the function objects forward their arguments to the construction expressions
+      they encapsulate. Over this <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">factory</span></code>
+      optionally allows the use of smart pointers and <a href="http://www.sgi.com/tech/stl/concepts/allocator.html" target="_top">Allocators</a>.
+    </p>
+<p>
+      Compile-time polymorphism can be used where appropriate,
+    </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">T</span> <span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">do_something</span><span class="special">()</span>
+<span class="special">{</span>
+    <span class="comment">// [...]</span>
+    <span class="identifier">T</span> <span class="identifier">x</span> <span class="special">=</span> <span class="identifier">T</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">);</span>
+
+    <span class="comment">// for conceptually similar objects x we neither need virtual</span>
+    <span class="comment">// functions nor a common base class in this context.</span>
+    <span class="comment">// [...]</span>
+<span class="special">}</span>
+</pre>
+<p>
+      Now, to allow inhomogeneous signatures for the constructors of the types passed
+      in for <code class="computeroutput"><span class="identifier">T</span></code> we can use <code class="computeroutput"><span class="identifier">value_factory</span></code> and <a href="http://www.boost.org/libs/bind/bind.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span></code></a>
+      to normalize between them.
+    </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">ValueFactory</span> <span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">do_something</span><span class="special">(</span><span class="identifier">ValueFactory</span> <span class="identifier">make_obj</span> <span class="special">=</span> <span class="identifier">ValueFactory</span><span class="special">())</span>
+<span class="special">{</span>
+    <span class="comment">// [...]</span>
+    <span class="keyword">typename</span> <span class="identifier">ValueFactory</span><span class="special">::</span><span class="identifier">result_type</span> <span class="identifier">x</span> <span class="special">=</span> <span class="identifier">make_obj</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">);</span>
+
+    <span class="comment">// for conceptually similar objects x we neither need virtual</span>
+    <span class="comment">// functions nor a common base class in this context.</span>
+    <span class="comment">// [...]</span>
+<span class="special">}</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+    <span class="comment">// [...]</span>
+
+    <span class="identifier">do_something</span><span class="special">(</span><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">value_factory</span></code><span class="special">&lt;</span><span class="identifier">X</span><span class="special">&gt;());</span>
+    <span class="identifier">do_something</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">value_factory</span></code><span class="special">&lt;</span><span class="identifier">Y</span><span class="special">&gt;(),</span><span class="identifier">_1</span><span class="special">,</span><span class="number">5</span><span class="special">,</span><span class="identifier">_2</span><span class="special">));</span>
+    <span class="comment">// construct X(a,b) and Y(a,5,b), respectively.</span>
+
+    <span class="comment">// [...]</span>
+<span class="special">}</span>
+</pre>
+<p>
+      Maybe we want our objects to outlive the function's scope, in this case we
+      have to use dynamic allocation;
+    </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">Factory</span> <span class="special">&gt;</span>
+<span class="identifier">whatever</span> <span class="identifier">do_something</span><span class="special">(</span><span class="identifier">Factory</span> <span class="identifier">new_obj</span> <span class="special">=</span> <span class="identifier">Factory</span><span class="special">())</span>
+<span class="special">{</span>
+    <span class="keyword">typename</span> <span class="identifier">Factory</span><span class="special">::</span><span class="identifier">result_type</span> <span class="identifier">ptr</span> <span class="special">=</span> <span class="identifier">new_obj</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">);</span>
+
+    <span class="comment">// again, no common base class or virtual functions needed,</span>
+    <span class="comment">// we could enforce a polymorphic base by writing e.g.</span>
+    <span class="comment">//    boost::shared_ptr&lt;base&gt;</span>
+    <span class="comment">// instead of</span>
+    <span class="comment">//    typename Factory::result_type</span>
+    <span class="comment">// above.</span>
+    <span class="comment">// Note that we are also free to have the type erasure happen </span>
+    <span class="comment">// somewhere else (e.g. in the constructor of this function's</span>
+    <span class="comment">// result type).</span>
+
+    <span class="comment">// [...]</span>
+<span class="special">}</span>
+
+<span class="comment">// [... call do_something like above but with __factory__ instead</span>
+<span class="comment">// of __value_factory__]</span>
+</pre>
+<p>
+      Although we might have created polymorphic objects in the previous example,
+      we have used compile time polymorphism for the factory. If we want to erase
+      the type of the factory and thus allow polymorphism at run time, we can use
+      <a href="http://www.boost.org/doc/html/function.html" target="_top">Boost.Function</a>
+      to do so. The first example can be rewritten as follows.
+    </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span> <span class="identifier">an_abstract_class</span><span class="special">*()</span> <span class="special">&gt;</span> <span class="identifier">a_factory</span><span class="special">;</span>
+
+<span class="comment">// [...]</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+    <a href="http://www.sgi.com/tech/stl/map.html" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span></code></a><span class="special">&lt;</span><a href="http://www.sgi.com/tech/stl/string.html" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code></a><span class="special">,</span><span class="identifier">a_factory</span><span class="special">&gt;</span> <span class="identifier">factories</span><span class="special">;</span>
+
+    <span class="comment">// [...]</span>
+
+    <span class="identifier">factories</span><span class="special">[</span><span class="string">"a_name"</span><span class="special">]</span> <span class="special">=</span> <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">factory</span></code><span class="special">&lt;</span><span class="identifier">a_concrete_class</span><span class="special">*&gt;();</span>
+    <span class="identifier">factories</span><span class="special">[</span><span class="string">"another_name"</span><span class="special">]</span> <span class="special">=</span>
+        <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">factory</span></code><span class="special">&lt;</span><span class="identifier">another_concrete_class</span><span class="special">*&gt;();</span>
+
+    <span class="comment">// [...]</span>
+<span class="special">}</span>
+</pre>
+<p>
+      Of course we can just as easy create factories that take arguments and/or return
+      <a href="http://www.boost.org/libs/smart_ptr/index.html" target="_top">Smart Pointers</a>.
+    </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_factory.reference"></a><a class="link" href="index.html#boost_functional_factory.reference" title="Reference">Reference</a>
+</h2></div></div></div>
+<div class="toc"><dl class="toc">
+<dt><span class="section"><a href="index.html#boost_functional_factory.reference.value_factory">value_factory</a></span></dt>
+<dt><span class="section"><a href="index.html#boost_functional_factory.reference.factory">factory</a></span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_functional_factory.reference.value_factory"></a><a class="link" href="index.html#boost_functional_factory.reference.value_factory" title="value_factory">value_factory</a>
+</h3></div></div></div>
+<h5>
+<a name="boost_functional_factory.reference.value_factory.h0"></a>
+        <span class="phrase"><a name="boost_functional_factory.reference.value_factory.description"></a></span><a class="link" href="index.html#boost_functional_factory.reference.value_factory.description">Description</a>
+      </h5>
+<p>
+        Function object template that invokes the constructor of the type <code class="computeroutput"><span class="identifier">T</span></code>.
+      </p>
+<h5>
+<a name="boost_functional_factory.reference.value_factory.h1"></a>
+        <span class="phrase"><a name="boost_functional_factory.reference.value_factory.header"></a></span><a class="link" href="index.html#boost_functional_factory.reference.value_factory.header">Header</a>
+      </h5>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">functional</span><span class="special">/</span><span class="identifier">value_factory</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+</pre>
+<h5>
+<a name="boost_functional_factory.reference.value_factory.h2"></a>
+        <span class="phrase"><a name="boost_functional_factory.reference.value_factory.synopsis"></a></span><a class="link" href="index.html#boost_functional_factory.reference.value_factory.synopsis">Synopsis</a>
+      </h5>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
+<span class="special">{</span>
+    <span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">&gt;</span>
+    <span class="keyword">class</span> <span class="identifier">value_factory</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<div class="variablelist">
+<p class="title"><b>Notation</b></p>
+<dl class="variablelist">
+<dt><span class="term"><code class="computeroutput"><span class="identifier">T</span></code></span></dt>
+<dd><p>
+              an arbitrary type with at least one public constructor
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code></span></dt>
+<dd><p>
+              argument LValues to a constructor of <code class="computeroutput"><span class="identifier">T</span></code>
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">F</span></code></span></dt>
+<dd><p>
+              the type <code class="computeroutput"><span class="identifier">value_factory</span><span class="special">&lt;</span><span class="identifier">F</span><span class="special">&gt;</span></code>
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">f</span></code></span></dt>
+<dd><p>
+              an instance object of <code class="computeroutput"><span class="identifier">F</span></code>
+            </p></dd>
+</dl>
+</div>
+<h5>
+<a name="boost_functional_factory.reference.value_factory.h3"></a>
+        <span class="phrase"><a name="boost_functional_factory.reference.value_factory.expression_semantics"></a></span><a class="link" href="index.html#boost_functional_factory.reference.value_factory.expression_semantics">Expression
+        Semantics</a>
+      </h5>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+                <p>
+                  Expression
+                </p>
+              </th>
+<th>
+                <p>
+                  Semantics
+                </p>
+              </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">F</span><span class="special">()</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  creates an object of type <code class="computeroutput"><span class="identifier">F</span></code>.
+                </p>
+              </td>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">F</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  creates an object of type <code class="computeroutput"><span class="identifier">F</span></code>.
+                </p>
+              </td>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span><span class="special">)</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  returns <code class="computeroutput"><span class="identifier">T</span><span class="special">(</span><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span><span class="special">)</span></code>.
+                </p>
+              </td>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">F</span><span class="special">::</span><span class="identifier">result_type</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  is the type <code class="computeroutput"><span class="identifier">T</span></code>.
+                </p>
+              </td>
+</tr>
+</tbody>
+</table></div>
+<h5>
+<a name="boost_functional_factory.reference.value_factory.h4"></a>
+        <span class="phrase"><a name="boost_functional_factory.reference.value_factory.limits"></a></span><a class="link" href="index.html#boost_functional_factory.reference.value_factory.limits">Limits</a>
+      </h5>
+<p>
+        The macro BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY can be defined to set
+        the maximum arity. It defaults to 10.
+      </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_functional_factory.reference.factory"></a><a class="link" href="index.html#boost_functional_factory.reference.factory" title="factory">factory</a>
+</h3></div></div></div>
+<h5>
+<a name="boost_functional_factory.reference.factory.h0"></a>
+        <span class="phrase"><a name="boost_functional_factory.reference.factory.description"></a></span><a class="link" href="index.html#boost_functional_factory.reference.factory.description">Description</a>
+      </h5>
+<p>
+        Function object template that dynamically constructs a pointee object for
+        the type of pointer given as template argument. Smart pointers may be used
+        for the template argument, given that <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">pointee</span><span class="special">&lt;</span><span class="identifier">Pointer</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
+        yields the pointee type.
+      </p>
+<p>
+        If an <a href="http://www.sgi.com/tech/stl/concepts/allocator.html" target="_top">Allocator</a>
+        is given, it is used for memory allocation and the placement form of the
+        <code class="computeroutput"><span class="keyword">new</span></code> operator is used to construct
+        the object. A function object that calls the destructor and deallocates the
+        memory with a copy of the Allocator is used for the second constructor argument
+        of <code class="computeroutput"><span class="identifier">Pointer</span></code> (thus it must
+        be a <a href="http://www.boost.org/libs/smart_ptr/index.html" target="_top">Smart Pointer</a>
+        that provides a suitable constructor, such as <a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span></code></a>).
+      </p>
+<p>
+        If a third template argument is <code class="computeroutput"><span class="identifier">factory_passes_alloc_to_smart_pointer</span></code>,
+        the allocator itself is used for the third constructor argument of <code class="computeroutput"><span class="identifier">Pointer</span></code> (<a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span></code></a> then uses the allocator
+        to manage the memory of its separately allocated reference counter).
+      </p>
+<h5>
+<a name="boost_functional_factory.reference.factory.h1"></a>
+        <span class="phrase"><a name="boost_functional_factory.reference.factory.header"></a></span><a class="link" href="index.html#boost_functional_factory.reference.factory.header">Header</a>
+      </h5>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">functional</span><span class="special">/</span><span class="identifier">factory</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+</pre>
+<h5>
+<a name="boost_functional_factory.reference.factory.h2"></a>
+        <span class="phrase"><a name="boost_functional_factory.reference.factory.synopsis"></a></span><a class="link" href="index.html#boost_functional_factory.reference.factory.synopsis">Synopsis</a>
+      </h5>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
+<span class="special">{</span>
+    <span class="keyword">enum</span> <span class="identifier">factory_alloc_propagation</span>
+    <span class="special">{</span>
+        <span class="identifier">factory_alloc_for_pointee_and_deleter</span><span class="special">,</span>
+        <span class="identifier">factory_passes_alloc_to_smart_pointer</span>
+    <span class="special">};</span>
+
+    <span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">Pointer</span><span class="special">,</span>
+        <span class="keyword">class</span> <span class="identifier">Allocator</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">none_t</span><span class="special">,</span>
+        <span class="identifier">factory_alloc_propagation</span> <span class="identifier">AllocProp</span> <span class="special">=</span>
+            <span class="identifier">factory_alloc_for_pointee_and_deleter</span> <span class="special">&gt;</span>
+    <span class="keyword">class</span> <span class="identifier">factory</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<div class="variablelist">
+<p class="title"><b>Notation</b></p>
+<dl class="variablelist">
+<dt><span class="term"><code class="computeroutput"><span class="identifier">T</span></code></span></dt>
+<dd><p>
+              an arbitrary type with at least one public constructor
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">P</span></code></span></dt>
+<dd><p>
+              pointer or smart pointer to <code class="computeroutput"><span class="identifier">T</span></code>
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code></span></dt>
+<dd><p>
+              argument LValues to a constructor of <code class="computeroutput"><span class="identifier">T</span></code>
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">F</span></code></span></dt>
+<dd><p>
+              the type <code class="computeroutput"><span class="identifier">factory</span><span class="special">&lt;</span><span class="identifier">P</span><span class="special">&gt;</span></code>
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">f</span></code></span></dt>
+<dd><p>
+              an instance object of <code class="computeroutput"><span class="identifier">F</span></code>
+            </p></dd>
+</dl>
+</div>
+<h5>
+<a name="boost_functional_factory.reference.factory.h3"></a>
+        <span class="phrase"><a name="boost_functional_factory.reference.factory.expression_semantics"></a></span><a class="link" href="index.html#boost_functional_factory.reference.factory.expression_semantics">Expression
+        Semantics</a>
+      </h5>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+                <p>
+                  Expression
+                </p>
+              </th>
+<th>
+                <p>
+                  Semantics
+                </p>
+              </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">F</span><span class="special">()</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  creates an object of type <code class="computeroutput"><span class="identifier">F</span></code>.
+                </p>
+              </td>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">F</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  creates an object of type <code class="computeroutput"><span class="identifier">F</span></code>.
+                </p>
+              </td>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span><span class="special">)</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  dynamically creates an object of type <code class="computeroutput"><span class="identifier">T</span></code>
+                  using <code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code> as arguments for the constructor
+                  invocation.
+                </p>
+              </td>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">F</span><span class="special">::</span><span class="identifier">result_type</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  is the type <code class="computeroutput"><span class="identifier">P</span></code> with
+                  top-level cv-qualifiers removed.
+                </p>
+              </td>
+</tr>
+</tbody>
+</table></div>
+<h5>
+<a name="boost_functional_factory.reference.factory.h4"></a>
+        <span class="phrase"><a name="boost_functional_factory.reference.factory.limits"></a></span><a class="link" href="index.html#boost_functional_factory.reference.factory.limits">Limits</a>
+      </h5>
+<p>
+        The macro BOOST_FUNCTIONAL_FACTORY_MAX_ARITY can be defined to set the maximum
+        arity. It defaults to 10.
+      </p>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_factory.acknowledgements"></a><a class="link" href="index.html#boost_functional_factory.acknowledgements" title="Acknowledgements">Acknowledgements</a>
+</h2></div></div></div>
+<p>
+      Eric Niebler requested a function to invoke a type's constructor (with the
+      arguments supplied as a Tuple) as a Fusion feature. These Factory utilities
+      are a factored-out generalization of this idea.
+    </p>
+<p>
+      Dave Abrahams suggested Smart Pointer support for exception safety, providing
+      useful hints for the implementation.
+    </p>
+<p>
+      Joel de Guzman's documentation style was copied from Fusion.
+    </p>
+<p>
+      Further, I want to thank Peter Dimov for sharing his insights on language details
+      and their evolution.
+    </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_factory.references"></a><a class="link" href="index.html#boost_functional_factory.references" title="References">References</a>
+</h2></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+          <a href="http://en.wikipedia.org/wiki/Design_Patterns" target="_top">Design Patterns</a>,
+          Gamma et al. - Addison Wesley Publishing, 1995
+        </li>
+<li class="listitem">
+          <a href="http://www.sgi.com/tech/stl/" target="_top">Standard Template Library Programmer's
+          Guide</a>, Hewlett-Packard Company, 1994
+        </li>
+<li class="listitem">
+          <a href="http://www.boost.org/libs/bind/bind.html" target="_top">Boost.Bind</a>,
+          Peter Dimov, 2001-2005
+        </li>
+<li class="listitem">
+          <a href="http://www.boost.org/doc/html/function.html" target="_top">Boost.Function</a>,
+          Douglas Gregor, 2001-2004
+        </li>
+</ol></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: November 01, 2008 at 21:44:52 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
diff --git a/libs/functional/factory/doc/html/standalone_HTML.manifest b/libs/functional/factory/doc/html/standalone_HTML.manifest
new file mode 100644
index 0000000..dcaf716
--- /dev/null
+++ b/libs/functional/factory/doc/html/standalone_HTML.manifest
@@ -0,0 +1 @@
+index.html
diff --git a/libs/functional/factory/index.html b/libs/functional/factory/index.html
new file mode 100644
index 0000000..1803029
--- /dev/null
+++ b/libs/functional/factory/index.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <meta http-equiv="refresh" content="0; URL=doc/html/index.html">
+  </head>
+  <body>
+    Automatic redirection failed, click this 
+    <a href="doc/html/index.html">link</a> &nbsp;<hr>
+    <p>© Copyright Tobias Schwinger, 2009</p>
+    <p>Distributed under the Boost Software License, Version 1.0. (See 
+    accompanying file <a href="../../../LICENSE_1_0.txt">
+    LICENSE_1_0.txt</a> or copy at
+    <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
+  </body>
+</html>
diff --git a/libs/functional/factory/test/Jamfile b/libs/functional/factory/test/Jamfile
new file mode 100644
index 0000000..6c4f6eb
--- /dev/null
+++ b/libs/functional/factory/test/Jamfile
@@ -0,0 +1,18 @@
+
+# (C) Copyright Tobias Schwinger
+#
+# Use modification and distribution are subject to the boost Software License,
+# Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt).
+
+import testing ;
+
+project factory-tests
+    ;
+
+test-suite functional/factory
+    :
+      [ run value_factory.cpp ]
+      [ run factory.cpp ]
+      [ run factory_with_allocator.cpp ]
+    ;
+
diff --git a/libs/functional/factory/test/factory.cpp b/libs/functional/factory/test/factory.cpp
new file mode 100644
index 0000000..4d47f28
--- /dev/null
+++ b/libs/functional/factory/test/factory.cpp
@@ -0,0 +1,36 @@
+/*=============================================================================
+    Copyright (c) 2007 Tobias Schwinger
+  
+    Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/functional/factory.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <memory>
+
+class sum 
+{
+    int val_sum;
+  public:
+    sum(int a, int b) : val_sum(a + b) { }
+
+    operator int() const { return this->val_sum; }
+};
+
+int main()
+{
+    int one = 1, two = 2;
+    {
+      sum* instance( ndnboost::factory< sum* >()(one,two) );
+      BOOST_TEST(*instance == 3);
+    }
+    {
+      std::auto_ptr<sum> instance( ndnboost::factory< std::auto_ptr<sum> >()(one,two) );
+      BOOST_TEST(*instance == 3);
+    }
+    return ndnboost::report_errors();
+}
+
diff --git a/libs/functional/factory/test/factory_with_allocator.cpp b/libs/functional/factory/test/factory_with_allocator.cpp
new file mode 100644
index 0000000..b2c6c99
--- /dev/null
+++ b/libs/functional/factory/test/factory_with_allocator.cpp
@@ -0,0 +1,79 @@
+/*=============================================================================
+    Copyright (c) 2007 Tobias Schwinger
+  
+    Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/functional/factory.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <cstddef>
+#include <memory>
+#include <boost/shared_ptr.hpp>
+
+using std::size_t;
+
+class sum 
+{
+    int val_sum;
+  public:
+    sum(int a, int b) : val_sum(a + b) { }
+
+    operator int() const { return this->val_sum; }
+};
+
+template< typename T >
+class counting_allocator : public std::allocator<T>
+{
+  public:
+    counting_allocator()
+    { }
+
+    template< typename OtherT >
+    struct rebind { typedef counting_allocator<OtherT> other; };
+
+    template< typename OtherT >
+    counting_allocator(counting_allocator<OtherT> const& that)
+    { }
+
+    static size_t n_allocated;
+    T* allocate(size_t n, void const* hint = 0l)
+    {
+        n_allocated += 1;
+        return std::allocator<T>::allocate(n,hint);
+    }
+
+    static size_t n_deallocated;
+    void deallocate(T* ptr, size_t n)
+    {
+        n_deallocated += 1;
+        return std::allocator<T>::deallocate(ptr,n);
+    }
+};
+template< typename T > size_t counting_allocator<T>::n_allocated = 0;
+template< typename T > size_t counting_allocator<T>::n_deallocated = 0;
+
+int main()
+{
+    int one = 1, two = 2;
+    {
+      ndnboost::shared_ptr<sum> instance(
+          ndnboost::factory< ndnboost::shared_ptr<sum>, counting_allocator<void>, 
+              ndnboost::factory_alloc_for_pointee_and_deleter >()(one,two) );
+      BOOST_TEST(*instance == 3);
+    }
+    BOOST_TEST(counting_allocator<sum>::n_allocated == 1); 
+    BOOST_TEST(counting_allocator<sum>::n_deallocated == 1);
+    {
+      ndnboost::shared_ptr<sum> instance(
+          ndnboost::factory< ndnboost::shared_ptr<sum>, counting_allocator<void>,
+              ndnboost::factory_passes_alloc_to_smart_pointer >()(one,two) );
+      BOOST_TEST(*instance == 3);
+    }
+    BOOST_TEST(counting_allocator<sum>::n_allocated == 2); 
+    BOOST_TEST(counting_allocator<sum>::n_deallocated == 2);
+    return ndnboost::report_errors();
+}
+
diff --git a/libs/functional/factory/test/value_factory.cpp b/libs/functional/factory/test/value_factory.cpp
new file mode 100644
index 0000000..5462ffb
--- /dev/null
+++ b/libs/functional/factory/test/value_factory.cpp
@@ -0,0 +1,29 @@
+/*=============================================================================
+    Copyright (c) 2007 Tobias Schwinger
+  
+    Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/functional/value_factory.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+class sum 
+{
+    int val_sum;
+  public:
+    sum(int a, int b) : val_sum(a + b) { }
+    operator int() const { return this->val_sum; }
+};
+
+int main()
+{
+    int one = 1, two = 2;
+    {
+      sum instance( ndnboost::value_factory< sum >()(one,two) );
+      BOOST_TEST(instance == 3);
+    }
+    return ndnboost::report_errors();
+}
+
diff --git a/libs/functional/forward/doc/Jamfile b/libs/functional/forward/doc/Jamfile
new file mode 100644
index 0000000..5665497
--- /dev/null
+++ b/libs/functional/forward/doc/Jamfile
@@ -0,0 +1,19 @@
+
+# (C) Copyright Tobias Schwinger
+#
+# Use modification and distribution are subject to the boost Software License,
+# Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt).
+
+using quickbook ;
+
+xml forward : forward.qbk ;
+boostbook standalone : forward
+  :
+        <xsl:param>boost.root=../../../../..
+        <xsl:param>boost.libraries=../../../../libraries.htm
+        <xsl:param>chunk.section.depth=0
+        <xsl:param>chunk.first.sections=0
+        <xsl:param>generate.section.toc.level=2
+        <xsl:param>toc.max.depth=1
+  ;
+
diff --git a/libs/functional/forward/doc/forward.qbk b/libs/functional/forward/doc/forward.qbk
new file mode 100644
index 0000000..4eb227d
--- /dev/null
+++ b/libs/functional/forward/doc/forward.qbk
@@ -0,0 +1,316 @@
+[library Boost.Functional/Forward
+  [quickbook 1.3]
+  [version 1.0]
+  [authors [Schwinger, Tobias]]
+  [copyright 2007 2008 Tobias Schwinger]
+  [license
+        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])
+  ]
+  [purpose Function object adapters for generic argument forwarding.]
+  [category higher-order]
+  [category generic]
+  [last-revision $Date: 2008/11/01 19:58:50 $]
+]
+
+[def __unspecified__            /unspecified/]
+[def __boost_ref__              [@http://www.boost.org/doc/html/ref.html Boost.Ref]]
+[def __boost_result_of__        [@http://www.boost.org/libs/utility/utility.htm#result_of Boost.ResultOf]]
+[def __boost__result_of__       [@http://www.boost.org/libs/utility/utility.htm#result_of `boost::result_of`]]
+[def __the_forwarding_problem__ [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm The Forwarding Problem]]
+[def __boost_fusion__           [@http://www.boost.org/libs/fusion/doc/html/index.html Boost.Fusion]]
+
+[section Brief Description]
+
+`boost::forward_adapter` provides a reusable adapter template for function
+objects. It forwards RValues as references to const, while leaving LValues
+as-is.
+
+    struct g // function object that only accept LValues
+    {
+        template< typename T0, typename T1, typename T2 >
+        void operator()(T0 & t0, T1 & t1, T2 & t2) const;
+
+        typedef void result_type;
+    };
+
+    // Adapted version also accepts RValues and forwards
+    // them as references to const, LValues as-is
+    typedef boost::forward_adapter<g> f;
+
+Another adapter, `boost::lighweight_forward_adapter` allows forwarding with 
+some help from the user accepting and unwrapping reference wrappers (see 
+__boost_ref__) for reference arguments, const qualifying all other arguments. 
+
+The target functions must be compatible with __boost_result_of__, and so are
+the adapters.
+
+[endsect]
+
+[section Background]
+
+Let's suppose we have some function `f` that we can call like this:
+
+    f(123,a_variable);
+
+Now we want to write another, generic function `g` that can be called the
+same way and returns some object that calls `f` with the same arguments.
+
+    f(123,a_variable) == g(f,123,a_variable).call_f()
+
+[heading Why would we want to do it, anyway?]
+
+Maybe we want to run `f` several times. Or maybe we want to run it within
+another thread. Maybe we just want to encapsulate the call expression for now, 
+and then use it with other code that allows to compose more complex expressions
+in order to decompose it with C++ templates and have the compiler generate some 
+machinery that eventually calls `f` at runtime (in other words; apply a
+technique that is commonly referred to as Expression Templates). 
+
+[heading Now, how do we do it?]
+
+The bad news is: It's impossible. 
+
+That is so because there is a slight difference between a variable and an
+expression that evaluates to its value: Given
+
+    int y;
+    int const z = 0;
+
+and
+
+    template< typename T > void func1(T & x);
+
+we can call
+
+    func1(y); // x is a reference to a non-const object
+    func1(z); // x is a reference to a const object
+
+where
+
+    func1(1); // fails to compile.
+
+This way we can safely have `func1` store its reference argument and the 
+compiler keeps us from storing a reference to an object with temporary lifetime.
+
+It is important to realize that non-constness and whether an object binds to a
+non-const reference parameter are two different properties. The latter is the
+distinction between LValues and RValues. The names stem from the left hand side
+and the right hand side of assignment expressions, thus LValues are typically
+the ones you can assign to, and RValues the temporary results from the right
+hand side expression. 
+
+    y = 1+2;        // a is LValue, 1+2 is the expression producing the RValue,
+    // 1+2 = a;     // usually makes no sense. 
+
+    func1(y);       // works, because y is an LValue
+    // func1(1+2);  // fails to compile, because we only got an RValue.
+
+If we add const qualification on the parameter, our function also accepts
+RValues: 
+
+    template< typename T > void func2(T const & x);
+
+    // [...] function scope:
+    func2(1); // x is a reference to a const temporary, object,
+    func2(y); // x is a reference to a const object, while y is not const, and
+    func2(z); // x is a reference to a const object, just like z.
+
+In all cases, the argument `x` in `func2` is a const-qualified LValue.
+We can use function overloading to identify non-const LValues:
+
+    template< typename T > void func3(T const & x); // #1
+    template< typename T > void func3(T & x);       // #2
+
+    // [...] function scope:
+    func3(1); // x is a reference to a const, temporary object in #1,
+    func3(y); // x is a reference to a non-const object in #2, and
+    func3(z); // x is a reference to a const object in #1.
+
+Note that all arguments `x` in the overloaded function `func3` are LValues.
+In fact, there is no way to transport RValues into a function as-is in C++98.
+Also note that we can't distinguish between what used to be a const qualified
+LValue and an RValue. 
+
+That's as close as we can get to a generic forwarding function `g` as
+described above by the means of C++ 98. See __the_forwarding_problem__ for a
+very detailed discussion including solutions that require language changes.
+
+Now, for actually implementing it, we need 2^N overloads for N parameters
+(each with and without const qualifier) for each number of arguments 
+(that is 2^(Nmax+1) - 2^Nmin). Right, that means the compile-time complexity 
+is O(2^N), however the factor is low so it works quite well for a reasonable
+number (< 10) of arguments.
+
+[endsect]
+
+[section:reference Reference]
+
+[section forward_adapter]
+
+[heading Description]
+
+Function object adapter template whose instances are callable with LValue and
+RValue arguments. RValue arguments are forwarded as reference-to-const typed
+LValues.
+
+An arity can be given as second, numeric non-type template argument to restrict
+forwarding to a specific arity.
+If a third, numeric non-type template argument is present, the second and third 
+template argument are treated as minimum and maximum arity, respectively.
+Specifying an arity can be helpful to improve the readability of diagnostic
+messages and compile time performance.
+
+__boost_result_of__ can be used to determine the result types of specific call
+expressions.
+
+[heading Header]
+    #include <boost/functional/forward_adapter.hpp>
+
+[heading Synopsis]
+
+    namespace boost
+    {
+        template< class Function,
+            int Arity_Or_MinArity = __unspecified__, int MaxArity = __unspecified__ >
+        class forward_adapter;
+    }
+
+[variablelist Notation
+    [[`F`]            [a possibly const qualified function object type or reference type thereof]]
+    [[`f`]            [an object convertible to `F`]]
+    [[`FA`]           [the type `forward_adapter<F>`]]
+    [[`fa`]           [an instance object of `FA`, initialized with `f`]]
+    [[`a0`...`aN`]    [arguments to `fa`]]
+]
+
+The result type of a target function invocation must be
+
+  __boost__result_of__<F*(TA0 [const]&...TAN [const]&])>::type
+
+where `TA0`...`TAN` denote the argument types of `a0`...`aN`.
+
+[heading Expression Semantics]
+
+[table
+    [[Expression]      [Semantics]]
+    [[`FA(f)`]         [creates an adapter, initializes the target function with `f`.]]
+    [[`FA()`]          [creates an adapter, attempts to use `F`'s default constructor.]]
+    [[`fa(a0`...`aN)`] [calls `f` with with arguments `a0`...`aN`.]]
+]
+
+[heading Limits]
+
+The macro BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY can be defined to set the
+maximum call arity. It defaults to 6.
+
+[heading Complexity]
+
+Preprocessing time: O(2^N), where N is the arity limit.
+Compile time: O(2^N), where N depends on the arity range.
+Run time: O(0) if the compiler inlines, O(1) otherwise.
+
+[endsect]
+
+
+[section lightweight_forward_adapter]
+
+[heading Description]
+
+Function object adapter template whose instances are callable with LValue and
+RValue arguments. All arguments are forwarded as reference-to-const typed
+LValues, except for reference wrappers which are unwrapped and may yield
+non-const LValues.
+
+An arity can be given as second, numeric non-type template argument to restrict
+forwarding to a specific arity.
+If a third, numeric non-type template argument is present, the second and third 
+template argument are treated as minimum and maximum arity, respectively.
+Specifying an arity can be helpful to improve the readability of diagnostic
+messages and compile time performance.
+
+__boost_result_of__ can be used to determine the result types of specific call
+expressions.
+
+[heading Header]
+    #include <boost/functional/lightweight_forward_adapter.hpp>
+
+[heading Synopsis]
+
+    namespace boost
+    {
+        template< class Function,
+            int Arity_Or_MinArity = __unspecified__, int MaxArity = __unspecified__ >
+        struct lightweight_forward_adapter;
+    }
+
+[variablelist Notation
+    [[`F`]         [a possibly const qualified function object type or reference type thereof]]
+    [[`f`]         [an object convertible to `F`]]
+    [[`FA`]        [the type `lightweight_forward_adapter<F>`]]
+    [[`fa`]        [an instance of `FA`, initialized with `f`]]
+    [[`a0`...`aN`] [arguments to `fa`]]
+]
+
+The result type of a target function invocation must be
+
+  __boost__result_of__<F*(TA0 [const]&...TAN [const]&])>::type
+
+where `TA0`...`TAN` denote the argument types of `a0`...`aN`.
+
+[heading Expression Semantics]
+
+[table
+    [[Expression]      [Semantics]]
+    [[`FA(f)`]         [creates an adapter, initializes the target function with `f`.]]
+    [[`FA()`]          [creates an adapter, attempts to use `F`'s default constructor.]]
+    [[`fa(a0`...`aN)`] [calls `f` with with const arguments `a0`...`aN`. If `aI` is a 
+      reference wrapper it is unwrapped.]]
+]
+
+[heading Limits]
+
+The macro BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY can be defined
+to set the maximum call arity. It defaults to 10.
+
+[heading Complexity]
+
+Preprocessing time: O(N), where N is the arity limit.
+Compile time: O(N), where N is the effective arity of a call.
+Run time: O(0) if the compiler inlines, O(1) otherwise.
+
+[endsect]
+
+[endsect]
+
+
+[section Acknowledgements]
+
+As these utilities are factored out of the __boost_fusion__ functional module, 
+I want to thank Dan Marsden and Joel de Guzman for letting me participate in the
+development of that great library in the first place.
+
+Further, I want to credit the authors of the references below, for their
+in-depth investigation of the problem and the solution implemented here.
+
+Last but not least I want to thank Vesa Karnoven and Paul Mensonides for the
+Boost Preprocessor library. Without it, I would have ended up with an external
+code generator for this one.
+
+[endsect]
+
+
+[section References]
+
+# [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm The Forwarding Problem],
+  Peter Dimov, Howard E. Hinnant, David Abrahams, 2002
+
+# [@http://www.boost.org/libs/utility/utility.htm#result_of Boost.ResultOf],
+  Douglas Gregor, 2004
+
+# [@http://www.boost.org/doc/html/ref.html Boost.Ref], 
+  Jaakko Jarvi, Peter Dimov, Douglas Gregor, David Abrahams, 1999-2002
+
+[endsect]
+
diff --git a/libs/functional/forward/doc/html/index.html b/libs/functional/forward/doc/html/index.html
new file mode 100644
index 0000000..49d52b0
--- /dev/null
+++ b/libs/functional/forward/doc/html/index.html
@@ -0,0 +1,571 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Chapter&#160;1.&#160;Boost.Functional/Forward 1.0</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.Functional/Forward 1.0">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+<div class="chapter">
+<div class="titlepage"><div>
+<div><h2 class="title">
+<a name="boost_functional_forward"></a>Chapter&#160;1.&#160;Boost.Functional/Forward 1.0</h2></div>
+<div><div class="author"><h3 class="author">
+<span class="firstname">Tobias</span> <span class="surname">Schwinger</span>
+</h3></div></div>
+<div><p class="copyright">Copyright &#169; 2007, 2008 Tobias Schwinger</p></div>
+<div><div class="legalnotice">
+<a name="boost_functional_forward.legal"></a><p>
+        Distributed under the Boost Software License, Version 1.0. (See accompanying
+        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>)
+      </p>
+</div></div>
+</div></div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl class="toc">
+<dt><span class="section"><a href="index.html#boost_functional_forward.brief_description">Brief Description</a></span></dt>
+<dt><span class="section"><a href="index.html#boost_functional_forward.background">Background</a></span></dt>
+<dt><span class="section"><a href="index.html#boost_functional_forward.reference">Reference</a></span></dt>
+<dt><span class="section"><a href="index.html#boost_functional_forward.acknowledgements">Acknowledgements</a></span></dt>
+<dt><span class="section"><a href="index.html#boost_functional_forward.references">References</a></span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_forward.brief_description"></a><a class="link" href="index.html#boost_functional_forward.brief_description" title="Brief Description">Brief Description</a>
+</h2></div></div></div>
+<p>
+      <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">forward_adapter</span></code> provides a reusable adapter
+      template for function objects. It forwards RValues as references to const,
+      while leaving LValues as-is.
+    </p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">g</span> <span class="comment">// function object that only accept LValues</span>
+<span class="special">{</span>
+    <span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">T0</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span> <span class="special">&gt;</span>
+    <span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">T0</span> <span class="special">&amp;</span> <span class="identifier">t0</span><span class="special">,</span> <span class="identifier">T1</span> <span class="special">&amp;</span> <span class="identifier">t1</span><span class="special">,</span> <span class="identifier">T2</span> <span class="special">&amp;</span> <span class="identifier">t2</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+
+    <span class="keyword">typedef</span> <span class="keyword">void</span> <span class="identifier">result_type</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="comment">// Adapted version also accepts RValues and forwards</span>
+<span class="comment">// them as references to const, LValues as-is</span>
+<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">forward_adapter</span><span class="special">&lt;</span><span class="identifier">g</span><span class="special">&gt;</span> <span class="identifier">f</span><span class="special">;</span>
+</pre>
+<p>
+      Another adapter, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">lighweight_forward_adapter</span></code> allows forwarding
+      with some help from the user accepting and unwrapping reference wrappers (see
+      <a href="http://www.boost.org/doc/html/ref.html" target="_top">Boost.Ref</a>) for
+      reference arguments, const qualifying all other arguments.
+    </p>
+<p>
+      The target functions must be compatible with <a href="http://www.boost.org/libs/utility/utility.htm#result_of" target="_top">Boost.ResultOf</a>,
+      and so are the adapters.
+    </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_forward.background"></a><a class="link" href="index.html#boost_functional_forward.background" title="Background">Background</a>
+</h2></div></div></div>
+<p>
+      Let's suppose we have some function <code class="computeroutput"><span class="identifier">f</span></code>
+      that we can call like this:
+    </p>
+<pre class="programlisting"><span class="identifier">f</span><span class="special">(</span><span class="number">123</span><span class="special">,</span><span class="identifier">a_variable</span><span class="special">);</span>
+</pre>
+<p>
+      Now we want to write another, generic function <code class="computeroutput"><span class="identifier">g</span></code>
+      that can be called the same way and returns some object that calls <code class="computeroutput"><span class="identifier">f</span></code> with the same arguments.
+    </p>
+<pre class="programlisting"><span class="identifier">f</span><span class="special">(</span><span class="number">123</span><span class="special">,</span><span class="identifier">a_variable</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">g</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span><span class="number">123</span><span class="special">,</span><span class="identifier">a_variable</span><span class="special">).</span><span class="identifier">call_f</span><span class="special">()</span>
+</pre>
+<h4>
+<a name="boost_functional_forward.background.h0"></a>
+      <span class="phrase"><a name="boost_functional_forward.background.why_would_we_want_to_do_it__anyway_"></a></span><a class="link" href="index.html#boost_functional_forward.background.why_would_we_want_to_do_it__anyway_">Why
+      would we want to do it, anyway?</a>
+    </h4>
+<p>
+      Maybe we want to run <code class="computeroutput"><span class="identifier">f</span></code> several
+      times. Or maybe we want to run it within another thread. Maybe we just want
+      to encapsulate the call expression for now, and then use it with other code
+      that allows to compose more complex expressions in order to decompose it with
+      C++ templates and have the compiler generate some machinery that eventually
+      calls <code class="computeroutput"><span class="identifier">f</span></code> at runtime (in other
+      words; apply a technique that is commonly referred to as Expression Templates).
+    </p>
+<h4>
+<a name="boost_functional_forward.background.h1"></a>
+      <span class="phrase"><a name="boost_functional_forward.background.now__how_do_we_do_it_"></a></span><a class="link" href="index.html#boost_functional_forward.background.now__how_do_we_do_it_">Now, how
+      do we do it?</a>
+    </h4>
+<p>
+      The bad news is: It's impossible.
+    </p>
+<p>
+      That is so because there is a slight difference between a variable and an expression
+      that evaluates to its value: Given
+    </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">y</span><span class="special">;</span>
+<span class="keyword">int</span> <span class="keyword">const</span> <span class="identifier">z</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+</pre>
+<p>
+      and
+    </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="keyword">void</span> <span class="identifier">func1</span><span class="special">(</span><span class="identifier">T</span> <span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+</pre>
+<p>
+      we can call
+    </p>
+<pre class="programlisting"><span class="identifier">func1</span><span class="special">(</span><span class="identifier">y</span><span class="special">);</span> <span class="comment">// x is a reference to a non-const object</span>
+<span class="identifier">func1</span><span class="special">(</span><span class="identifier">z</span><span class="special">);</span> <span class="comment">// x is a reference to a const object</span>
+</pre>
+<p>
+      where
+    </p>
+<pre class="programlisting"><span class="identifier">func1</span><span class="special">(</span><span class="number">1</span><span class="special">);</span> <span class="comment">// fails to compile.</span>
+</pre>
+<p>
+      This way we can safely have <code class="computeroutput"><span class="identifier">func1</span></code>
+      store its reference argument and the compiler keeps us from storing a reference
+      to an object with temporary lifetime.
+    </p>
+<p>
+      It is important to realize that non-constness and whether an object binds to
+      a non-const reference parameter are two different properties. The latter is
+      the distinction between LValues and RValues. The names stem from the left hand
+      side and the right hand side of assignment expressions, thus LValues are typically
+      the ones you can assign to, and RValues the temporary results from the right
+      hand side expression.
+    </p>
+<pre class="programlisting"><span class="identifier">y</span> <span class="special">=</span> <span class="number">1</span><span class="special">+</span><span class="number">2</span><span class="special">;</span>        <span class="comment">// a is LValue, 1+2 is the expression producing the RValue,</span>
+<span class="comment">// 1+2 = a;     // usually makes no sense. </span>
+
+<span class="identifier">func1</span><span class="special">(</span><span class="identifier">y</span><span class="special">);</span>       <span class="comment">// works, because y is an LValue</span>
+<span class="comment">// func1(1+2);  // fails to compile, because we only got an RValue.</span>
+</pre>
+<p>
+      If we add const qualification on the parameter, our function also accepts RValues:
+    </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="keyword">void</span> <span class="identifier">func2</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>
+
+<span class="comment">// [...] function scope:</span>
+<span class="identifier">func2</span><span class="special">(</span><span class="number">1</span><span class="special">);</span> <span class="comment">// x is a reference to a const temporary, object,</span>
+<span class="identifier">func2</span><span class="special">(</span><span class="identifier">y</span><span class="special">);</span> <span class="comment">// x is a reference to a const object, while y is not const, and</span>
+<span class="identifier">func2</span><span class="special">(</span><span class="identifier">z</span><span class="special">);</span> <span class="comment">// x is a reference to a const object, just like z.</span>
+</pre>
+<p>
+      In all cases, the argument <code class="computeroutput"><span class="identifier">x</span></code>
+      in <code class="computeroutput"><span class="identifier">func2</span></code> is a const-qualified
+      LValue. We can use function overloading to identify non-const LValues:
+    </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="keyword">void</span> <span class="identifier">func3</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span> <span class="comment">// #1</span>
+<span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="keyword">void</span> <span class="identifier">func3</span><span class="special">(</span><span class="identifier">T</span> <span class="special">&amp;</span> <span class="identifier">x</span><span class="special">);</span>       <span class="comment">// #2</span>
+
+<span class="comment">// [...] function scope:</span>
+<span class="identifier">func3</span><span class="special">(</span><span class="number">1</span><span class="special">);</span> <span class="comment">// x is a reference to a const, temporary object in #1,</span>
+<span class="identifier">func3</span><span class="special">(</span><span class="identifier">y</span><span class="special">);</span> <span class="comment">// x is a reference to a non-const object in #2, and</span>
+<span class="identifier">func3</span><span class="special">(</span><span class="identifier">z</span><span class="special">);</span> <span class="comment">// x is a reference to a const object in #1.</span>
+</pre>
+<p>
+      Note that all arguments <code class="computeroutput"><span class="identifier">x</span></code> in
+      the overloaded function <code class="computeroutput"><span class="identifier">func3</span></code>
+      are LValues. In fact, there is no way to transport RValues into a function
+      as-is in C++98. Also note that we can't distinguish between what used to be
+      a const qualified LValue and an RValue.
+    </p>
+<p>
+      That's as close as we can get to a generic forwarding function <code class="computeroutput"><span class="identifier">g</span></code> as described above by the means of C++
+      98. See <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm" target="_top">The
+      Forwarding Problem</a> for a very detailed discussion including solutions
+      that require language changes.
+    </p>
+<p>
+      Now, for actually implementing it, we need 2^N overloads for N parameters (each
+      with and without const qualifier) for each number of arguments (that is 2^(Nmax+1)
+      - 2^Nmin). Right, that means the compile-time complexity is O(2^N), however
+      the factor is low so it works quite well for a reasonable number (&lt; 10)
+      of arguments.
+    </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_forward.reference"></a><a class="link" href="index.html#boost_functional_forward.reference" title="Reference">Reference</a>
+</h2></div></div></div>
+<div class="toc"><dl class="toc">
+<dt><span class="section"><a href="index.html#boost_functional_forward.reference.forward_adapter">forward_adapter</a></span></dt>
+<dt><span class="section"><a href="index.html#boost_functional_forward.reference.lightweight_forward_adapter">lightweight_forward_adapter</a></span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_functional_forward.reference.forward_adapter"></a><a class="link" href="index.html#boost_functional_forward.reference.forward_adapter" title="forward_adapter">forward_adapter</a>
+</h3></div></div></div>
+<h5>
+<a name="boost_functional_forward.reference.forward_adapter.h0"></a>
+        <span class="phrase"><a name="boost_functional_forward.reference.forward_adapter.description"></a></span><a class="link" href="index.html#boost_functional_forward.reference.forward_adapter.description">Description</a>
+      </h5>
+<p>
+        Function object adapter template whose instances are callable with LValue
+        and RValue arguments. RValue arguments are forwarded as reference-to-const
+        typed LValues.
+      </p>
+<p>
+        An arity can be given as second, numeric non-type template argument to restrict
+        forwarding to a specific arity. If a third, numeric non-type template argument
+        is present, the second and third template argument are treated as minimum
+        and maximum arity, respectively. Specifying an arity can be helpful to improve
+        the readability of diagnostic messages and compile time performance.
+      </p>
+<p>
+        <a href="http://www.boost.org/libs/utility/utility.htm#result_of" target="_top">Boost.ResultOf</a>
+        can be used to determine the result types of specific call expressions.
+      </p>
+<h5>
+<a name="boost_functional_forward.reference.forward_adapter.h1"></a>
+        <span class="phrase"><a name="boost_functional_forward.reference.forward_adapter.header"></a></span><a class="link" href="index.html#boost_functional_forward.reference.forward_adapter.header">Header</a>
+      </h5>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">functional</span><span class="special">/</span><span class="identifier">forward_adapter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+</pre>
+<h5>
+<a name="boost_functional_forward.reference.forward_adapter.h2"></a>
+        <span class="phrase"><a name="boost_functional_forward.reference.forward_adapter.synopsis"></a></span><a class="link" href="index.html#boost_functional_forward.reference.forward_adapter.synopsis">Synopsis</a>
+      </h5>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
+<span class="special">{</span>
+    <span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">Function</span><span class="special">,</span>
+        <span class="keyword">int</span> <span class="identifier">Arity_Or_MinArity</span> <span class="special">=</span> <span class="emphasis"><em>unspecified</em></span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">MaxArity</span> <span class="special">=</span> <span class="emphasis"><em>unspecified</em></span> <span class="special">&gt;</span>
+    <span class="keyword">class</span> <span class="identifier">forward_adapter</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<div class="variablelist">
+<p class="title"><b>Notation</b></p>
+<dl class="variablelist">
+<dt><span class="term"><code class="computeroutput"><span class="identifier">F</span></code></span></dt>
+<dd><p>
+              a possibly const qualified function object type or reference type thereof
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">f</span></code></span></dt>
+<dd><p>
+              an object convertible to <code class="computeroutput"><span class="identifier">F</span></code>
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">FA</span></code></span></dt>
+<dd><p>
+              the type <code class="computeroutput"><span class="identifier">forward_adapter</span><span class="special">&lt;</span><span class="identifier">F</span><span class="special">&gt;</span></code>
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">fa</span></code></span></dt>
+<dd><p>
+              an instance object of <code class="computeroutput"><span class="identifier">FA</span></code>,
+              initialized with <code class="computeroutput"><span class="identifier">f</span></code>
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code></span></dt>
+<dd><p>
+              arguments to <code class="computeroutput"><span class="identifier">fa</span></code>
+            </p></dd>
+</dl>
+</div>
+<p>
+        The result type of a target function invocation must be
+      </p>
+<pre class="programlisting"><a href="http://www.boost.org/libs/utility/utility.htm#result_of" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span></code></a><span class="special">&lt;</span><span class="identifier">F</span><span class="special">*(</span><span class="identifier">TA0</span> <span class="special">[</span><span class="keyword">const</span><span class="special">]&amp;...</span><span class="identifier">TAN</span> <span class="special">[</span><span class="keyword">const</span><span class="special">]&amp;])&gt;::</span><span class="identifier">type</span>
+</pre>
+<p>
+        where <code class="computeroutput"><span class="identifier">TA0</span></code>...<code class="computeroutput"><span class="identifier">TAN</span></code> denote the argument types of <code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code>.
+      </p>
+<h5>
+<a name="boost_functional_forward.reference.forward_adapter.h3"></a>
+        <span class="phrase"><a name="boost_functional_forward.reference.forward_adapter.expression_semantics"></a></span><a class="link" href="index.html#boost_functional_forward.reference.forward_adapter.expression_semantics">Expression
+        Semantics</a>
+      </h5>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+                <p>
+                  Expression
+                </p>
+              </th>
+<th>
+                <p>
+                  Semantics
+                </p>
+              </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">FA</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  creates an adapter, initializes the target function with <code class="computeroutput"><span class="identifier">f</span></code>.
+                </p>
+              </td>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">FA</span><span class="special">()</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  creates an adapter, attempts to use <code class="computeroutput"><span class="identifier">F</span></code>'s
+                  default constructor.
+                </p>
+              </td>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">fa</span><span class="special">(</span><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span><span class="special">)</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  calls <code class="computeroutput"><span class="identifier">f</span></code> with with
+                  arguments <code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code>.
+                </p>
+              </td>
+</tr>
+</tbody>
+</table></div>
+<h5>
+<a name="boost_functional_forward.reference.forward_adapter.h4"></a>
+        <span class="phrase"><a name="boost_functional_forward.reference.forward_adapter.limits"></a></span><a class="link" href="index.html#boost_functional_forward.reference.forward_adapter.limits">Limits</a>
+      </h5>
+<p>
+        The macro BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY can be defined to set
+        the maximum call arity. It defaults to 6.
+      </p>
+<h5>
+<a name="boost_functional_forward.reference.forward_adapter.h5"></a>
+        <span class="phrase"><a name="boost_functional_forward.reference.forward_adapter.complexity"></a></span><a class="link" href="index.html#boost_functional_forward.reference.forward_adapter.complexity">Complexity</a>
+      </h5>
+<p>
+        Preprocessing time: O(2^N), where N is the arity limit. Compile time: O(2^N),
+        where N depends on the arity range. Run time: O(0) if the compiler inlines,
+        O(1) otherwise.
+      </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_functional_forward.reference.lightweight_forward_adapter"></a><a class="link" href="index.html#boost_functional_forward.reference.lightweight_forward_adapter" title="lightweight_forward_adapter">lightweight_forward_adapter</a>
+</h3></div></div></div>
+<h5>
+<a name="boost_functional_forward.reference.lightweight_forward_adapter.h0"></a>
+        <span class="phrase"><a name="boost_functional_forward.reference.lightweight_forward_adapter.description"></a></span><a class="link" href="index.html#boost_functional_forward.reference.lightweight_forward_adapter.description">Description</a>
+      </h5>
+<p>
+        Function object adapter template whose instances are callable with LValue
+        and RValue arguments. All arguments are forwarded as reference-to-const typed
+        LValues, except for reference wrappers which are unwrapped and may yield
+        non-const LValues.
+      </p>
+<p>
+        An arity can be given as second, numeric non-type template argument to restrict
+        forwarding to a specific arity. If a third, numeric non-type template argument
+        is present, the second and third template argument are treated as minimum
+        and maximum arity, respectively. Specifying an arity can be helpful to improve
+        the readability of diagnostic messages and compile time performance.
+      </p>
+<p>
+        <a href="http://www.boost.org/libs/utility/utility.htm#result_of" target="_top">Boost.ResultOf</a>
+        can be used to determine the result types of specific call expressions.
+      </p>
+<h5>
+<a name="boost_functional_forward.reference.lightweight_forward_adapter.h1"></a>
+        <span class="phrase"><a name="boost_functional_forward.reference.lightweight_forward_adapter.header"></a></span><a class="link" href="index.html#boost_functional_forward.reference.lightweight_forward_adapter.header">Header</a>
+      </h5>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">functional</span><span class="special">/</span><span class="identifier">lightweight_forward_adapter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
+</pre>
+<h5>
+<a name="boost_functional_forward.reference.lightweight_forward_adapter.h2"></a>
+        <span class="phrase"><a name="boost_functional_forward.reference.lightweight_forward_adapter.synopsis"></a></span><a class="link" href="index.html#boost_functional_forward.reference.lightweight_forward_adapter.synopsis">Synopsis</a>
+      </h5>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
+<span class="special">{</span>
+    <span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">Function</span><span class="special">,</span>
+        <span class="keyword">int</span> <span class="identifier">Arity_Or_MinArity</span> <span class="special">=</span> <span class="emphasis"><em>unspecified</em></span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">MaxArity</span> <span class="special">=</span> <span class="emphasis"><em>unspecified</em></span> <span class="special">&gt;</span>
+    <span class="keyword">struct</span> <span class="identifier">lightweight_forward_adapter</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<div class="variablelist">
+<p class="title"><b>Notation</b></p>
+<dl class="variablelist">
+<dt><span class="term"><code class="computeroutput"><span class="identifier">F</span></code></span></dt>
+<dd><p>
+              a possibly const qualified function object type or reference type thereof
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">f</span></code></span></dt>
+<dd><p>
+              an object convertible to <code class="computeroutput"><span class="identifier">F</span></code>
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">FA</span></code></span></dt>
+<dd><p>
+              the type <code class="computeroutput"><span class="identifier">lightweight_forward_adapter</span><span class="special">&lt;</span><span class="identifier">F</span><span class="special">&gt;</span></code>
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">fa</span></code></span></dt>
+<dd><p>
+              an instance of <code class="computeroutput"><span class="identifier">FA</span></code>,
+              initialized with <code class="computeroutput"><span class="identifier">f</span></code>
+            </p></dd>
+<dt><span class="term"><code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code></span></dt>
+<dd><p>
+              arguments to <code class="computeroutput"><span class="identifier">fa</span></code>
+            </p></dd>
+</dl>
+</div>
+<p>
+        The result type of a target function invocation must be
+      </p>
+<pre class="programlisting"><a href="http://www.boost.org/libs/utility/utility.htm#result_of" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">result_of</span></code></a><span class="special">&lt;</span><span class="identifier">F</span><span class="special">*(</span><span class="identifier">TA0</span> <span class="special">[</span><span class="keyword">const</span><span class="special">]&amp;...</span><span class="identifier">TAN</span> <span class="special">[</span><span class="keyword">const</span><span class="special">]&amp;])&gt;::</span><span class="identifier">type</span>
+</pre>
+<p>
+        where <code class="computeroutput"><span class="identifier">TA0</span></code>...<code class="computeroutput"><span class="identifier">TAN</span></code> denote the argument types of <code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code>.
+      </p>
+<h5>
+<a name="boost_functional_forward.reference.lightweight_forward_adapter.h3"></a>
+        <span class="phrase"><a name="boost_functional_forward.reference.lightweight_forward_adapter.expression_semantics"></a></span><a class="link" href="index.html#boost_functional_forward.reference.lightweight_forward_adapter.expression_semantics">Expression
+        Semantics</a>
+      </h5>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+                <p>
+                  Expression
+                </p>
+              </th>
+<th>
+                <p>
+                  Semantics
+                </p>
+              </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">FA</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  creates an adapter, initializes the target function with <code class="computeroutput"><span class="identifier">f</span></code>.
+                </p>
+              </td>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">FA</span><span class="special">()</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  creates an adapter, attempts to use <code class="computeroutput"><span class="identifier">F</span></code>'s
+                  default constructor.
+                </p>
+              </td>
+</tr>
+<tr>
+<td>
+                <p>
+                  <code class="computeroutput"><span class="identifier">fa</span><span class="special">(</span><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span><span class="special">)</span></code>
+                </p>
+              </td>
+<td>
+                <p>
+                  calls <code class="computeroutput"><span class="identifier">f</span></code> with with
+                  const arguments <code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code>. If <code class="computeroutput"><span class="identifier">aI</span></code>
+                  is a reference wrapper it is unwrapped.
+                </p>
+              </td>
+</tr>
+</tbody>
+</table></div>
+<h5>
+<a name="boost_functional_forward.reference.lightweight_forward_adapter.h4"></a>
+        <span class="phrase"><a name="boost_functional_forward.reference.lightweight_forward_adapter.limits"></a></span><a class="link" href="index.html#boost_functional_forward.reference.lightweight_forward_adapter.limits">Limits</a>
+      </h5>
+<p>
+        The macro BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY can be defined
+        to set the maximum call arity. It defaults to 10.
+      </p>
+<h5>
+<a name="boost_functional_forward.reference.lightweight_forward_adapter.h5"></a>
+        <span class="phrase"><a name="boost_functional_forward.reference.lightweight_forward_adapter.complexity"></a></span><a class="link" href="index.html#boost_functional_forward.reference.lightweight_forward_adapter.complexity">Complexity</a>
+      </h5>
+<p>
+        Preprocessing time: O(N), where N is the arity limit. Compile time: O(N),
+        where N is the effective arity of a call. Run time: O(0) if the compiler
+        inlines, O(1) otherwise.
+      </p>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_forward.acknowledgements"></a><a class="link" href="index.html#boost_functional_forward.acknowledgements" title="Acknowledgements">Acknowledgements</a>
+</h2></div></div></div>
+<p>
+      As these utilities are factored out of the <a href="http://www.boost.org/libs/fusion/doc/html/index.html" target="_top">Boost.Fusion</a>
+      functional module, I want to thank Dan Marsden and Joel de Guzman for letting
+      me participate in the development of that great library in the first place.
+    </p>
+<p>
+      Further, I want to credit the authors of the references below, for their in-depth
+      investigation of the problem and the solution implemented here.
+    </p>
+<p>
+      Last but not least I want to thank Vesa Karnoven and Paul Mensonides for the
+      Boost Preprocessor library. Without it, I would have ended up with an external
+      code generator for this one.
+    </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_forward.references"></a><a class="link" href="index.html#boost_functional_forward.references" title="References">References</a>
+</h2></div></div></div>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+          <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm" target="_top">The
+          Forwarding Problem</a>, Peter Dimov, Howard E. Hinnant, David Abrahams,
+          2002
+        </li>
+<li class="listitem">
+          <a href="http://www.boost.org/libs/utility/utility.htm#result_of" target="_top">Boost.ResultOf</a>,
+          Douglas Gregor, 2004
+        </li>
+<li class="listitem">
+          <a href="http://www.boost.org/doc/html/ref.html" target="_top">Boost.Ref</a>,
+          Jaakko Jarvi, Peter Dimov, Douglas Gregor, David Abrahams, 1999-2002
+        </li>
+</ol></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: November 01, 2008 at 19:58:50 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
diff --git a/libs/functional/forward/doc/html/standalone_HTML.manifest b/libs/functional/forward/doc/html/standalone_HTML.manifest
new file mode 100644
index 0000000..dcaf716
--- /dev/null
+++ b/libs/functional/forward/doc/html/standalone_HTML.manifest
@@ -0,0 +1 @@
+index.html
diff --git a/libs/functional/forward/index.html b/libs/functional/forward/index.html
new file mode 100644
index 0000000..1803029
--- /dev/null
+++ b/libs/functional/forward/index.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <meta http-equiv="refresh" content="0; URL=doc/html/index.html">
+  </head>
+  <body>
+    Automatic redirection failed, click this 
+    <a href="doc/html/index.html">link</a> &nbsp;<hr>
+    <p>© Copyright Tobias Schwinger, 2009</p>
+    <p>Distributed under the Boost Software License, Version 1.0. (See 
+    accompanying file <a href="../../../LICENSE_1_0.txt">
+    LICENSE_1_0.txt</a> or copy at
+    <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
+  </body>
+</html>
diff --git a/libs/functional/forward/test/Jamfile b/libs/functional/forward/test/Jamfile
new file mode 100644
index 0000000..9169456
--- /dev/null
+++ b/libs/functional/forward/test/Jamfile
@@ -0,0 +1,17 @@
+
+# (C) Copyright Tobias Schwinger
+#
+# Use modification and distribution are subject to the boost Software License,
+# Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt).
+
+import testing ;
+
+project forward-tests
+    ;
+
+test-suite functional/forward
+    :
+      [ run forward_adapter.cpp ]
+      [ run lightweight_forward_adapter.cpp ]
+    ;
+
diff --git a/libs/functional/forward/test/forward_adapter.cpp b/libs/functional/forward/test/forward_adapter.cpp
new file mode 100644
index 0000000..99cc796
--- /dev/null
+++ b/libs/functional/forward/test/forward_adapter.cpp
@@ -0,0 +1,128 @@
+/*=============================================================================
+    Copyright (c) 2007 Tobias Schwinger
+  
+    Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_MSVC
+#   pragma warning(disable: 4244) // no conversion warnings, please
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/functional/forward_adapter.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/blank.hpp>
+#include <boost/noncopyable.hpp>
+
+#include <memory>
+
+template <class Base = ndnboost::blank>
+class test_func : public Base 
+{
+    int val;
+public:
+    test_func(int v) : val(v) { }
+
+    template<class B>
+    test_func(test_func<B> const & that)
+      : val(that.val)
+    { }
+
+    template<class B> friend class test_func;
+
+    int operator()(int & l, int const & r) const
+    {
+        return l=r+val;
+    }
+    long operator()(int & l, int const & r) 
+    {
+        return -(l=r+val);
+    }
+
+    template <typename Sig>
+    struct result
+    {
+        typedef void type;
+    };
+
+    // ensure result_of argument types are what's expected
+    // note: this is *not* how client code should look like 
+    template <class Self>
+    struct result< Self const(int&,int const&) > { typedef int type; };
+
+    template <class Self>
+    struct result< Self(int&,int const&) > { typedef long type; };
+
+    template <class Self>
+    struct result< Self(int&,int&) > { typedef char type; };
+};
+
+enum { int_, long_, char_ };
+
+int type_of(int)  { return int_; }
+int type_of(long) { return long_; }
+int type_of(char) { return char_; }
+
+int main()
+{
+    {
+        using ndnboost::is_same;
+        using ndnboost::result_of;
+        typedef ndnboost::forward_adapter< test_func<> > f;
+
+        // lvalue,rvalue
+        BOOST_TEST(( is_same<
+            result_of< f(int&, int) >::type, long >::value ));
+        BOOST_TEST(( is_same<
+            result_of< f const (int&, int) >::type, int >::value ));
+        // lvalue,const lvalue
+        BOOST_TEST(( is_same<
+            result_of< f(int&, int const &) >::type, long >::value ));
+        BOOST_TEST(( is_same<
+            result_of< f const (int&, int const &) >::type, int >::value ));
+        // lvalue,lvalue
+        BOOST_TEST(( is_same<
+            result_of< f(int&, int&) >::type, char >::value ));
+        BOOST_TEST(( is_same<
+            result_of< f const (int&, int&) >::type, char >::value ));
+    }
+
+    {
+        using ndnboost::noncopyable;
+        using ndnboost::forward_adapter;
+
+        int x = 0;
+        test_func<noncopyable> f(7);
+        forward_adapter< test_func<> > func(f);
+        forward_adapter< test_func<noncopyable> & > func_ref(f);
+        forward_adapter< test_func<noncopyable> & > const func_ref_c(f);
+        forward_adapter< test_func<> const > func_c(f);
+        forward_adapter< test_func<> > const func_c2(f);
+        forward_adapter< test_func<noncopyable> const & > func_c_ref(f);
+
+        BOOST_TEST( type_of( func(x,1) ) == long_ );
+        BOOST_TEST( type_of( func_ref(x,1) ) == long_ );
+        BOOST_TEST( type_of( func_ref_c(x,1) ) == long_ );
+        BOOST_TEST( type_of( func_c(x,1) ) == int_ );
+        BOOST_TEST( type_of( func_c2(x,1) ) == int_ );
+        BOOST_TEST( type_of( func_c_ref(x,1) ) == int_ );
+        BOOST_TEST( type_of( func(x,x) ) == char_ );
+
+        BOOST_TEST( func(x,1) == -8 );
+        BOOST_TEST( func_ref(x,1) == -8 );
+        BOOST_TEST( func_ref_c(x,1) == -8 );
+        BOOST_TEST( func_c(x,1) == 8 );
+        BOOST_TEST( func_c2(x,1) == 8 );
+        BOOST_TEST( func_c_ref(x,1) == 8 );
+    }
+
+    return ndnboost::report_errors();
+}
+
+
diff --git a/libs/functional/forward/test/lightweight_forward_adapter.cpp b/libs/functional/forward/test/lightweight_forward_adapter.cpp
new file mode 100644
index 0000000..41e207e
--- /dev/null
+++ b/libs/functional/forward/test/lightweight_forward_adapter.cpp
@@ -0,0 +1,128 @@
+/*=============================================================================
+    Copyright (c) 2007 Tobias Schwinger
+  
+    Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_MSVC
+#   pragma warning(disable: 4244) // no conversion warnings, please
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/functional/lightweight_forward_adapter.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/blank.hpp>
+#include <boost/noncopyable.hpp>
+
+#include <memory>
+
+template <class Base = ndnboost::blank>
+class test_func : public Base 
+{
+    int val;
+public:
+    test_func(int v) : val(v) { }
+
+    template<class B>
+    test_func(test_func<B> const & that)
+      : val(that.val)
+    { }
+
+    template<class B> friend class test_func;
+
+    int operator()(int & l, int const & r) const
+    {
+        return l=r+val;
+    }
+    long operator()(int & l, int const & r) 
+    {
+        return -(l=r+val);
+    }
+
+    template <typename Sig>
+    struct result
+    {
+        typedef void type;
+    };
+
+    // ensure result_of argument types are what's expected
+    // note: this is *not* how client code should look like 
+    template <class Self>
+    struct result< Self const(int&,int const&) > { typedef int type; };
+
+    template <class Self>
+    struct result< Self(int&,int const&) > { typedef long type; };
+
+    template <class Self>
+    struct result< Self(int&,int&) > { typedef char type; };
+};
+
+enum { int_, long_, char_ };
+
+int type_of(int)  { return int_; }
+int type_of(long) { return long_; }
+int type_of(char) { return char_; }
+
+int main()
+{
+    {
+        using ndnboost::is_same;
+        using ndnboost::result_of;
+        typedef ndnboost::lightweight_forward_adapter< test_func<> > f;
+        typedef ndnboost::reference_wrapper<int> ref;
+        typedef ndnboost::reference_wrapper<int const> cref;
+
+        // lvalue,rvalue
+        BOOST_TEST(( is_same<
+            result_of< f(ref, int) >::type, long >::value ));
+        BOOST_TEST(( is_same<
+            result_of< f const (ref, int) >::type, int >::value ));
+        // lvalue,const lvalue
+        BOOST_TEST(( is_same<
+            result_of< f(ref, cref) >::type, long >::value ));
+        BOOST_TEST(( is_same<
+            result_of< f const (ref, cref) >::type, int >::value ));
+        // lvalue,lvalue
+        BOOST_TEST(( is_same<
+            result_of< f(ref, ref) >::type, char >::value ));
+        BOOST_TEST(( is_same<
+            result_of< f const (ref, ref) >::type, char >::value ));
+    }
+    {
+        using ndnboost::noncopyable;
+        using ndnboost::lightweight_forward_adapter;
+
+        int v = 0; ndnboost::reference_wrapper<int> x(v);
+        test_func<noncopyable> f(7);
+        lightweight_forward_adapter< test_func<> > func(f);
+        lightweight_forward_adapter< test_func<noncopyable> & > func_ref(f);
+        lightweight_forward_adapter< test_func<noncopyable> & > const func_ref_c(f);
+        lightweight_forward_adapter< test_func<> const > func_c(f);
+        lightweight_forward_adapter< test_func<> > const func_c2(f);
+        lightweight_forward_adapter< test_func<noncopyable> const & > func_c_ref(f);
+
+        BOOST_TEST( type_of( func(x,1) ) == long_ );
+        BOOST_TEST( type_of( func_ref(x,1) ) == long_ );
+        BOOST_TEST( type_of( func_ref_c(x,1) ) == long_ );
+        BOOST_TEST( type_of( func_c(x,1) ) == int_ );
+        BOOST_TEST( type_of( func_c2(x,1) ) == int_ );
+        BOOST_TEST( type_of( func_c_ref(x,1) ) == int_ );
+        BOOST_TEST( type_of( func(x,x) ) == char_ );
+
+        BOOST_TEST( func(x,1) == -8 );
+        BOOST_TEST( func_ref(x,1) == -8 );
+        BOOST_TEST( func_ref_c(x,1) == -8 );
+        BOOST_TEST( func_c(x,1) == 8 );
+        BOOST_TEST( func_c2(x,1) == 8 );
+        BOOST_TEST( func_c_ref(x,1) == 8 );
+    }
+
+    return ndnboost::report_errors();
+}
+
diff --git a/libs/functional/function_traits.html b/libs/functional/function_traits.html
new file mode 100644
index 0000000..c0ce510
--- /dev/null
+++ b/libs/functional/function_traits.html
@@ -0,0 +1,233 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+  <meta http-equiv="Content-Language" content="en-us">
+  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+
+  <title>Boost Function Object Adapter Library</title>
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+  <table border="1" bgcolor="#007F7F" cellpadding="2" summary="">
+    <tr>
+      <td bgcolor="#FFFFFF"><img src="../../boost.png" alt=
+      "boost.png (6897 bytes)" width="277" height="86"></td>
+
+      <td><a href="../../index.htm"><font face="Arial" color=
+      "#FFFFFF"><big>Home</big></font></a></td>
+
+      <td><a href="../libraries.htm"><font face="Arial" color=
+      "#FFFFFF"><big>Libraries</big></font></a></td>
+
+      <td><a href="http://www.boost.org/people/people.htm"><font face="Arial" color=
+      "#FFFFFF"><big>People</big></font></a></td>
+
+      <td><a href="http://www.boost.org/more/faq.htm"><font face="Arial" color=
+      "#FFFFFF"><big>FAQ</big></font></a></td>
+
+      <td><a href="../../more/index.htm"><font face="Arial" color=
+      "#FFFFFF"><big>More</big></font></a></td>
+    </tr>
+  </table>
+
+  <h1>Function Object Traits</h1>
+
+  <p>The header <a href="../../boost/functional.hpp">functional.hpp</a>
+  provides two traits class templates for functions and function objects:</p>
+
+  <table border="1" summary="">
+    <tr>
+      <th>Type</th>
+
+      <th>Contents</th>
+
+      <th>Description</th>
+    </tr>
+
+    <tr>
+      <td valign="top" rowspan="4">
+      <tt>template&nbsp;&lt;typename&nbsp;T&gt;<br>
+      struct&nbsp;unary_traits</tt></td>
+
+      <td valign="top"><tt>function_type</tt></td>
+
+      <td valign="top">The type of the function or function object itself
+      (i.e., <tt>T</tt>).</td>
+    </tr>
+
+    <tr>
+      <td valign="top"><tt>param_type</tt></td>
+
+      <td valign="top">The type that should be used to pass the function or
+      function object as a parameter.</td>
+    </tr>
+
+    <tr>
+      <td valign="top"><tt>result_type</tt></td>
+
+      <td valign="top">The type returned by the function or function
+      object.</td>
+    </tr>
+
+    <tr>
+      <td valign="top"><tt>argument_type</tt></td>
+
+      <td valign="top">The type of the argument to the function or function
+      object.</td>
+    </tr>
+
+    <tr>
+      <td valign="top" rowspan="5">
+      <tt>template&nbsp;&lt;typename&nbsp;T&gt;<br>
+      struct&nbsp;binary_traits</tt></td>
+
+      <td valign="top"><tt>function_type</tt></td>
+
+      <td valign="top">The type of the function or function object itself
+      (i.e., <tt>T</tt>).</td>
+    </tr>
+
+    <tr>
+      <td valign="top"><tt>param_type</tt></td>
+
+      <td valign="top">The type that should be used to pass the function or
+      function object as a parameter.</td>
+    </tr>
+
+    <tr>
+      <td valign="top"><tt>result_type</tt></td>
+
+      <td valign="top">The type returned by the function or function
+      object.</td>
+    </tr>
+
+    <tr>
+      <td valign="top"><tt>first_argument_type</tt></td>
+
+      <td valign="top">The type of the first argument to the function or
+      function object.</td>
+    </tr>
+
+    <tr>
+      <td valign="top"><tt>second_argument_type</tt></td>
+
+      <td valign="top">The type of the second argument to the function or
+      function object.</td>
+    </tr>
+  </table>
+
+  <h3>Usage</h3>
+
+  <p><tt>unary_traits</tt> should be instantiated with either a function
+  taking a single parameter, or an adaptable unary function object (i.e., a
+  class derived from <tt>std::unary_function</tt> or one which provides the
+  same typedefs). (See &sect;20.3.1 in the C++ Standard.)</p>
+
+  <p><tt>binary_traits</tt> should be instantiated with either a function
+  taking two parameters, or an adaptable binary function object (i.e., a
+  class derived from <tt>std::binary_function</tt> or one which provides the
+  same typedefs). (See &sect;20.3.1 in the C++ Standard.)</p>
+
+  <p>The most common usage of these templates is in function object adapters,
+  thus allowing them to adapt plain functions as well as function objects.
+  You can do this by wherever you would normally write, for example,</p>
+
+  <blockquote>
+    <pre>
+typename Operation::argument_type
+</pre>
+  </blockquote>
+
+  <p>simply writing</p>
+
+  <blockquote>
+    <pre>
+typename boost::unary_traits&lt;Operation&gt;::argument_type
+</pre>
+  </blockquote>
+
+  <p>instead.</p>
+
+  <h3>Additional Types Defined</h3>
+
+  <p>In addition to the standard result and argument typedefs, these traits
+  templates define two additional types.</p>
+
+  <h4><tt>function_type</tt></h4>
+
+  <p>This is the type of the function or function object, and can be used in
+  declarations such as</p>
+
+  <blockquote>
+    <pre>
+template &lt;class Predicate&gt;
+class unary_negate : // ...
+{
+  // ...
+  private:
+    <strong>typename unary_traits&lt;Predicate&gt;::function_type</strong> pred;
+};
+</pre>
+  </blockquote>
+
+  <p>If this typedef were not provided, it would not be possible to declare
+  <tt>pred</tt> in a way that would allow <tt>unary_negate</tt> to be
+  instantiated with a function type (see the C++ Standard &sect;14.3.1
+  &para;3).</p>
+
+  <h4><tt>param_type</tt></h4>
+
+  <p>This is a type suitable for passing the function or function object as a
+  parameter to another function. For example,</p>
+
+  <blockquote>
+    <pre>
+template &lt;class Predicate&gt;
+class unary_negate : // ...
+{
+  public:
+    explicit unary_negate(<strong>typename unary_traits&lt;Predicate&gt;::param_type</strong> x)
+        :
+        pred(x)
+    {}
+    // ...
+};
+</pre>
+  </blockquote>
+
+  <p>Function objects are passed by reference to const; function pointers are
+  passed by value.</p>
+
+  <h3>Limitations</h3>
+
+  <p>This library uses these traits within all function object adapters,
+  theoretically rendering <tt>ptr_fun</tt> obsolete. However, third party
+  adapters probably won't take advantage of this mechanism, and so
+  <tt>ptr_fun</tt> may still be required. Accordingly, this library also
+  provides <a href="ptr_fun.html">improved versions of the standard function
+  pointer adapters</a>.</p>
+
+  <p>These traits templates will also not work with compilers that fail to
+  support partial specialisation of templates. With these compilers, the
+  traits templates can only be instantiated with adaptable function objects,
+  thus requiring <tt>ptr_fun</tt> to be used, even with the function object
+  adapters in this library.</p>
+  <hr>
+
+  <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
+  "../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
+  height="31" width="88"></a></p>
+
+  <p>Revised 
+  <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->02
+  December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38510" --></p>
+
+  <p><i>Copyright &copy; 2000 Cadenza New Zealand Ltd.</i></p>
+
+  <p><i>Distributed under the Boost Software License, Version 1.0. (See
+  accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
+  copy at <a href=
+  "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
+</body>
+</html>
diff --git a/libs/functional/hash/doc/Jamfile.v2 b/libs/functional/hash/doc/Jamfile.v2
new file mode 100644
index 0000000..62e2798
--- /dev/null
+++ b/libs/functional/hash/doc/Jamfile.v2
@@ -0,0 +1,19 @@
+
+# Copyright 2005-2008 Daniel James.
+# 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)
+
+using boostbook ;
+using quickbook ;
+
+xml hash : hash.qbk ;
+boostbook standalone : hash :
+    <xsl:param>boost.root=../../../../..
+
+    <xsl:param>chunk.first.sections=1
+    <xsl:param>chunk.section.depth=2
+    <xsl:param>generate.section.toc.level=2
+    <xsl:param>toc.section.depth=1
+    <xsl:param>toc.max.depth=1
+    <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/functional/hash/doc/html
+    ;
diff --git a/libs/functional/hash/doc/changes.qbk b/libs/functional/hash/doc/changes.qbk
new file mode 100644
index 0000000..4ca0814
--- /dev/null
+++ b/libs/functional/hash/doc/changes.qbk
@@ -0,0 +1,163 @@
+
+[/ Copyright 2005-2008 Daniel James.
+ / 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) ]
+
+[section:changes Change Log]
+
+[h2 Boost 1.33.0]
+
+* Initial Release
+
+[h2 Boost 1.33.1]
+
+* Fixed the points example, as pointed out by 沈慧峰.
+
+[h2 Boost 1.34.0]
+
+* Use declarations for standard classes, so that the library
+  doesn't need to include all of their headers
+* Deprecated the `<boost/functional/hash/*.hpp>` headers. Now a single header,
+  <[headerref boost/functional/hash.hpp]> is used.
+* Add support for the `BOOST_HASH_NO_EXTENSIONS` macro, which
+  disables the extensions to TR1.
+
+* Minor improvements to the hash functions for floating point numbers.
+* Update the portable example to hopefully be more generally portable.
+
+[h2 Boost 1.34.1]
+
+* [@http://svn.boost.org/trac/boost/ticket/952 Ticket 952]:
+  Suppress incorrect 64-bit warning on Visual C++.
+
+[h2 Boost 1.35.0]
+
+* Support for `long long`, `std::complex`.
+* Improved algorithm for hashing floating point numbers:
+  * Improved portablity, as described by Daniel Krügler in
+    [@http://lists.boost.org/boost-users/2005/08/13418.php
+    a post to the boost users list].
+  * Fits more information into each combine loop, which can reduce the
+    the number of times combine is called and hopefully give a better
+    quality hash function.
+  * Improved the algorithm for hashing floating point numbers.
+  * On Cygwin use a binary hash function for floating point numbers, as 
+    Cygwin doesn't have decent floating point functions for `long double`.
+  * Never uses `fpclass` which doesn't support `long double`.
+  * [@http://svn.boost.org/trac/boost/ticket/1064 Ticket 1064]:
+    Removed unnecessary use of `errno`.
+* Explicitly overload for more built in types.
+* Minor improvements to the documentation.
+* A few bug and warning fixes:
+  * [@http://svn.boost.org/trac/boost/ticket/1509 Ticket 1509]:
+    Suppress another Visual C++ warning.
+  * Some workarounds for the Sun compilers.
+
+[h2 Boost 1.36.0]
+
+* Stop using OpenBSD's dodgy `std::numeric_limits`.
+* Using the boost typedefs for `long long` and `unsigned long long`.
+* Move the extensions into their own header.
+
+[h2 Boost 1.37.0]
+
+* [@http://svn.boost.org/trac/boost/ticket/2264 Ticket 2264]:
+  In Visual C++, always use C99 float functions for `long double` and `float` as
+  the C++ overloads aren't always availables.
+
+[h2 Boost 1.38.0]
+
+* Changed the warnings in the deprecated headers from 1.34.0 to errors. These
+  will be removed in a future version of Boost.
+* Moved detail headers out of `boost/functional/detail`, since they are part of
+  functional/hash, not functional. `boost/functional/detail/container_fwd.hpp`
+  has been moved to `boost/detail/container_fwd.hpp` as it's used outside of
+  this library, the others have been moved to `boost/functional/hash/detail`.
+  
+[h2 Boost 1.39.0]
+
+* Move the hash_fwd.hpp implementation into the hash subdirectory, leaving a
+  forwarding header in the old location. You should still use the old location,
+  the new location is mainly for implementation and possible modularization.
+* [@https://svn.boost.org/trac/boost/ticket/2412 Ticket 2412]: Removed deprecated
+  headers.
+* [@https://svn.boost.org/trac/boost/ticket/2957 Ticket 2957]: Fix configuration
+  for vxworks.
+
+[h2 Boost 1.40.0]
+
+* Automatically configure the float functions using template metaprogramming
+  instead of trying to configure every possibility manually.
+* Workaround for when STLport doesn't support long double.
+
+[h2 Boost 1.42.0]
+
+* Reduce the number of warnings for Visual C++ warning level 4.
+* Some code formatting changes to fit lines into 80 characters.
+* Rename an internal namespace.
+
+[h2 Boost 1.43.0]
+
+* [@https://svn.boost.org/trac/boost/ticket/3866 Ticket 3866]:
+  Don't foward declare containers when using gcc's parallel library,
+  allow user to stop forward declaration by defining the
+  `BOOST_DETAIL_NO_CONTAINER_FWD` macro.
+* [@https://svn.boost.org/trac/boost/ticket/4038 Ticket 4038]:
+  Avoid hashing 0.5 and 0 to the same number.
+* Stop using deprecated `BOOST_HAS_*` macros.
+
+[h2 Boost 1.44.0]
+
+* Add option to prevent implicit conversions when calling `hash_value` by
+  defining `BOOST_HASH_NO_IMPLICIT_CASTS`. When using `boost::hash`
+  for a type that does not have `hash_value` declared but does have
+  an implicit conversion to a type that does, it would use that
+  implicit conversion to hash it. Which can sometimes go very wrong,
+  e.g. using a conversion to bool and only hashing to 2 possible
+  values. Since fixing this is a breaking change and was only
+  approached quite late in the release cycle with little discussion
+  it's opt-in for now. This, or something like it, will become the
+  default in a future version.
+
+[h2 Boost 1.46.0]
+
+* Avoid warning due with gcc's `-Wconversion` flag.
+
+[h2 Boost 1.50.0]
+
+* [@http://svn.boost.org/trac/boost/ticket/6771 Ticket 6771]:
+  Avoid gcc's `-Wfloat-equal` warning.
+* [@http://svn.boost.org/trac/boost/ticket/6806 Ticket 6806]:
+  Support `std::array` and `std::tuple` when available.
+* Add deprecation warning to the long deprecated
+  `boost/functional/detail/container_fwd.hpp`.
+
+[h2 Boost 1.51.0]
+
+* Support the standard smart pointers.
+* `hash_value` now implemented using SFINAE to avoid implicit casts to built
+  in types when calling it.
+* Updated to use the new config macros.
+
+[h2 Boost 1.52.0]
+
+* Restore `enum` support, which was accidentally removed in the last version.
+* New floating point hasher - will hash the binary representation on more
+  platforms, which should be faster.
+
+[h2 Boost 1.53.0]
+
+* Add support for `boost::int128_type` and `boost::uint128_type` where
+  available - currently only `__int128` and `unsigned __int128` on some
+  versions of gcc.
+* On platforms that are known to have the standard floating point functions,
+  don't use automatic detection - which can break if there are ambiguous
+  overloads.
+* Fix undefined behaviour when using the binary float hash (Thomas Heller).
+
+[h2 Boost 1.54.0]
+
+* [@https://svn.boost.org/trac/boost/ticket/7957 Ticket 7957]:
+  Fixed a typo.
+
+[endsect]
diff --git a/libs/functional/hash/doc/disable.qbk b/libs/functional/hash/doc/disable.qbk
new file mode 100644
index 0000000..27dec6b
--- /dev/null
+++ b/libs/functional/hash/doc/disable.qbk
@@ -0,0 +1,29 @@
+
+[/ Copyright 2005-2008 Daniel James.
+ / 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) ]
+
+[section:disable Disabling The Extensions]
+
+While [classref boost::hash]'s extensions are generally useful, you might want
+to turn them of in order to check that your code will work with other
+implementations of TR1. To do this define the macro `BOOST_HASH_NO_EXTENSIONS`.
+When this macro is defined, only the specialisations detailed
+in TR1 will be declared. But, if you later undefine the macro and include
+<[headerref boost/functional/hash.hpp]> then the non-specialised form will be defined
+- activating the extensions.
+
+It is strongly recommended that you never undefine the macro - and only define
+it so that it applies to the complete translation unit, either by defining it
+at the beginning of the main source file or, preferably, by using a compiler
+switch or preference. And you really should never define it in header files.
+
+If you are writing a library which has code in the header which requires the
+extensions, then the best action is to tell users not to define the macro.
+Their code won't ['require] the macro.
+
+Translation units that are compiled with the macro defined will link with units
+that were compiled without it. This feature has been designed to avoid ODR
+violations.
+
+[endsect]
diff --git a/libs/functional/hash/doc/hash.qbk b/libs/functional/hash/doc/hash.qbk
new file mode 100644
index 0000000..cdb72d4
--- /dev/null
+++ b/libs/functional/hash/doc/hash.qbk
@@ -0,0 +1,29 @@
+[library Boost.Functional/Hash
+    [quickbook 1.5]
+    [authors [James, Daniel]]
+    [copyright 2005 2006 2007 2008 Daniel James]
+    [purpose A TR1 hash function object that can be extended to hash user
+        defined types]
+    [category higher-order]
+    [id hash]
+    [dirname functional/hash]
+    [license
+        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])
+    ]
+]
+
+[def __issues__
+    [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf
+    Library Extension Technical Report Issues List]]
+
+[include:hash intro.qbk]
+[include:hash tutorial.qbk]
+[include:hash portability.qbk]
+[include:hash disable.qbk]
+[include:hash changes.qbk]
+[include:hash rationale.qbk]
+[xinclude ref.xml]
+[include:hash links.qbk]
+[include:hash thanks.qbk]
diff --git a/libs/functional/hash/doc/intro.qbk b/libs/functional/hash/doc/intro.qbk
new file mode 100644
index 0000000..076e997
--- /dev/null
+++ b/libs/functional/hash/doc/intro.qbk
@@ -0,0 +1,52 @@
+
+[/ Copyright 2005-2008 Daniel James.
+ / 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) ]
+
+[section:intro Introduction]
+
+[def __tr1-full__
+    [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf
+    Draft Technical Report on C++ Library Extensions]]
+[def __tr1__
+    [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf
+    TR1]]
+[def __unordered__ [link unordered Boost.Unordered]]
+[def __intrusive__ [link intrusive.unordered_set_unordered_multiset Boost.Intrusive]]
+[def __multi-index__ [@boost:/libs/multi_index/doc/index.html
+    Boost Multi-Index Containers Library]]
+[def __multi-index-short__ [@boost:/libs/multi_index/doc/index.html
+    Boost.MultiIndex]]
+[def __bimap__ [@boost:/libs/bimap/index.html Boost.Bimap]]
+[def __hash-function__ [@http://en.wikipedia.org/wiki/Hash_function hash function]]
+[def __hash-table__ [@http://en.wikipedia.org/wiki/Hash_table hash table]]
+
+[classref boost::hash] is an implementation of the __hash-function__ object
+specified by the __tr1-full__ (TR1). It is the default hash function for
+__unordered__, __intrusive__'s unordered associative containers, and
+__multi-index-short__'s hash indicies and __bimap__'s `unordered_set_of`.
+
+As it is compliant with __tr1__, it will work with:
+
+* integers
+* floats
+* pointers
+* strings
+
+It also implements the extension proposed by Peter Dimov in issue 6.18 of the
+__issues__ (page 63), this adds support for:
+
+* arrays
+* `std::pair`
+* the standard containers.
+* extending [classref boost::hash] for custom types.
+
+[note
+This hash function is designed to be used in containers based on
+the STL and is not suitable as a general purpose hash function.
+For more details see the [link hash.rationale rationale].
+]
+
+
+[endsect]
+
diff --git a/libs/functional/hash/doc/links.qbk b/libs/functional/hash/doc/links.qbk
new file mode 100644
index 0000000..405536e
--- /dev/null
+++ b/libs/functional/hash/doc/links.qbk
@@ -0,0 +1,27 @@
+
+[/ Copyright 2005-2008 Daniel James.
+ / 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) ]
+
+[section:links Links]
+
+[*A Proposal to Add Hash Tables to the Standard Library]
+[@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1456.html]
+The hash table proposal explains much of the design. The hash function object
+is discussed in Section D.
+
+[*The C++ Standard Library Technical Report.]
+[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf]
+Contains the hash function specification in section 6.3.2.
+
+[*Library Extension Technical Report Issues List.]
+[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf]
+The library implements the extension described in Issue 6.18, pages 63-67.
+
+[*Methods for Identifying Versioned and Plagiarised Documents]
+Timothy C. Hoad, Justin Zobel
+[@http://www.cs.rmit.edu.au/~jz/fulltext/jasist-tch.pdf]
+Contains the hash function that [funcref boost::hash_combine] is based on.
+
+[endsect]
+
diff --git a/libs/functional/hash/doc/portability.qbk b/libs/functional/hash/doc/portability.qbk
new file mode 100644
index 0000000..a65bc19
--- /dev/null
+++ b/libs/functional/hash/doc/portability.qbk
@@ -0,0 +1,93 @@
+
+[/ Copyright 2005-2008 Daniel James.
+ / 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) ]
+
+[section:portability Portability]
+
+[def __boost_hash__ [classref boost::hash]]
+
+__boost_hash__ is written to be as portable as possible, but unfortunately, several
+older compilers don't support argument dependent lookup (ADL) - the mechanism
+used for customisation.  On those compilers custom overloads for `hash_value`
+needs to be declared in the boost namespace.
+
+On a strictly standards compliant compiler, an overload defined in the
+boost namespace won't be found when __boost_hash__ is instantiated,
+so for these compilers the overload should only be declared in the same
+namespace as the class.
+
+Let's say we have a simple custom type:
+
+    namespace foo
+    {
+        template <class T>
+        class custom_type
+        {
+            T value;
+        public:
+            custom_type(T x) : value(x) {}
+
+            friend std::size_t hash_value(custom_type x)
+            {
+                __boost_hash__<int> hasher;
+                return hasher(x.value);
+            }
+        };
+    }
+
+On a compliant compiler, when `hash_value` is called for this type,
+it will look at the namespace inside the type and find `hash_value`
+but on a compiler which doesn't support ADL `hash_value` won't be found.
+To make things worse, some compilers which do support ADL won't find
+a friend class defined inside the class.
+
+So first move the member function out of the class:
+
+    namespace foo
+    {
+        template <class T>
+        class custom_type
+        {
+            T value;
+        public:
+            custom_type(T x) : value(x) {}
+
+            std::size_t hash(custom_type x)
+            {
+                __boost_hash__<T> hasher;
+                return hasher(value);
+            }
+        };
+
+        template <class T>
+        inline std::size_t hash_value(custom_type<T> x)
+        {
+            return x.hash();
+        }
+    }
+
+Unfortunately, I couldn't declare hash_value as a friend, as some compilers
+don't support template friends, so instead I declared a member function to
+calculate the hash, and called it from hash_value.
+
+For compilers which don't support ADL, hash_value needs to be defined in the
+boost namespace:
+
+    #ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+    namespace boost
+    #else
+    namespace foo
+    #endif
+    {
+        template <class T>
+        std::size_t hash_value(foo::custom_type<T> x)
+        {
+            return x.hash();
+        }
+    }
+
+Full code for this example is at
+[@boost:/libs/functional/hash/examples/portable.cpp /libs/functional/hash/examples/portable.cpp].
+
+[endsect]
diff --git a/libs/functional/hash/doc/rationale.qbk b/libs/functional/hash/doc/rationale.qbk
new file mode 100644
index 0000000..8621081
--- /dev/null
+++ b/libs/functional/hash/doc/rationale.qbk
@@ -0,0 +1,50 @@
+
+[/ Copyright 2011 Daniel James.
+ / 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) ]
+
+[section:rationale Rationale]
+
+The rationale can be found in the original design
+[footnote issue 6.18 of the __issues__ (page 63)].
+
+[heading Quality of the hash function]
+
+Many hash functions strive to have little correlation between the input
+and output values. They attempt to uniformally distribute the output
+values for very similar inputs. This hash function makes no such
+attempt. In fact, for integers, the result of the hash function is often
+just the input value. So similar but different input values will often
+result in similar but different output values.
+This means that it is not appropriate as a general hash function. For
+example, a hash table may discard bits from the hash function resulting
+in likely collisions, or might have poor collision resolution when hash
+values are clustered together. In such cases this hash function will
+preform poorly.
+
+But the standard has no such requirement for the hash function,
+it just requires that the hashes of two different values are unlikely
+to collide. Containers or algorithms
+designed to work with the standard hash function will have to be
+implemented to work well when the hash function's output is correlated
+to its input. Since they are paying that cost a higher quality hash function
+would be wasteful.
+
+For other use cases, if you do need a higher quality hash function,
+then neither the standard hash function or `boost::hash` are appropriate.
+There are several options
+available. One is to use a second hash on the output of this hash
+function, such as [@http://www.concentric.net/~ttwang/tech/inthash.htm
+Thomas Wang's hash function]. This this may not work as
+well as a hash algorithm tailored for the input.
+
+For strings there are several fast, high quality hash functions
+available (for example [@http://code.google.com/p/smhasher/ MurmurHash3]
+and [@http://code.google.com/p/cityhash/ Google's CityHash]),
+although they tend to be more machine specific.
+These may also be appropriate for hashing a binary representation of
+your data - providing that all equal values have an equal
+representation, which is not always the case (e.g. for floating point
+values).
+
+[endsect]
diff --git a/libs/functional/hash/doc/ref.xml b/libs/functional/hash/doc/ref.xml
new file mode 100644
index 0000000..d7c427c
--- /dev/null
+++ b/libs/functional/hash/doc/ref.xml
@@ -0,0 +1,883 @@
+
+<!--
+Copyright Daniel James 2005-2009
+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)
+-->
+
+<library-reference>
+  <section id="hash.reference.specification">
+    <para>For the full specification, see section 6.3 of the
+        <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf">C++ Standard Library Technical Report</ulink>
+        and issue 6.18 of the
+        <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1837.pdf">Library Extension Technical Report Issues List</ulink> (page 63).
+    </para>
+  </section>
+  <header name="boost/functional/hash.hpp">
+    <para>
+      Defines <code><classname>boost::hash</classname></code>,
+      and helper functions.
+    </para>
+
+    <namespace name="boost">
+
+      <!--
+        boost::hash
+        -->
+
+      <struct name="hash">
+        <template>
+          <template-type-parameter name="T"/>
+        </template>
+
+        <inherit access="public">
+          <classname>std::unary_function&lt;T, std::size_t&gt;</classname>
+        </inherit>
+
+        <purpose><simpara>A <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf">TR1</ulink> compliant hash function object.</simpara></purpose>
+
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>T const&amp;</paramtype>
+          </parameter>
+          <returns><para>
+            <programlisting><functionname>hash_value</functionname>(val)</programlisting>
+          </para></returns>
+          <notes>
+            <para>
+              The call to <code><functionname>hash_value</functionname></code>
+              is unqualified, so that custom overloads can be
+              found via argument dependent lookup.
+            </para>
+            <para>
+              This is not defined when the macro <code>BOOST_HASH_NO_EXTENSIONS</code>
+              is defined. The specializations are still defined, so only the specializations
+              required by TR1 are defined.
+            </para>
+            <para>
+              Forward declared in
+              <code>&lt;boost/functional/hash_fwd.hpp&gt;</code>
+            </para>
+          </notes>
+          <throws><para>
+            Only throws if
+            <code><functionname>hash_value</functionname>(T)</code> throws.
+          </para></throws>
+        </method>
+      </struct>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>bool</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>bool</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>char</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>char</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>signed char</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>signed char</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>unsigned char</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>unsigned char</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>wchar_t</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>wchar_t</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>short</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>short</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>unsigned short</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>unsigned short</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>int</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>int</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>unsigned int</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>unsigned int</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>long</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>long</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>unsigned long</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>unsigned long</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>long long</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>long long</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>unsigned long long</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>unsigned long long</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>float</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>float</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>double</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>double</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>long double</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>long double</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>std::string</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>std::string const&amp;</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>std::wstring</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>std::wstring const&amp;</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+            <para><functionname>hash_value</functionname>(val) in Boost.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template>
+          <template-type-parameter name="T"/>
+        </template>
+        <specialization>
+          <template-arg>T*</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>T*</paramtype>
+          </parameter>
+          <returns>
+            <para>Unspecified in TR1, except that equal arguments yield the same result.</para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+      </struct-specialization>
+
+      <struct-specialization name="hash">
+        <template></template>
+        <specialization>
+          <template-arg>std::type_index</template-arg>
+        </specialization>
+        <method name="operator()" cv="const">
+          <type>std::size_t</type>
+          <parameter name="val">
+            <paramtype>std::type_index</paramtype>
+          </parameter>
+          <returns>
+            <para><code>val.hash_code()</code></para>
+          </returns>
+          <throws><para>Doesn't throw</para></throws>
+        </method>
+        <notes>
+          <para>
+            Only available if it's in your standard library and Boost.Config
+            is aware of it.
+          </para>
+        </notes>
+      </struct-specialization>
+
+      <free-function-group name="Support functions (Boost extension)."> 
+
+      <!--
+        boost::hash_combine
+        -->
+
+      <function name="hash_combine">
+        <template>
+          <template-type-parameter name="T"/>
+        </template>
+        <type>void</type>
+        <parameter name="seed"><paramtype>size_t &amp;</paramtype></parameter>
+        <parameter name="v"><paramtype>T const&amp;</paramtype></parameter>
+        <purpose><simpara>
+            Called repeatedly to incrementally create a hash value from
+            several variables.
+        </simpara></purpose>
+        <effects><programlisting>seed ^= <functionname>hash_value</functionname>(v) + 0x9e3779b9 + (seed &lt;&lt; 6) + (seed &gt;&gt; 2);</programlisting></effects>
+        <notes>
+          <para><functionname>hash_value</functionname> is called without
+          qualification, so that overloads can be found via ADL.</para>
+          <para>This is an extension to TR1</para>
+          <para>
+            Forward declared in
+            <code>&lt;boost/functional/hash_fwd.hpp&gt;</code>
+          </para>
+        </notes>
+        <throws>
+          Only throws if <functionname>hash_value</functionname>(T) throws.
+          Strong exception safety, as long as <functionname>hash_value</functionname>(T)
+          also has strong exception safety.
+        </throws>
+      </function>
+
+      <!--
+        boost::hash_range
+        -->
+
+      <overloaded-function name="hash_range">
+        <signature>
+          <template>
+            <template-type-parameter name="It"/>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="first"><paramtype>It</paramtype></parameter>
+          <parameter name="last"><paramtype>It</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="It"/>
+          </template>
+          <type>void</type>
+          <parameter name="seed"><paramtype>std::size_t&amp;</paramtype></parameter>
+          <parameter name="first"><paramtype>It</paramtype></parameter>
+          <parameter name="last"><paramtype>It</paramtype></parameter>
+        </signature>
+
+        <purpose><simpara>
+            Calculate the combined hash value of the elements of an iterator
+            range.
+        </simpara></purpose>
+        <effects>
+          <para>For the two argument overload:
+<programlisting>
+size_t seed = 0;
+
+for(; first != last; ++first)
+{
+    <functionname>hash_combine</functionname>(seed, *first);
+}
+
+return seed;
+</programlisting>
+          </para>
+          <para>For the three arguments overload:</para>
+<programlisting>
+for(; first != last; ++first)
+{
+    <functionname>hash_combine</functionname>(seed, *first);
+}
+</programlisting>
+        </effects>
+        <notes>
+          <para>
+            <code>hash_range</code> is sensitive to the order of the elements
+            so it wouldn't be appropriate to use this with an unordered
+            container.
+          </para>
+          <para>This is an extension to TR1</para>
+          <para>
+            Forward declared in
+            <code>&lt;boost/functional/hash_fwd.hpp&gt;</code>
+          </para>
+        </notes>
+        <throws><para>
+          Only throws if <code><functionname>hash_value</functionname>(std::iterator_traits&lt;It&gt;::value_type)</code>
+          throws. <code>hash_range(std::size_t&amp;, It, It)</code> has basic exception safety as long as
+          <code><functionname>hash_value</functionname>(std::iterator_traits&lt;It&gt;::value_type)</code>
+          has basic exception safety.
+        </para></throws>
+      </overloaded-function>
+
+      </free-function-group>
+
+      <free-function-group name="Overloadable hash implementation (Boost extension).">
+
+      <!--
+        boost::hash_value - integers
+        -->
+
+      <overloaded-function name="hash_value">
+        <purpose><simpara>
+            Implementation of the hash function.
+        </simpara></purpose>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>bool</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>char</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>signed char</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>unsigned char</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>wchar_t</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>short</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>unsigned short</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>int</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>unsigned int</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>long</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>unsigned long</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>long long</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>unsigned long long</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>float</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>double</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>long double</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template><template-type-parameter name="T"/></template>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>T* const&amp;</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="T"/>
+            <template-nontype-parameter name="N"><type>unsigned</type></template-nontype-parameter>
+          </template>
+          <type>std::size_t</type>
+          <parameter><paramtype>T (&amp;val)[N]</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="T"/>
+            <template-nontype-parameter name="N"><type>unsigned</type></template-nontype-parameter>
+          </template>
+          <type>std::size_t</type>
+          <parameter><paramtype>const T (&amp;val)[N]</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="Ch"/>
+            <template-type-parameter name="A"/>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="val">
+              <paramtype>std::basic_string&lt;Ch, std::char_traits&lt;Ch&gt;, A&gt; const&amp;</paramtype>
+          </parameter>
+        </signature>
+              
+       <signature>
+          <template>
+            <template-type-parameter name="A"/>
+            <template-type-parameter name="B"/>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>std::pair&lt;A, B&gt; const&amp;</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="T"/>
+            <template-type-parameter name="A"/>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>std::vector&lt;T, A&gt; const&amp;</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="T"/>
+            <template-type-parameter name="A"/>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>std::list&lt;T, A&gt; const&amp;</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="T"/>
+            <template-type-parameter name="A"/>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>std::deque&lt;T, A&gt; const&amp;</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="K"/>
+            <template-type-parameter name="C"/>
+            <template-type-parameter name="A"/>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>std::set&lt;K, C, A&gt; const&amp;</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="K"/>
+            <template-type-parameter name="C"/>
+            <template-type-parameter name="A"/>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>std::multiset&lt;K, C, A&gt; const&amp;</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="K"/>
+            <template-type-parameter name="T"/>
+            <template-type-parameter name="C"/>
+            <template-type-parameter name="A"/>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>std::map&lt;K, T, C, A&gt; const&amp;</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="K"/>
+            <template-type-parameter name="T"/>
+            <template-type-parameter name="C"/>
+            <template-type-parameter name="A"/>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>std::multimap&lt;K, T, C, A&gt; const&amp;</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="T"/>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>std::complex&lt;T&gt; const&amp;</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>std::type_index</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="T"/>
+            <template-nontype-parameter name="N">
+              <type>std::size_t</type>
+            </template-nontype-parameter>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>std::array&lt;T, N&gt; const&amp;</paramtype></parameter>
+        </signature>
+
+        <signature>
+          <template>
+            <template-type-parameter name="T" pack="1"/>
+          </template>
+          <type>std::size_t</type>
+          <parameter name="val"><paramtype>std::tuple&lt;T...&gt;</paramtype></parameter>
+        </signature>
+
+        <description><para>
+          Generally shouldn't be called directly by users, instead they should use
+          <classname>boost::hash</classname>, <functionname>boost::hash_range</functionname>
+          or <functionname>boost::hash_combine</functionname> which
+          call <code>hash_value</code> without namespace qualification so that overloads
+          for custom types are found via ADL.
+        </para></description>
+
+        <notes>
+          <para>This is an extension to TR1</para>
+        </notes>
+
+        <throws>
+            Only throws if a user supplied version of
+            <code><functionname>hash_value</functionname></code>
+            throws for an element of a container, or
+            one of the types stored in a pair.
+        </throws>
+
+        <returns>
+          <informaltable>
+            <tgroup cols="2">
+              <thead>
+                <row>
+                  <entry>Types</entry>
+                  <entry>Returns</entry>
+                </row>
+              </thead>
+              <tbody>
+                <row>
+                  <entry><code>bool</code>,
+                    <code>char</code>, <code>signed char</code>, <code>unsigned char</code>, <code>wchar_t</code>,
+                    <code>short</code>, <code>unsigned short</code>,
+                    <code>int</code>, <code>unsigned int</code>, <code>long</code>, <code>unsigned long</code>
+                  </entry>
+                  <entry><code>val</code></entry>
+                </row>
+                <row>
+                  <entry><code>long long</code>, <code>unsigned long long</code></entry>
+                  <entry><code>val</code> when <code>abs(val) &lt;= std::numeric_limits&lt;std::size_t&gt;::max()</code>.</entry>
+                </row>
+                <row>
+                  <entry><code>float</code>, <code>double</code>, <code>long double</code></entry>
+                  <entry>An unspecified value, except that equal arguments shall yield the same result.</entry>
+                </row>
+                <row>
+                  <entry><code>T*</code></entry>
+                  <entry>An unspecified value, except that equal arguments shall yield the same result.</entry>
+                </row>
+                <row>
+                  <entry>
+                    <code>T&#160;val[N]</code>,
+                    <code>const&#160;T&#160;val[N]</code>
+                  </entry>
+                  <entry><code>hash_range(val, val+N)</code></entry>
+                </row>
+                <row>
+                  <entry>
+                    <code>std:basic_string&lt;Ch,&#160;std::char_traits&lt;Ch&gt;,&#160;A&gt;</code>,
+                    <code>std::vector&lt;T,&#160;A&gt;</code>,
+                    <code>std::list&lt;T,&#160;A&gt;</code>,
+                    <code>std::deque&lt;T,&#160;A&gt;</code>,
+                    <code>std::set&lt;K,&#160;C,&#160;A&gt;</code>,
+                    <code>std::multiset&lt;K,&#160;C,&#160;A&gt;</code>,
+                    <code>std::map&lt;K,&#160;T,&#160;C,&#160;A&gt;</code>,
+                    <code>std::multimap&lt;K,&#160;T,&#160;C,&#160;A&gt;</code>,
+                    <code>std::array&lt;T,&#160;N&gt;</code>
+                  </entry>
+                  <entry><code>hash_range(val.begin(), val.end())</code></entry>
+                </row>
+                <row>
+                  <entry><code>std::pair&lt;A, B&gt;</code></entry>
+                  <entry><programlisting>size_t seed = 0;
+<functionname>hash_combine</functionname>(seed, val.first);
+<functionname>hash_combine</functionname>(seed, val.second);
+return seed;</programlisting></entry>
+                </row>
+                <row>
+                  <entry><code>std::tuple&lt;T...&gt;</code></entry>
+                  <entry><programlisting>size_t seed = 0;
+<functionname>hash_combine</functionname>(seed, get&lt;0&gt;(val));
+<functionname>hash_combine</functionname>(seed, get&lt;1&gt;(val));
+// ....
+return seed;</programlisting></entry>
+                </row>
+                <row>
+                  <entry>
+                    <code>std::complex&lt;T&gt;</code>
+                  </entry>
+                  <entry>When <code>T</code> is a built in type and <code>val.imag() == 0</code>, the result is equal to <code>hash_value(val.real())</code>. Otherwise an unspecified value, except that equal arguments shall yield the same result.</entry>
+                </row>
+                <row>
+                  <entry>
+                    <code>std::type_index</code>
+                  </entry>
+                  <entry><code>val.hash_code()</code></entry>
+                </row>
+              </tbody>
+            </tgroup>
+          </informaltable>
+        </returns>
+      </overloaded-function>
+      </free-function-group>
+    </namespace>
+  </header>
+</library-reference>
+
diff --git a/libs/functional/hash/doc/thanks.qbk b/libs/functional/hash/doc/thanks.qbk
new file mode 100644
index 0000000..fcc5108
--- /dev/null
+++ b/libs/functional/hash/doc/thanks.qbk
@@ -0,0 +1,28 @@
+
+[/ Copyright 2005-2008 Daniel James.
+ / 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) ]
+
+[section:acknowledgements Acknowledgements]
+
+This library is based on the design by Peter Dimov. During the initial
+development
+Joaquín M López Muñoz made many useful suggestions and contributed fixes.
+
+The formal review was managed by Thorsten Ottosen, and the library reviewed by:
+David Abrahams, Alberto Barbati, Topher Cooper, Caleb Epstein, Dave Harris,
+Chris Jefferson, Bronek Kozicki, John Maddock, Tobias Swinger, Jaap Suter,
+Rob Stewart and Pavel Vozenilek. Since then, further constructive criticism has
+been made by Daniel Krügler, Alexander Nasonov and 沈慧峰.
+
+The implementation of the hash function for pointers is based on suggestions
+made by Alberto Barbati and Dave Harris. Dave Harris also suggested an
+important improvement to [funcref boost::hash_combine] that was taken up.
+
+Some useful improvements to the floating point hash algorithm were suggested
+by Daniel Krügler.
+
+The original implementation came from Jeremy B. Maitin-Shepard's hash table
+library, although this is a complete rewrite.
+
+[endsect]
diff --git a/libs/functional/hash/doc/tutorial.qbk b/libs/functional/hash/doc/tutorial.qbk
new file mode 100644
index 0000000..59067a7
--- /dev/null
+++ b/libs/functional/hash/doc/tutorial.qbk
@@ -0,0 +1,212 @@
+
+[/ Copyright 2005-2008 Daniel James.
+ / 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) ]
+
+[def __multi-index-short__ [@boost:/libs/multi_index/doc/index.html
+    Boost.MultiIndex]]
+
+[section:tutorial Tutorial]
+
+When using a hash index with __multi-index-short__, you don't need to do
+anything to use [classref boost::hash] as it uses it by default.
+To find out how to use a user-defined type, read the
+[link hash.custom section on extending boost::hash for a custom data type].
+
+If your standard library supplies its own implementation of the unordered
+associative containers and you wish to use
+[classref boost::hash], just use an extra template parameter:
+
+    std::unordered_multiset<int, ``[classref boost::hash]``<int> >
+            set_of_ints;
+
+    std::unordered_set<std::pair<int, int>, ``[classref boost::hash]``<std::pair<int, int> >
+            set_of_pairs;
+
+    std::unordered_map<int, std::string, ``[classref boost::hash]``<int> > map_int_to_string;
+
+To use [classref boost::hash] directly, create an instance and call it as a function:
+
+    #include <``[headerref boost/functional/hash.hpp]``>
+
+    int main()
+    {
+        ``[classref boost::hash]``<std::string> string_hash;
+
+        std::size_t h = string_hash("Hash me");
+    }
+
+For an example of generic use, here is a function to generate a vector
+containing the hashes of the elements of a container:
+
+    template <class Container>
+    std::vector<std::size_t> get_hashes(Container const& x)
+    {
+        std::vector<std::size_t> hashes;
+        std::transform(x.begin(), x.end(), std::insert_iterator(hashes),
+            ``[classref boost::hash]``<typename Container::value_type>());
+
+        return hashes;
+    }
+
+[endsect]
+
+[section:custom Extending boost::hash for a custom data type]
+
+[classref boost::hash] is implemented by calling the function
+[funcref boost::hash_value hash_value].
+The namespace isn't specified so that it can detect overloads via argument
+dependant lookup. So if there is a free function `hash_value` in the same
+namespace as a custom type, it will get called.
+
+If you have a structure `library::book`, where each `book` is uniquely
+defined by it's member `id`:
+
+    namespace library
+    {
+        struct book
+        {
+            int id;
+            std::string author;
+            std::string title;
+
+            // ....
+        };
+
+        bool operator==(book const& a, book const& b)
+        {
+            return a.id == b.id;
+        }
+    }
+
+Then all you would need to do is write the function `library::hash_value`:
+
+    namespace library
+    {
+        std::size_t hash_value(book const& b)
+        {
+            ``[classref boost::hash]``<int> hasher;
+            return hasher(b.id);
+        }
+    }
+
+And you can now use [classref boost::hash] with book:
+
+    library::book knife(3458, "Zane Grey", "The Hash Knife Outfit");
+    library::book dandelion(1354, "Paul J. Shanley",
+        "Hash & Dandelion Greens");
+
+    ``[classref boost::hash]``<library::book> book_hasher;
+    std::size_t knife_hash_value = book_hasher(knife);
+
+    // If std::unordered_set is available:
+    std::unordered_set<library::book, ``[classref boost::hash]``<library::book> > books;
+    books.insert(knife);
+    books.insert(library::book(2443, "Lindgren, Torgny", "Hash"));
+    books.insert(library::book(1953, "Snyder, Bernadette M.",
+        "Heavenly Hash: A Tasty Mix of a Mother's Meditations"));
+
+    assert(books.find(knife) != books.end());
+    assert(books.find(dandelion) == books.end());
+
+The full example can be found in:
+[@boost:/libs/functional/hash/examples/books.hpp /libs/functional/hash/examples/books.hpp]
+and
+[@boost:/libs/functional/hash/examples/books.cpp /libs/functional/hash/examples/books.cpp].
+
+[tip
+When writing a hash function, first look at how the equality function works.
+Objects that are equal must generate the same hash value.
+When objects are not equal they should generate different hash values.
+In this object equality was based just on the id so the hash function
+only hashes the id. If it was based on the object's name and author
+then the hash function should take them into account
+(how to do this is discussed in the next section).
+]
+
+[endsect]
+
+[section:combine Combining hash values]
+
+Say you have a point class, representing a two dimensional location:
+
+    class point
+    {
+        int x;
+        int y;
+    public:
+        point() : x(0), y(0) {}
+        point(int x, int y) : x(x), y(y) {}
+
+        bool operator==(point const& other) const
+        {
+            return x == other.x && y == other.y;
+        }
+    };
+
+and you wish to use it as the key for an `unordered_map`. You need to
+customise the hash for this structure. To do this we need to combine
+the hash values for `x` and `y`. The function
+[funcref boost::hash_combine] is supplied for this purpose:
+
+    class point
+    {
+        ...
+
+        friend std::size_t hash_value(point const& p)
+        {
+            std::size_t seed = 0;
+            ``[funcref boost::hash_combine]``(seed, p.x);
+            ``[funcref boost::hash_combine]``(seed, p.y);
+
+            return seed;
+        }
+
+        ...
+    };
+
+Calls to hash_combine incrementally build the hash from the different members
+of point, it can be repeatedly called for any number of elements. It calls
+[funcref boost::hash_value hash_value] on the supplied element, and combines it with the seed.
+
+Full code for this example is at
+[@boost:/libs/functional/hash/examples/point.cpp /libs/functional/hash/examples/point.cpp].
+
+[note
+When using [funcref boost::hash_combine] the order of the
+calls matters.
+'''
+<programlisting>
+    std::size_t seed = 0;
+    boost::hash_combine(seed, 1);
+    boost::hash_combine(seed, 2);
+</programlisting>
+results in a different seed to:
+<programlisting>
+    std::size_t seed = 0;
+    boost::hash_combine(seed, 2);
+    boost::hash_combine(seed, 1);
+</programlisting>
+'''
+If you are calculating a hash value for data where the order of the data
+doesn't matter in comparisons (e.g. a set) you will have to ensure that the
+data is always supplied in the same order.
+]
+
+To calculate the hash of an iterator range you can use [funcref boost::hash_range]:
+
+    std::vector<std::string> some_strings;
+    std::size_t hash = ``[funcref boost::hash_range]``(some_strings.begin(), some_strings.end());
+
+Note that when writing template classes, you might not want to include the main
+hash header as it's quite an expensive include that brings in a lot of other
+headers, so instead you can include the `<boost/functional/hash_fwd.hpp>`
+header which forward declares [classref boost::hash],
+[funcref boost::hash_range] and [funcref boost::hash_combine]. You'll need to
+include the main header before instantiating [classref boost::hash]. When using
+a container that uses [classref boost::hash] it should do that for you, so your
+type will work fine with the boost hash containers. There's an example of this
+in [@boost:/libs/functional/hash/examples/template.hpp template.hpp] and
+[@boost:/libs/functional/hash/examples/template.cpp template.cpp].
+
+[endsect]
diff --git a/libs/functional/hash/examples/Jamfile.v2 b/libs/functional/hash/examples/Jamfile.v2
new file mode 100644
index 0000000..6291621
--- /dev/null
+++ b/libs/functional/hash/examples/Jamfile.v2
@@ -0,0 +1,9 @@
+
+# Copyright Daniel James 2005. Use, modification, and distribution are
+# subject to 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)
+
+run books.cpp ;
+run point.cpp ;
+run portable.cpp ;
+run template.cpp ;
diff --git a/libs/functional/hash/examples/books.cpp b/libs/functional/hash/examples/books.cpp
new file mode 100644
index 0000000..8802e0e
--- /dev/null
+++ b/libs/functional/hash/examples/books.cpp
@@ -0,0 +1,51 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./books.hpp"
+#include <boost/functional/hash.hpp>
+#include <cassert>
+
+// If std::unordered_set was available:
+//#include <unordered_set>
+
+// This example illustrates how to use ndnboost::hash with a custom hash function.
+// For full details, see the tutorial.
+
+int main()
+{
+    library::book knife(3458, "Zane Grey", "The Hash Knife Outfit");
+    library::book dandelion(1354, "Paul J. Shanley", "Hash & Dandelion Greens");
+
+    ndnboost::hash<library::book> book_hasher;
+    std::size_t knife_hash_value = book_hasher(knife);
+    (void)knife_hash_value; // suppress unused variable warning
+
+    // If std::unordered_set was available:
+    //
+    //std::unordered_set<library::book, ndnboost::hash<library::book> > books;
+    //books.insert(knife);
+    //books.insert(library::book(2443, "Lindgren, Torgny", "Hash"));
+    //books.insert(library::book(1953, "Snyder, Bernadette M.",
+    //    "Heavenly Hash: A Tasty Mix of a Mother's Meditations"));
+
+    //assert(books.find(knife) != books.end());
+    //assert(books.find(dandelion) == books.end());
+
+    return 0;
+}
+
+namespace library
+{
+    bool operator==(book const& a, book const& b)
+    {
+        return a.id == b.id;
+    }
+
+    std::size_t hash_value(book const& b)
+    {
+        ndnboost::hash<int> hasher;
+        return hasher(b.id);
+    }
+}
diff --git a/libs/functional/hash/examples/books.hpp b/libs/functional/hash/examples/books.hpp
new file mode 100644
index 0000000..195a798
--- /dev/null
+++ b/libs/functional/hash/examples/books.hpp
@@ -0,0 +1,26 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+// This example illustrates how to use ndnboost::hash with a custom hash function.
+// The implementation is contained in books.cpp
+
+#include <cstddef>
+#include <string>
+
+namespace library
+{
+    struct book
+    {
+        int id;
+        std::string author;
+        std::string title;
+
+        book(int i, std::string const& a, std::string const& t)
+            : id(i), author(a), title(t) {}
+    };
+
+    bool operator==(book const&, book const&);
+    std::size_t hash_value(book const&);
+}
diff --git a/libs/functional/hash/examples/point.cpp b/libs/functional/hash/examples/point.cpp
new file mode 100644
index 0000000..b36e3e2
--- /dev/null
+++ b/libs/functional/hash/examples/point.cpp
@@ -0,0 +1,54 @@
+
+// Copyright 2005 Daniel James.
+// 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)
+
+#include <boost/functional/hash.hpp>
+#include <cassert>
+
+// This example illustrates how to use ndnboost::hash_combine to generate a hash
+// value from the different members of a class. For full details see the hash
+// tutorial.
+
+class point
+{
+    int x;
+    int y;
+public:
+    point() : x(0), y(0) {}
+    point(int x, int y) : x(x), y(y) {}
+
+    bool operator==(point const& other) const
+    {
+        return x == other.x && y == other.y;
+    }
+
+    friend std::size_t hash_value(point const& p)
+    {
+        std::size_t seed = 0;
+        ndnboost::hash_combine(seed, p.x);
+        ndnboost::hash_combine(seed, p.y);
+
+        return seed;
+    }
+};
+
+int main()
+{
+    ndnboost::hash<point> point_hasher;
+
+    point p1(0, 0);
+    point p2(1, 2);
+    point p3(4, 1);
+    point p4 = p1;
+
+    assert(point_hasher(p1) == point_hasher(p4));
+
+    // These tests could legally fail, but if they did it'd be a pretty bad
+    // hash function.
+    assert(point_hasher(p1) != point_hasher(p2));
+    assert(point_hasher(p1) != point_hasher(p3));
+
+    return 0;
+}
+
diff --git a/libs/functional/hash/examples/portable.cpp b/libs/functional/hash/examples/portable.cpp
new file mode 100644
index 0000000..94b2e0e
--- /dev/null
+++ b/libs/functional/hash/examples/portable.cpp
@@ -0,0 +1,54 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include <boost/functional/hash.hpp>
+#include <cassert>
+
+// This example illustrates how to customise ndnboost::hash portably, so that
+// it'll work on both compilers that don't implement argument dependent lookup
+// and compilers that implement strict two-phase template instantiation.
+
+namespace foo
+{
+    template <class T>
+    class custom_type
+    {
+        T value;
+    public:
+        custom_type(T x) : value(x) {}
+
+        std::size_t hash() const
+        {
+            ndnboost::hash<T> hasher;
+            return hasher(value);
+        }
+    };
+}
+
+#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+namespace ndnboost
+#else
+namespace foo
+#endif
+{
+    template <class T>
+    std::size_t hash_value(foo::custom_type<T> x)
+    {
+        return x.hash();
+    }
+}
+
+int main()
+{
+    foo::custom_type<int> x(1), y(2), z(1);
+
+    ndnboost::hash<foo::custom_type<int> > hasher;
+
+    assert(hasher(x) == hasher(x));
+    assert(hasher(x) != hasher(y));
+    assert(hasher(x) == hasher(z));
+
+    return 0;
+}
diff --git a/libs/functional/hash/examples/template.cpp b/libs/functional/hash/examples/template.cpp
new file mode 100644
index 0000000..d58ef5c
--- /dev/null
+++ b/libs/functional/hash/examples/template.cpp
@@ -0,0 +1,18 @@
+
+// Copyright 2012 Daniel James.
+// 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)
+
+#include "template.hpp"
+#include <cassert>
+#include <boost/unordered_set.hpp>
+
+int main()
+{
+    typedef my_pair<int, float> pair;
+    ndnboost::unordered_set<pair> pair_set;
+    pair_set.emplace(10, 0.5f);
+
+    assert(pair_set.find(pair(10, 0.5f)) != pair_set.end());
+    assert(pair_set.find(pair(10, 0.6f)) == pair_set.end());
+}
diff --git a/libs/functional/hash/examples/template.hpp b/libs/functional/hash/examples/template.hpp
new file mode 100644
index 0000000..1817a9d
--- /dev/null
+++ b/libs/functional/hash/examples/template.hpp
@@ -0,0 +1,36 @@
+
+// Copyright 2012 Daniel James.
+// 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)
+
+// This is an example of how to write a hash function for a template
+// class.
+
+#include <boost/functional/hash_fwd.hpp>
+
+template <typename A, typename B>
+class my_pair
+{
+    A value1;
+    B value2;
+public:
+    my_pair(A const& v1, B const& v2)
+        : value1(v1), value2(v2)
+    {}
+
+    bool operator==(my_pair const& other) const
+    {
+        return value1 == other.value1 &&
+            value2 == other.value2;
+    }
+
+    friend std::size_t hash_value(my_pair const& p)
+    {
+        std::size_t seed = 0;
+        ndnboost::hash_combine(seed, p.value1);
+        ndnboost::hash_combine(seed, p.value2);
+
+        return seed;
+    }
+};
+
diff --git a/libs/functional/hash/index.html b/libs/functional/hash/index.html
new file mode 100644
index 0000000..12b5757
--- /dev/null
+++ b/libs/functional/hash/index.html
@@ -0,0 +1,16 @@
+
+<!--
+Copyright 2005-2007 Daniel James.
+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)
+-->
+
+<html>
+<head>
+    <meta http-equiv="refresh" content="0; URL=../../../doc/html/hash.html">
+</head>
+<body>
+Automatic redirection failed, please go to
+<a href="../../../doc/html/hash.html">../../../doc/html/hash.html</a>
+</body>
+</html>
diff --git a/libs/functional/hash/test/Jamfile.v2 b/libs/functional/hash/test/Jamfile.v2
new file mode 100755
index 0000000..2767bf3
--- /dev/null
+++ b/libs/functional/hash/test/Jamfile.v2
@@ -0,0 +1,81 @@
+
+# Copyright 2005-2012 Daniel James.
+# 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)
+
+import testing ;
+
+project hash-tests
+    : requirements
+        <warnings>all
+        <toolset>intel:<warnings>on
+        #<toolset>intel:<cxxflags>-strict-ansi
+        <toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow"
+        <toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow"
+        #<toolset>msvc:<warnings-as-errors>on
+        #<toolset>gcc:<warnings-as-errors>on
+        #<toolset>darwin:<warnings-as-errors>on
+    ;
+
+test-suite functional/hash
+    :
+        [ run hash_fwd_test_1.cpp ]
+        [ run hash_fwd_test_2.cpp ]
+        [ run hash_number_test.cpp ]
+        [ run hash_enum_test.cpp ]
+        [ run hash_pointer_test.cpp ]
+        [ run hash_function_pointer_test.cpp ]
+        [ run hash_float_test.cpp ]
+        [ run hash_long_double_test.cpp ]
+        [ run hash_string_test.cpp ]
+        [ run hash_range_test.cpp ]
+        [ run hash_custom_test.cpp ]
+        [ run hash_global_namespace_test.cpp ]
+        [ run hash_friend_test.cpp ]
+        [ run hash_built_in_array_test.cpp ]
+        [ run hash_value_array_test.cpp ]
+        [ run hash_vector_test.cpp ]
+        [ run hash_list_test.cpp ]
+        [ run hash_deque_test.cpp ]
+        [ run hash_set_test.cpp ]
+        [ run hash_map_test.cpp ]
+        [ run hash_complex_test.cpp ]
+        [ run hash_type_index_test.cpp ]
+        [ run hash_std_array_test.cpp ]
+        [ run hash_std_tuple_test.cpp ]
+        [ run hash_std_smart_ptr_test.cpp ]
+        [ run link_test.cpp link_test_2.cpp ]
+        [ run link_ext_test.cpp link_no_ext_test.cpp ]
+        [ run extensions_hpp_test.cpp ]
+        [ compile-fail hash_no_ext_fail_test.cpp ]
+        [ compile-fail namespace_fail_test.cpp ]
+        [ run implicit_test.cpp ]
+        [ run hash_no_ext_macro_1.cpp ]
+        [ run hash_no_ext_macro_2.cpp ]
+    ;
+
+test-suite functional/hash_no_ext
+    :
+        [ run hash_number_test.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_number_test ]
+        [ run hash_pointer_test.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_pointer_test ]
+        [ run hash_function_pointer_test.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_function_pointer_test ]
+        [ run hash_float_test.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_float_test ]
+        [ run hash_long_double_test.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_long_double_test ]
+        [ run hash_string_test.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_string_test ]
+        [ run link_test.cpp link_test_2.cpp : : : <define>BOOST_HASH_NO_EXTENSIONS : no_ext_link_test ]
+    ;
+
+# Tests to see if the floating point hash is using the binary hash.
+# Not run normally because on some platforms these should fail.
+test-suite functional/hash_no_generic_float
+    :
+        [ run hash_float_test.cpp
+            : : : <define>BOOST_HASH_DETAIL_TEST_WITHOUT_GENERIC
+            : hash_float_test_no_generic ]
+        [ run hash_long_double_test.cpp
+            : : : <define>BOOST_HASH_DETAIL_TEST_WITHOUT_GENERIC
+            : hash_long_double_test_no_generic ]
+    ;
+explicit functional/hash_no_generic_float ;
+
+build-project ../examples ;
diff --git a/libs/functional/hash/test/compile_time.hpp b/libs/functional/hash/test/compile_time.hpp
new file mode 100644
index 0000000..0e445d5
--- /dev/null
+++ b/libs/functional/hash/test/compile_time.hpp
@@ -0,0 +1,16 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include <boost/config.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_base_and_derived.hpp>
+
+template <class T>
+void compile_time_tests(T*)
+{
+    BOOST_STATIC_ASSERT((ndnboost::is_base_and_derived<
+        std::unary_function<T, std::size_t>, BOOST_HASH_TEST_NAMESPACE::hash<T> >::value));
+}
+
diff --git a/libs/functional/hash/test/config.hpp b/libs/functional/hash/test/config.hpp
new file mode 100644
index 0000000..5a1422f
--- /dev/null
+++ b/libs/functional/hash/test/config.hpp
@@ -0,0 +1,21 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#if defined(BOOST_HASH_TEST_STD)
+#  define BOOST_HASH_TEST_STD_INCLUDES
+#  define BOOST_HASH_TEST_NAMESPACE std
+#else
+#  define BOOST_HASH_TEST_NAMESPACE ndnboost
+#  if !defined(BOOST_HASH_NO_EXTENSIONS)
+#    define BOOST_HASH_TEST_EXTENSIONS
+#  endif
+#endif
+
+#if defined(_WIN32_WCE)
+// The standard windows mobile headers trigger this warning so I disable it
+// before doing anything else.
+#pragma warning(disable:4201)   // nonstandard extension used :
+                                // nameless struct/union
+#endif
diff --git a/libs/functional/hash/test/extensions_hpp_test.cpp b/libs/functional/hash/test/extensions_hpp_test.cpp
new file mode 100644
index 0000000..45f6f8f
--- /dev/null
+++ b/libs/functional/hash/test/extensions_hpp_test.cpp
@@ -0,0 +1,19 @@
+
+// Copyright 2009 Daniel James.
+// 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)
+
+// Check that boost/functional/hash/extensions.hpp works okay.
+//
+// It probably should be in boost/functional/hash/detail, but since it isn't it
+// should work.
+
+#include "./config.hpp"
+
+#include <boost/functional/hash/extensions.hpp>
+
+int main() {
+    int x[2] = { 2, 3 };
+    ndnboost::hash<int[2]> hf;
+    hf(x);
+}
diff --git a/libs/functional/hash/test/extra/Jamfile.v2 b/libs/functional/hash/test/extra/Jamfile.v2
new file mode 100644
index 0000000..243c1b1
--- /dev/null
+++ b/libs/functional/hash/test/extra/Jamfile.v2
@@ -0,0 +1,13 @@
+
+# Copyright 2012 Daniel James.
+# 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)
+
+import testing ;
+
+build-project .. ;
+
+test-suite functional/hash/config
+    :
+        [ compile check_float_funcs.cpp ]
+    ;
\ No newline at end of file
diff --git a/libs/functional/hash/test/extra/check_float_funcs.cpp b/libs/functional/hash/test/extra/check_float_funcs.cpp
new file mode 100644
index 0000000..41817ba
--- /dev/null
+++ b/libs/functional/hash/test/extra/check_float_funcs.cpp
@@ -0,0 +1,58 @@
+
+// Copyright 2012 Daniel James.
+// 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)
+
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <cmath>
+
+namespace test
+{
+    template <class T1>
+    struct check_return_type
+    {
+        template <class T2>
+        static void equals(T2)
+        {
+            BOOST_STATIC_ASSERT((ndnboost::is_same<T1, T2>::value));
+        }
+
+        template <class T2>
+        static void equals_ref(T2&)
+        {
+            BOOST_STATIC_ASSERT((ndnboost::is_same<T1, T2>::value));
+        }
+
+        template <class T2>
+        static void convertible(T2)
+        {
+            BOOST_STATIC_ASSERT((ndnboost::is_convertible<T2, T1>::value));
+        }
+    };
+}
+
+int main() {
+    float f = 0;
+    double d = 0;
+    long double l = 0;
+
+    test::check_return_type<float>::equals(std::ldexp(f, 0));
+    test::check_return_type<double>::equals(std::ldexp(d, 0));
+    test::check_return_type<long double>::equals(std::ldexp(l, 0));
+
+    int dummy = 0;
+
+    test::check_return_type<float>::equals(std::frexp(f, &dummy));
+    test::check_return_type<double>::equals(std::frexp(d, &dummy));
+    test::check_return_type<long double>::equals(std::frexp(l, &dummy));
+
+#if BOOST_HASH_USE_FPCLASSIFY
+
+    int (*fpc1)(float) = std::fpclassify;
+    int (*fpc2)(double) = std::fpclassify;
+    int (*fpc3)(long double) = std::fpclassify;
+
+#endif
+}
diff --git a/libs/functional/hash/test/hash_built_in_array_test.cpp b/libs/functional/hash/test/hash_built_in_array_test.cpp
new file mode 100644
index 0000000..926f385
--- /dev/null
+++ b/libs/functional/hash/test/hash_built_in_array_test.cpp
@@ -0,0 +1,75 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+#  ifdef BOOST_HASH_TEST_STD_INCLUDES
+#    include <functional>
+#  else
+#    include <boost/functional/hash.hpp>
+#  endif
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+void array_int_test()
+{
+    const int length1 = 25;
+    int array1[25] = {
+        26, -43, 32, 65, 45,
+        12, 67, 32, 12, 23,
+        0, 0, 0, 0, 0,
+        8, -12, 23, 65, 45,
+        -1, 93, -54, 987, 3
+    };
+    BOOST_HASH_TEST_NAMESPACE::hash<int[25]> hasher1;
+
+    const int length2 = 1;
+    int array2[1] = {3};
+    BOOST_HASH_TEST_NAMESPACE::hash<int[1]> hasher2;
+
+    const int length3 = 2;
+    int array3[2] = {2, 3};
+    BOOST_HASH_TEST_NAMESPACE::hash<int[2]> hasher3;
+
+    BOOST_TEST(hasher1(array1)
+            == BOOST_HASH_TEST_NAMESPACE::hash_range(array1, array1 + length1));
+    BOOST_TEST(hasher2(array2)
+            == BOOST_HASH_TEST_NAMESPACE::hash_range(array2, array2 + length2));
+    BOOST_TEST(hasher3(array3)
+            == BOOST_HASH_TEST_NAMESPACE::hash_range(array3, array3 + length3));
+}
+
+void two_dimensional_array_test()
+{
+    int array[3][2] = {{-5, 6}, {7, -3}, {26, 1}};
+    BOOST_HASH_TEST_NAMESPACE::hash<int[3][2]> hasher;
+
+    std::size_t seed1 = 0;
+    for(int i = 0; i < 3; ++i)
+    {
+        std::size_t seed2 = 0;
+        for(int j = 0; j < 2; ++j)
+            BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, array[i][j]);
+        BOOST_HASH_TEST_NAMESPACE::hash_combine(seed1, seed2);
+    }
+
+    BOOST_TEST(hasher(array) == seed1);
+    BOOST_TEST(hasher(array) == BOOST_HASH_TEST_NAMESPACE::hash_range(array, array + 3));
+}
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+    array_int_test();
+    two_dimensional_array_test();
+#endif
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_complex_test.cpp b/libs/functional/hash/test/hash_complex_test.cpp
new file mode 100644
index 0000000..f8641d2
--- /dev/null
+++ b/libs/functional/hash/test/hash_complex_test.cpp
@@ -0,0 +1,110 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#if !defined(BOOST_HASH_TEST_EXTENSIONS)
+
+int main() {}
+
+#else
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+#  include <functional>
+#else
+#  include <boost/functional/hash.hpp>
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable:4244)   // conversion from 'unsigned long' to
+                                // 'unsigned short', possible loss of data
+#pragma warning(disable:4245)   // conversion from 'int' to
+                                // 'const unsigned short',
+                                // signed/unsigned mismatch
+#pragma warning(disable:4305)   // truncation from 'double' to
+                                // 'const std::complex<float>::_Ty'
+#pragma warning(disable:4309)   // truncation of constant value
+#pragma warning(disable:4512)   // assignment operator could not be generated
+#if BOOST_MSVC < 1400
+#pragma warning(disable:4267)   // conversion from 'size_t' to 'unsigned int',
+                                // possible loss of data
+#endif
+#endif
+
+#if defined(__GNUC__) && !defined(BOOST_INTEL_CXX_VERSION)
+#pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
+
+#include <complex>
+#include <sstream>
+#include <boost/limits.hpp>
+
+template <class T>
+void generic_complex_tests(std::complex<T> v)
+{
+    BOOST_HASH_TEST_NAMESPACE::hash<std::complex<T> > complex_hasher;
+
+    BOOST_TEST(complex_hasher(v) == complex_hasher(v));
+
+    BOOST_HASH_TEST_NAMESPACE::hash<T> real_hasher;
+    T real = v.real();
+    T imag = v.imag();
+
+    BOOST_TEST(real_hasher(real) == complex_hasher(std::complex<T>(real)));
+
+    if(imag != 0 && real_hasher(real) == complex_hasher(v)) {
+        std::ostringstream os;
+        os<<"real_hasher("<<real<<") == complex_hasher("
+            <<v.real()<<" + "<<v.imag()<<"i) == "
+            <<real_hasher(real)<<" (This might not be a bug).";
+        BOOST_ERROR(os.str().c_str());
+    }
+}
+
+template <class Float>
+void complex_float_tests(Float*)
+{
+    typedef std::complex<Float> complex;
+    generic_complex_tests(complex(0,0));
+    generic_complex_tests(complex(0.5,0));
+    generic_complex_tests(complex(25,0));
+    generic_complex_tests(complex(25,0));
+    generic_complex_tests(complex(static_cast<Float>(-67.5324535),static_cast<Float>(56.23578678)));
+}
+
+template <class Integer>
+void complex_integral_tests(Integer*)
+{
+    typedef std::complex<Integer> complex;
+    generic_complex_tests(complex(0,0));
+    generic_complex_tests(complex(15342,124));
+    generic_complex_tests(complex(25,54356));
+    generic_complex_tests(complex(5325,2346));
+    generic_complex_tests(complex(-243897,-49923874));
+    generic_complex_tests(complex(-543,763));
+}
+
+int main()
+{
+    // I've comments out the short and unsigned short tests
+    // as they cause warnings and don't really test
+    // anything that the other tests already deal with.
+
+    complex_float_tests((float*) 0);
+    complex_float_tests((double*) 0);
+    complex_float_tests((long double*) 0);
+    //complex_integral_tests((short*) 0);
+    complex_integral_tests((int*) 0);
+    complex_integral_tests((long*) 0);
+    //complex_integral_tests((unsigned short*) 0);
+    complex_integral_tests((unsigned int*) 0);
+    complex_integral_tests((unsigned long*) 0);
+
+    return ndnboost::report_errors();
+}
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
diff --git a/libs/functional/hash/test/hash_custom_test.cpp b/libs/functional/hash/test/hash_custom_test.cpp
new file mode 100644
index 0000000..ca2a310
--- /dev/null
+++ b/libs/functional/hash/test/hash_custom_test.cpp
@@ -0,0 +1,100 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+#include <boost/config.hpp>
+#include <cstddef>
+
+namespace test
+{
+    struct custom
+    {
+        int value_;
+
+        std::size_t hash() const
+        {
+            return value_ * 10;
+        }
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+        friend std::size_t hash_value(custom const& x )
+        {
+            return x.hash();
+        }
+#endif
+
+        custom(int x) : value_(x) {}
+    };
+}
+
+#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+namespace ndnboost
+{
+    std::size_t hash_value(test::custom x)
+    {
+        return x.hash();
+    }
+}
+#endif
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+#  ifdef BOOST_HASH_TEST_STD_INCLUDES
+#    include <functional>
+#  else
+#    include <boost/functional/hash.hpp>
+#  endif
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <vector>
+#include <string>
+#include <cctype>
+
+void custom_tests()
+{
+    BOOST_HASH_TEST_NAMESPACE::hash<test::custom> custom_hasher;
+    BOOST_TEST(custom_hasher(10) == 100u);
+    test::custom x(55);
+    BOOST_TEST(custom_hasher(x) == 550u);
+
+    {
+        using namespace BOOST_HASH_TEST_NAMESPACE;
+        BOOST_TEST(custom_hasher(x) == hash_value(x));
+    }
+
+    std::vector<test::custom> custom_vector;
+    custom_vector.push_back(5);
+    custom_vector.push_back(25);
+    custom_vector.push_back(35);
+
+    std::size_t seed = 0;
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom(5));
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom(25));
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom(35));
+
+    std::size_t seed2 = 0;
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 50u);
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 250u);
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 350u);
+
+    BOOST_TEST(seed == BOOST_HASH_TEST_NAMESPACE::hash_range(
+        custom_vector.begin(), custom_vector.end()));
+    BOOST_TEST(seed == seed2);
+}
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+    custom_tests();
+#endif
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_deque_test.cpp b/libs/functional/hash/test/hash_deque_test.cpp
new file mode 100644
index 0000000..dda9d40
--- /dev/null
+++ b/libs/functional/hash/test/hash_deque_test.cpp
@@ -0,0 +1,35 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+#  ifdef BOOST_HASH_TEST_STD_INCLUDES
+#    include <functional>
+#  else
+#    include <boost/functional/hash.hpp>
+#  endif
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <deque>
+
+using std::deque;
+#define CONTAINER_TYPE deque
+#include "./hash_sequence_test.hpp"
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+    deque_tests::deque_hash_integer_tests();
+#endif
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_enum_test.cpp b/libs/functional/hash/test/hash_enum_test.cpp
new file mode 100644
index 0000000..781387a
--- /dev/null
+++ b/libs/functional/hash/test/hash_enum_test.cpp
@@ -0,0 +1,63 @@
+
+// Copyright 2012 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+#  include <functional>
+#else
+#  include <boost/functional/hash.hpp>
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include "./compile_time.hpp"
+
+namespace test {
+    enum enum_override { enum_override1, enum_override2 };
+    std::size_t hash_value(enum_override) { return 896532; }
+
+    enum enum1 { enum1a };
+    enum enum2 { enum2a, enum2b };
+    enum enum3 { enum3a = 574, enum3b };
+    enum enum4 { enum4a = -12574, enum4b };
+}
+
+int main() {
+    compile_time_tests((test::enum1*) 0);
+    compile_time_tests((test::enum2*) 0);
+    compile_time_tests((test::enum3*) 0);
+    compile_time_tests((test::enum4*) 0);
+    compile_time_tests((test::enum_override*) 0);
+
+    BOOST_HASH_TEST_NAMESPACE::hash<test::enum1> hash1;
+    BOOST_HASH_TEST_NAMESPACE::hash<test::enum2> hash2;
+    BOOST_HASH_TEST_NAMESPACE::hash<test::enum3> hash3;
+    BOOST_HASH_TEST_NAMESPACE::hash<test::enum4> hash4;
+
+    BOOST_TEST(hash1(test::enum1a) == hash1(test::enum1a));
+
+    BOOST_TEST(hash2(test::enum2a) == hash2(test::enum2a));
+    BOOST_TEST(hash2(test::enum2a) != hash2(test::enum2b));
+    BOOST_TEST(hash2(test::enum2b) == hash2(test::enum2b));
+
+    BOOST_TEST(hash3(test::enum3a) == hash3(test::enum3a));
+    BOOST_TEST(hash3(test::enum3a) != hash3(test::enum3b));
+    BOOST_TEST(hash3(test::enum3b) == hash3(test::enum3b));
+
+    BOOST_TEST(hash4(test::enum4a) == hash4(test::enum4a));
+    BOOST_TEST(hash4(test::enum4a) != hash4(test::enum4b));
+    BOOST_TEST(hash4(test::enum4b) == hash4(test::enum4b));
+
+    BOOST_HASH_TEST_NAMESPACE::hash<test::enum_override> hash_override;
+
+    BOOST_TEST(hash_override(test::enum_override1) ==
+        hash_override(test::enum_override1));
+    BOOST_TEST(hash_override(test::enum_override1) ==
+        hash_override(test::enum_override2));
+    BOOST_TEST(hash_override(test::enum_override1) ==
+        hash_override(test::enum_override1));
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_float_test.cpp b/libs/functional/hash/test/hash_float_test.cpp
new file mode 100644
index 0000000..69cd508
--- /dev/null
+++ b/libs/functional/hash/test/hash_float_test.cpp
@@ -0,0 +1,18 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "hash_float_test.hpp"
+
+int main()
+{
+    std::cerr<<"Compiler: "<<BOOST_COMPILER<<"\n";
+    std::cerr<<"Platform: "<<BOOST_PLATFORM<<"\n";
+    std::cerr<<"Library: "<<BOOST_STDLIB<<"\n\n";
+
+    float_tests("float", (float*) 0);
+    float_tests("double", (double*) 0);
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_float_test.hpp b/libs/functional/hash/test/hash_float_test.hpp
new file mode 100644
index 0000000..96693a9
--- /dev/null
+++ b/libs/functional/hash/test/hash_float_test.hpp
@@ -0,0 +1,309 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+#  include <functional>
+#else
+#  include <boost/functional/hash.hpp>
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+#include <cmath>
+#include <boost/functional/hash/detail/limits.hpp>
+#include <boost/functional/hash/detail/float_functions.hpp>
+#include <boost/detail/workaround.hpp>
+
+#include <iostream>
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4127)   // conditional expression is constant
+#pragma warning(disable:4723)   // conditional expression is constant
+#if BOOST_MSVC < 1400
+#pragma warning(disable:4267)   // conversion from 'size_t' to 'unsigned int',
+                                // possible loss of data
+#endif
+#endif
+
+#if defined(__GNUC__) && !defined(BOOST_INTEL_CXX_VERSION)
+#pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
+
+char const* float_type(float*) { return "float"; }
+char const* float_type(double*) { return "double"; }
+char const* float_type(long double*) { return "long double"; }
+
+template <class T>
+void float_tests(char const* name, T* = 0)
+{
+    std::cerr
+        <<  "\n"
+        <<  "Testing " BOOST_STRINGIZE(BOOST_HASH_TEST_NAMESPACE) "::hash<"
+        <<  name
+        <<  ">\n"
+        <<  "\n"
+        <<  "ndnboost::hash_detail::limits<T>::digits = "
+        <<  ndnboost::hash_detail::limits<T>::digits<< "\n"
+        <<  "ndnboost::hash_detail::limits<int>::digits = "
+        <<  ndnboost::hash_detail::limits<int>::digits<< "\n"
+        <<  "ndnboost::hash_detail::limits<std::size_t>::digits = "
+        <<  ndnboost::hash_detail::limits<std::size_t>::digits
+        <<  "\n"
+        <<  "\n"
+        <<  "ndnboost::hash_detail::call_ldexp<T>::float_type = "
+        <<  float_type(static_cast<BOOST_DEDUCED_TYPENAME
+                ndnboost::hash_detail::call_ldexp<T>::float_type*>(0))
+        <<  "\n"
+        <<  "ndnboost::hash_detail::call_frexp<T>::float_type = "
+        <<  float_type(static_cast<BOOST_DEDUCED_TYPENAME
+                ndnboost::hash_detail::call_frexp<T>::float_type*>(0))
+        <<  "\n"
+        <<  "ndnboost::hash_detail::select_hash_type<T>::type = "
+        <<  float_type(static_cast<BOOST_DEDUCED_TYPENAME
+                ndnboost::hash_detail::select_hash_type<T>::type*>(0))
+        <<  "\n"
+        <<  "\n"
+        ;
+
+    BOOST_HASH_TEST_NAMESPACE::hash<T> x1;
+
+    T zero = 0;
+    T minus_zero = (T) -1 * zero;
+
+    BOOST_TEST(zero == minus_zero);
+    BOOST_TEST(x1(zero) == x1(minus_zero));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    BOOST_TEST(x1(zero) == BOOST_HASH_TEST_NAMESPACE::hash_value(zero));
+    BOOST_TEST(x1(minus_zero) == BOOST_HASH_TEST_NAMESPACE::hash_value(minus_zero));
+#endif
+
+    BOOST_TEST(x1(zero) != x1(0.5));
+    BOOST_TEST(x1(minus_zero) != x1(0.5));
+    BOOST_TEST(x1(0.5) != x1(-0.5));
+    BOOST_TEST(x1(1) != x1(-1));
+
+    using namespace std;
+
+// Doing anything with infinity causes borland to crash.
+#if defined(__BORLANDC__)
+    std::cerr
+        <<  "Not running infinity checks on Borland, as it causes it to crash."
+            "\n";
+#else
+    if(ndnboost::hash_detail::limits<T>::has_infinity) {
+        T infinity = -log(zero);
+        T infinity2 = (T) 1. / zero;
+        T infinity3 = (T) -1. / minus_zero;
+        T infinity4 = ndnboost::hash_detail::limits<T>::infinity();
+
+        T minus_infinity = log(zero);
+        T minus_infinity2 = (T) -1. / zero;
+        T minus_infinity3 = (T) 1. / minus_zero;
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+        BOOST_TEST(x1(infinity) == BOOST_HASH_TEST_NAMESPACE::hash_value(infinity));
+        BOOST_TEST(x1(minus_infinity)
+                == BOOST_HASH_TEST_NAMESPACE::hash_value(minus_infinity));
+#endif
+
+        if(infinity == infinity2)
+            BOOST_TEST(x1(infinity) == x1(infinity2));
+        if(infinity == infinity3)
+            BOOST_TEST(x1(infinity) == x1(infinity3));
+        if(infinity == infinity4)
+            BOOST_TEST(x1(infinity) == x1(infinity4));
+
+        if(minus_infinity == minus_infinity2)
+            BOOST_TEST(x1(minus_infinity) == x1(minus_infinity2));
+        if(minus_infinity == minus_infinity3)
+            BOOST_TEST(x1(minus_infinity) == x1(minus_infinity3));
+
+        BOOST_TEST(infinity != minus_infinity);
+
+        if(x1(infinity) == x1(minus_infinity)) {
+            std::cerr<<"x1(infinity) == x1(-infinity) == "<<x1(infinity)<<"\n";
+        }
+
+        // This should really be 'has_denorm == denorm_present' but some
+        // compilers don't have 'denorm_present'. See also a later use.
+        if(ndnboost::hash_detail::limits<T>::has_denorm) {
+            if(x1(ndnboost::hash_detail::limits<T>::denorm_min()) == x1(infinity))
+            {
+                std::cerr
+                    <<  "x1(denorm_min) == x1(infinity) == "
+                    <<  x1(infinity)
+                    <<  "\n";
+            }
+
+            if(x1(ndnboost::hash_detail::limits<T>::denorm_min()) ==
+                x1(minus_infinity))
+            {
+                std::cerr
+                    <<  "x1(denorm_min) == x1(-infinity) == "
+                    <<  x1(minus_infinity)
+                    <<  "\n";
+            }
+        }
+
+        if(ndnboost::hash_detail::limits<T>::has_quiet_NaN) {
+            if(x1(ndnboost::hash_detail::limits<T>::quiet_NaN()) == x1(infinity))
+            {
+                std::cerr
+                    <<  "x1(quiet_NaN) == x1(infinity) == "
+                    <<  x1(infinity)
+                    <<  "\n";
+            }
+
+            if(x1(ndnboost::hash_detail::limits<T>::quiet_NaN()) ==
+                x1(minus_infinity))
+            {
+                std::cerr
+                    <<  "x1(quiet_NaN) == x1(-infinity) == "
+                    <<  x1(minus_infinity)
+                    <<  "\n";
+            }
+        }
+    }
+#endif
+
+    T max = (ndnboost::hash_detail::limits<T>::max)();
+    T half_max = max / 2;
+    T quarter_max = max / 4;
+    T three_quarter_max = max - quarter_max;
+    
+    // Check the limits::max is in range.
+    BOOST_TEST(max != half_max);
+    BOOST_TEST(max != quarter_max);
+    BOOST_TEST(max != three_quarter_max);
+    BOOST_TEST(half_max != quarter_max);
+    BOOST_TEST(half_max != three_quarter_max);
+    BOOST_TEST(quarter_max != three_quarter_max);
+
+    BOOST_TEST(max != -max);
+    BOOST_TEST(half_max != -half_max);
+    BOOST_TEST(quarter_max != -quarter_max);
+    BOOST_TEST(three_quarter_max != -three_quarter_max);
+
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    BOOST_TEST(x1(max) == BOOST_HASH_TEST_NAMESPACE::hash_value(max));
+    BOOST_TEST(x1(half_max) == BOOST_HASH_TEST_NAMESPACE::hash_value(half_max));
+    BOOST_TEST(x1(quarter_max) == BOOST_HASH_TEST_NAMESPACE::hash_value(quarter_max));
+    BOOST_TEST(x1(three_quarter_max) ==
+        BOOST_HASH_TEST_NAMESPACE::hash_value(three_quarter_max));
+#endif
+
+    // The '!=' tests could legitimately fail, but with my hash it indicates a
+    // bug.
+    BOOST_TEST(x1(max) == x1(max));
+    BOOST_TEST(x1(max) != x1(quarter_max));
+    BOOST_TEST(x1(max) != x1(half_max));
+    BOOST_TEST(x1(max) != x1(three_quarter_max));
+    BOOST_TEST(x1(quarter_max) == x1(quarter_max));
+    BOOST_TEST(x1(quarter_max) != x1(half_max));
+    BOOST_TEST(x1(quarter_max) != x1(three_quarter_max));
+    BOOST_TEST(x1(half_max) == x1(half_max));
+    BOOST_TEST(x1(half_max) != x1(three_quarter_max));
+    BOOST_TEST(x1(three_quarter_max) == x1(three_quarter_max));
+
+    BOOST_TEST(x1(max) != x1(-max));
+    BOOST_TEST(x1(half_max) != x1(-half_max));
+    BOOST_TEST(x1(quarter_max) != x1(-quarter_max));
+    BOOST_TEST(x1(three_quarter_max) != x1(-three_quarter_max));
+
+
+// Intel with gcc stdlib sometimes segfaults on calls to asin and acos.
+#if !((defined(__INTEL_COMPILER) || defined(__ICL) || \
+        defined(__ICC) || defined(__ECC)) && \
+    (defined(__GLIBCPP__) || defined(__GLIBCXX__)))
+    T v1 = asin((T) 1);
+    T v2 = acos((T) 0);
+    if(v1 == v2)
+        BOOST_TEST(x1(v1) == x1(v2));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    BOOST_TEST(x1(v1) == BOOST_HASH_TEST_NAMESPACE::hash_value(v1));
+    BOOST_TEST(x1(v2) == BOOST_HASH_TEST_NAMESPACE::hash_value(v2));
+#endif
+    
+#endif
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    BOOST_TEST(x1(ndnboost::hash_detail::limits<T>::epsilon()) ==
+            BOOST_HASH_TEST_NAMESPACE::hash_value(
+                ndnboost::hash_detail::limits<T>::epsilon()));
+#endif
+
+    BOOST_TEST(ndnboost::hash_detail::limits<T>::epsilon() != (T) 0);
+    if(x1(ndnboost::hash_detail::limits<T>::epsilon()) == x1((T) 0))
+        std::cerr<<"x1(epsilon) == x1(0) == "<<x1((T) 0)<<"\n";
+
+    BOOST_TEST(-ndnboost::hash_detail::limits<T>::epsilon() != (T) 0);
+    if(x1(-ndnboost::hash_detail::limits<T>::epsilon()) == x1((T) 0))
+        std::cerr<<"x1(-epsilon) == x1(0) == "<<x1((T) 0)<<"\n";
+
+    BOOST_TEST((T) 1 + ndnboost::hash_detail::limits<T>::epsilon() != (T) 1);
+    if(x1((T) 1 + ndnboost::hash_detail::limits<T>::epsilon()) == x1((T) 1))
+        std::cerr<<"x1(1 + epsilon) == x1(1) == "<<x1((T) 1)<<"\n";
+
+    BOOST_TEST((T) 1 - ndnboost::hash_detail::limits<T>::epsilon() != (T) 1);
+    if(x1((T) 1 - ndnboost::hash_detail::limits<T>::epsilon()) == x1((T) 1))
+        std::cerr<<"x1(1 - epsilon) == x1(1) == "<<x1((T) 1)<<"\n";
+
+    BOOST_TEST((T) -1 + ndnboost::hash_detail::limits<T>::epsilon() != (T) -1);
+    if(x1((T) -1 + ndnboost::hash_detail::limits<T>::epsilon()) == x1((T) -1))
+        std::cerr<<"x1(-1 + epsilon) == x1(-1) == "<<x1((T) -1)<<"\n";
+
+    BOOST_TEST((T) -1 - ndnboost::hash_detail::limits<T>::epsilon() != (T) -1);
+    if(x1((T) -1 - ndnboost::hash_detail::limits<T>::epsilon()) == x1((T) -1))
+        std::cerr<<"x1(-1 - epsilon) == x1(-1) == "<<x1((T) -1)<<"\n";
+
+    // As before.
+    if(ndnboost::hash_detail::limits<T>::has_denorm) {
+        if(x1(ndnboost::hash_detail::limits<T>::denorm_min()) == x1(zero)) {
+            std::cerr<<"x1(denorm_min) == x1(zero) == "<<x1(zero)<<"\n";
+        }
+#if !BOOST_WORKAROUND(__DECCXX_VER,<70190006) && defined(BOOST_HASH_TEST_EXTENSIONS)
+        // The Tru64/CXX standard library prior to 7.1 contains a bug in the
+        // specialization of ndnboost::hash_detail::limits::denorm_min() for long
+        // doubles which causes this test to fail.
+        if(x1(ndnboost::hash_detail::limits<T>::denorm_min()) !=
+            BOOST_HASH_TEST_NAMESPACE::hash_value(
+                ndnboost::hash_detail::limits<T>::denorm_min()))
+        {
+            std::cerr
+                <<  "x1(ndnboost::hash_detail::limits<T>::denorm_min()) = "
+                <<  x1(ndnboost::hash_detail::limits<T>::denorm_min())
+                <<  "\nhash_value(ndnboost::hash_detail::limits<T>::denorm_min())"
+                    " = "
+                <<  BOOST_HASH_TEST_NAMESPACE::hash_value(
+                        ndnboost::hash_detail::limits<T>::denorm_min())
+                <<  "\nx1(0) = "
+                <<  x1(0)
+                <<  "\n";
+        }
+#endif
+    }
+
+// NaN also causes borland to crash.
+#if !defined(__BORLANDC__) && defined(BOOST_HASH_TEST_EXTENSIONS)
+    if(ndnboost::hash_detail::limits<T>::has_quiet_NaN) {
+        if(x1(ndnboost::hash_detail::limits<T>::quiet_NaN()) == x1(1.0)) {
+            std::cerr<<"x1(quiet_NaN) == x1(1.0) == "<<x1(1.0)<<"\n";
+        }
+        BOOST_TEST(x1(ndnboost::hash_detail::limits<T>::quiet_NaN()) ==
+            BOOST_HASH_TEST_NAMESPACE::hash_value(
+                ndnboost::hash_detail::limits<T>::quiet_NaN()));
+    }
+#endif
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
diff --git a/libs/functional/hash/test/hash_friend_test.cpp b/libs/functional/hash/test/hash_friend_test.cpp
new file mode 100644
index 0000000..66b9130
--- /dev/null
+++ b/libs/functional/hash/test/hash_friend_test.cpp
@@ -0,0 +1,103 @@
+
+// Copyright 2006-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#include <boost/config.hpp>
+#include <cstddef>
+
+namespace test
+{
+    template <class T>
+    struct custom
+    {
+        int value_;
+
+        std::size_t hash() const
+        {
+            return value_ * 10;
+        }
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+        friend std::size_t hash_value(custom const& x)
+        {
+            return x.hash();
+        }
+#endif
+
+        custom(int x) : value_(x) {}
+    };
+}
+
+#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+namespace ndnboost
+{
+    template <class T>
+    std::size_t hash_value(test::custom<T> x)
+    {
+        return x.hash();
+    }
+}
+#endif
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+#  ifdef BOOST_HASH_TEST_STD_INCLUDES
+#    include <functional>
+#  else
+#    include <boost/functional/hash.hpp>
+#  endif
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <vector>
+#include <string>
+#include <cctype>
+
+void custom_tests()
+{
+    BOOST_HASH_TEST_NAMESPACE::hash<test::custom<int> > custom_hasher;
+    BOOST_TEST(custom_hasher(10) == 100u);
+    test::custom<int> x(55);
+    BOOST_TEST(custom_hasher(x) == 550u);
+
+    {
+        using namespace BOOST_HASH_TEST_NAMESPACE;
+        BOOST_TEST(custom_hasher(x) == hash_value(x));
+    }
+
+    std::vector<test::custom<int> > custom_vector;
+    custom_vector.push_back(5);
+    custom_vector.push_back(25);
+    custom_vector.push_back(35);
+
+    std::size_t seed = 0;
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom<int>(5));
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom<int>(25));
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, test::custom<int>(35));
+
+    std::size_t seed2 = 0;
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 50u);
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 250u);
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 350u);
+
+    BOOST_TEST(seed == BOOST_HASH_TEST_NAMESPACE::hash_range(
+        custom_vector.begin(), custom_vector.end()));
+    BOOST_TEST(seed == seed2);
+}
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+    custom_tests();
+#endif
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_function_pointer_test.cpp b/libs/functional/hash/test/hash_function_pointer_test.cpp
new file mode 100644
index 0000000..eb78cc3
--- /dev/null
+++ b/libs/functional/hash/test/hash_function_pointer_test.cpp
@@ -0,0 +1,57 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+#  include <functional>
+#else
+#  include <boost/functional/hash.hpp>
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include "./compile_time.hpp"
+
+void void_func1() { static int x = 1; ++x; }
+void void_func2() { static int x = 2; --x; }
+int int_func1(int) { return 0; }
+int int_func2(int) { return 1; }
+
+void function_pointer_tests()
+{
+    compile_time_tests((void(**)()) 0);
+    compile_time_tests((int(**)(int)) 0);
+
+    BOOST_HASH_TEST_NAMESPACE::hash<void(*)()> hasher_void;
+    BOOST_HASH_TEST_NAMESPACE::hash<int(*)(int)> hasher_int;
+
+    BOOST_TEST(&void_func1 != &void_func2);
+    BOOST_TEST(&int_func1 != &int_func2);
+
+    BOOST_TEST(hasher_void(0) == hasher_void(0));
+    BOOST_TEST(hasher_void(&void_func1) == hasher_void(&void_func1));
+    BOOST_TEST(hasher_void(&void_func1) != hasher_void(&void_func2));
+    BOOST_TEST(hasher_void(&void_func1) != hasher_void(0));
+    BOOST_TEST(hasher_int(0) == hasher_int(0));
+    BOOST_TEST(hasher_int(&int_func1) == hasher_int(&int_func1));
+    BOOST_TEST(hasher_int(&int_func1) != hasher_int(&int_func2));
+    BOOST_TEST(hasher_int(&int_func1) != hasher_int(0));
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    BOOST_TEST(hasher_void(&void_func1)
+            == BOOST_HASH_TEST_NAMESPACE::hash_value(&void_func1));
+    BOOST_TEST(hasher_int(&int_func1)
+            == BOOST_HASH_TEST_NAMESPACE::hash_value(&int_func1));
+
+    // This isn't specified in Peter's proposal:
+    BOOST_TEST(hasher_void(0) == 0);
+#endif
+}
+
+int main()
+{
+    function_pointer_tests();
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_fwd_test.hpp b/libs/functional/hash/test/hash_fwd_test.hpp
new file mode 100644
index 0000000..e64017c
--- /dev/null
+++ b/libs/functional/hash/test/hash_fwd_test.hpp
@@ -0,0 +1,104 @@
+
+// Copyright 2006-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_HASH_TEST_STD_INCLUDES)
+#include <boost/functional/hash_fwd.hpp>
+
+#include <boost/config.hpp>
+#include <cstddef>
+#include <vector>
+
+namespace test {
+
+    template <class T>
+    struct test_type1
+    {
+        T value;
+        test_type1(T const& x) : value(x) {}
+    };
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+    template <class T>
+    std::size_t hash_value(test_type1<T> const& x)
+    {
+        BOOST_HASH_TEST_NAMESPACE::hash<T> hasher;
+        return hasher(x.value);
+    }
+#endif
+
+    template <class T>
+    struct test_type2
+    {
+        T value1, value2;
+        test_type2(T const& x, T const& y) : value1(x), value2(y) {}
+    };
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+    template <class T>
+    std::size_t hash_value(test_type2<T> const& x)
+    {
+        std::size_t seed = 0;
+        BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, x.value1);
+        BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, x.value2);
+        return seed;
+    }
+#endif
+
+    template <class T>
+    struct test_type3
+    {
+        std::vector<T> values;
+        test_type3(typename std::vector<T>::iterator x,
+                typename std::vector<T>::iterator y) : values(x, y) {}
+    };
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+    template <class T>
+    std::size_t hash_value(test_type3<T> const& x)
+    {
+        std::size_t seed =
+            BOOST_HASH_TEST_NAMESPACE::hash_range(x.values.begin(), x.values.end());
+        BOOST_HASH_TEST_NAMESPACE::hash_range(seed, x.values.begin(), x.values.end());
+        return seed;
+    }
+#endif
+
+}
+
+#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+
+namespace ndnboost
+{
+    template <class T>
+    std::size_t hash_value(test::test_type1<T> const& x)
+    {
+        BOOST_HASH_TEST_NAMESPACE::hash<T> hasher;
+        return hasher(x.value);
+    }
+
+    template <class T>
+    std::size_t hash_value(test::test_type2<T> const& x)
+    {
+        std::size_t seed = 0;
+        BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, x.value1);
+        BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, x.value2);
+        return seed;
+    }
+
+    template <class T>
+    std::size_t hash_value(test::test_type3<T> const& x)
+    {
+        std::size_t seed =
+            BOOST_HASH_TEST_NAMESPACE::hash_range(x.values.begin(), x.values.end());
+        BOOST_HASH_TEST_NAMESPACE::hash_range(seed, x.values.begin(), x.values.end());
+        return seed;
+    }
+}
+
+#endif
+
+#endif
diff --git a/libs/functional/hash/test/hash_fwd_test_1.cpp b/libs/functional/hash/test/hash_fwd_test_1.cpp
new file mode 100644
index 0000000..a3f1665
--- /dev/null
+++ b/libs/functional/hash/test/hash_fwd_test_1.cpp
@@ -0,0 +1,96 @@
+
+// Copyright 2006-2009 Daniel James.
+// 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)
+
+// This checks that template code implemented using hash_fwd will work.
+
+#include "./config.hpp"
+
+#include "./hash_fwd_test.hpp"
+
+#include <boost/detail/lightweight_test.hpp>
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_HASH_TEST_STD_INCLUDES)
+
+#include <boost/functional/hash.hpp>
+#include <string>
+
+void fwd_test1()
+{
+    test::test_type1<int> x(5);
+    test::test_type1<std::string> y("Test");
+
+    BOOST_HASH_TEST_NAMESPACE::hash<int> hasher_int;
+    BOOST_HASH_TEST_NAMESPACE::hash<std::string> hasher_string;
+    BOOST_HASH_TEST_NAMESPACE::hash<test::test_type1<int> > hasher_test_int;
+    BOOST_HASH_TEST_NAMESPACE::hash<test::test_type1<std::string> > hasher_test_string;
+
+    BOOST_TEST(hasher_int(5) == hasher_test_int(x));
+    BOOST_TEST(hasher_string("Test") == hasher_test_string(y));
+}
+
+void fwd_test2()
+{
+    test::test_type2<int> x(5, 10);
+    test::test_type2<std::string> y("Test1", "Test2");
+
+    std::size_t seed1 = 0;
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed1, 5);
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed1, 10);
+
+    std::size_t seed2 = 0;
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, std::string("Test1"));
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, std::string("Test2"));
+
+    BOOST_HASH_TEST_NAMESPACE::hash<test::test_type2<int> > hasher_test_int;
+    BOOST_HASH_TEST_NAMESPACE::hash<test::test_type2<std::string> > hasher_test_string;
+
+    BOOST_TEST(seed1 == hasher_test_int(x));
+    BOOST_TEST(seed2 == hasher_test_string(y));
+}
+
+void fwd_test3()
+{
+    std::vector<int> values1;
+    values1.push_back(10);
+    values1.push_back(15);
+    values1.push_back(20);
+    values1.push_back(3);
+
+    std::vector<std::string> values2;
+    values2.push_back("Chico");
+    values2.push_back("Groucho");
+    values2.push_back("Harpo");
+    values2.push_back("Gummo");
+    values2.push_back("Zeppo");
+
+    test::test_type3<int> x(values1.begin(), values1.end());
+    test::test_type3<std::string> y(values2.begin(), values2.end());
+
+    std::size_t seed1 =
+        BOOST_HASH_TEST_NAMESPACE::hash_range(values1.begin(), values1.end());
+    BOOST_HASH_TEST_NAMESPACE::hash_range(seed1, values1.begin(), values1.end());
+
+    std::size_t seed2 =
+        BOOST_HASH_TEST_NAMESPACE::hash_range(values2.begin(), values2.end());
+    BOOST_HASH_TEST_NAMESPACE::hash_range(seed2, values2.begin(), values2.end());
+
+    BOOST_HASH_TEST_NAMESPACE::hash<test::test_type3<int> > hasher_test_int;
+    BOOST_HASH_TEST_NAMESPACE::hash<test::test_type3<std::string> > hasher_test_string;
+
+    BOOST_TEST(seed1 == hasher_test_int(x));
+    BOOST_TEST(seed2 == hasher_test_string(y));
+}
+
+#endif
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+    fwd_test1();
+    fwd_test2();
+    fwd_test3();
+#endif
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_fwd_test_2.cpp b/libs/functional/hash/test/hash_fwd_test_2.cpp
new file mode 100644
index 0000000..f4f98f4
--- /dev/null
+++ b/libs/functional/hash/test/hash_fwd_test_2.cpp
@@ -0,0 +1,47 @@
+
+// Copyright 2006-2009 Daniel James.
+// 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)
+
+// This test just makes sure a header which uses hash_fwd can compile without
+// the main hash headers.
+
+#include "./config.hpp"
+
+#if !defined(BOOST_HASH_TEST_EXTENSIONS) || defined(BOOST_HASH_TEST_STD_INCLUDES)
+
+int main() {}
+
+#else
+
+#include "./hash_fwd_test.hpp"
+#include <boost/detail/lightweight_test.hpp>
+
+template <class T> void unused(T const&) {}
+
+void fwd_test()
+{
+    test::test_type1<int> x1(3);
+    test::test_type1<std::string> y1("Black");
+    test::test_type2<int> x2(25, 16);
+    test::test_type2<std::string> y2("White", "Green");
+
+    std::vector<int> empty;
+    std::vector<std::string> empty2;
+
+    test::test_type3<int> x3(empty.begin(), empty.end());
+    test::test_type3<std::string> y3(empty2.begin(), empty2.end());
+
+    // Prevent gcc warnings:
+    unused(x1); unused(x2); unused(x3);
+    unused(y1); unused(y2); unused(y3);
+}
+
+int main()
+{
+    fwd_test();
+
+    return ndnboost::report_errors();
+}
+
+#endif // defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_HASH_TEST_STD_INCLUDES)
diff --git a/libs/functional/hash/test/hash_global_namespace_test.cpp b/libs/functional/hash/test/hash_global_namespace_test.cpp
new file mode 100644
index 0000000..9f6c8dd
--- /dev/null
+++ b/libs/functional/hash/test/hash_global_namespace_test.cpp
@@ -0,0 +1,103 @@
+
+// Copyright 2006-2009 Daniel James.
+// 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)
+
+// This test demonstrates an ADL bug in Borland 5.5 where ADL isn't performed
+// in the global namespace.
+
+#include "./config.hpp"
+
+#include <boost/config.hpp>
+#include <cstddef>
+
+struct custom
+{
+    int value_;
+
+    std::size_t hash() const
+    {
+        return value_ * 10;
+    }
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+    friend std::size_t hash_value(custom const& x )
+    {
+        return x.hash();
+    }
+#endif
+
+    custom(int x) : value_(x) {}
+};
+
+#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+namespace ndnboost
+{
+    std::size_t hash_value(custom x)
+    {
+        return x.hash();
+    }
+}
+#endif
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+#  ifdef BOOST_HASH_TEST_STD_INCLUDES
+#    include <functional>
+#  else
+#    include <boost/functional/hash.hpp>
+#  endif
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <vector>
+#include <string>
+#include <cctype>
+
+void custom_tests()
+{
+    BOOST_HASH_TEST_NAMESPACE::hash<custom> custom_hasher;
+    BOOST_TEST(custom_hasher(10) == 100u);
+    custom x(55);
+    BOOST_TEST(custom_hasher(x) == 550u);
+
+    {
+        using namespace BOOST_HASH_TEST_NAMESPACE;
+        BOOST_TEST(custom_hasher(x) == hash_value(x));
+    }
+
+    std::vector<custom> custom_vector;
+    custom_vector.push_back(5);
+    custom_vector.push_back(25);
+    custom_vector.push_back(35);
+
+    std::size_t seed = 0;
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, custom(5));
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, custom(25));
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed, custom(35));
+
+    std::size_t seed2 = 0;
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 50u);
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 250u);
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(seed2, 350u);
+
+    BOOST_TEST(seed == BOOST_HASH_TEST_NAMESPACE::hash_range(
+        custom_vector.begin(), custom_vector.end()));
+    BOOST_TEST(seed == seed2);
+}
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+    custom_tests();
+#endif
+    return ndnboost::report_errors();
+}
+
diff --git a/libs/functional/hash/test/hash_list_test.cpp b/libs/functional/hash/test/hash_list_test.cpp
new file mode 100644
index 0000000..4294a80
--- /dev/null
+++ b/libs/functional/hash/test/hash_list_test.cpp
@@ -0,0 +1,35 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+#  ifdef BOOST_HASH_TEST_STD_INCLUDES
+#    include <functional>
+#  else
+#    include <boost/functional/hash.hpp>
+#  endif
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <list>
+
+using std::list;
+#define CONTAINER_TYPE list
+#include "./hash_sequence_test.hpp"
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+    list_tests::list_hash_integer_tests();
+#endif
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_long_double_test.cpp b/libs/functional/hash/test/hash_long_double_test.cpp
new file mode 100644
index 0000000..c192185
--- /dev/null
+++ b/libs/functional/hash/test/hash_long_double_test.cpp
@@ -0,0 +1,17 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "hash_float_test.hpp"
+
+int main()
+{
+    std::cerr<<"Compiler: "<<BOOST_COMPILER<<"\n";
+    std::cerr<<"Platform: "<<BOOST_PLATFORM<<"\n";
+    std::cerr<<"Library: "<<BOOST_STDLIB<<"\n\n";
+
+    float_tests("long double", (long double*) 0);
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_map_test.cpp b/libs/functional/hash/test/hash_map_test.cpp
new file mode 100644
index 0000000..31835c7
--- /dev/null
+++ b/libs/functional/hash/test/hash_map_test.cpp
@@ -0,0 +1,40 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+#  ifdef BOOST_HASH_TEST_STD_INCLUDES
+#    include <functional>
+#  else
+#    include <boost/functional/hash.hpp>
+#  endif
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+#include <map>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+using std::map;
+#define CONTAINER_TYPE map
+#include "./hash_map_test.hpp"
+
+using std::multimap;
+#define CONTAINER_TYPE multimap
+#include "./hash_map_test.hpp"
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+    map_tests::map_hash_integer_tests();
+    multimap_tests::multimap_hash_integer_tests();
+#endif
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_map_test.hpp b/libs/functional/hash/test/hash_map_test.hpp
new file mode 100644
index 0000000..41bb2fa
--- /dev/null
+++ b/libs/functional/hash/test/hash_map_test.hpp
@@ -0,0 +1,76 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#if !defined(CONTAINER_TYPE)
+#error "CONTAINER_TYPE not defined"
+#else
+
+#include <boost/preprocessor/cat.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4244) // conversion from 'int' to 'float'
+#pragma warning(disable:4245) // signed/unsigned mismatch
+#endif
+
+namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
+{
+    template <class T>
+    void integer_tests(T* = 0)
+    {
+        const int number_of_containers = 10;
+        T containers[number_of_containers];
+        typedef BOOST_DEDUCED_TYPENAME T::value_type pair;
+        typedef BOOST_DEDUCED_TYPENAME T::key_type key;
+        typedef BOOST_DEDUCED_TYPENAME T::mapped_type value;
+
+        for(int i = 0; i < 5; ++i) {
+            for(int j = 0; j < i; ++j)
+                containers[i].insert(pair(key(0), value(0)));
+        }
+
+        containers[6].insert(pair(key(1),value(0)));
+        containers[7].insert(pair(key(1),value(0)));
+        containers[7].insert(pair(key(1),value(0)));
+        containers[8].insert(pair(key(-1),value(1)));
+        containers[9].insert(pair(key(-1),value(3)));
+        containers[9].insert(pair(key(-1),value(3)));
+
+        BOOST_HASH_TEST_NAMESPACE::hash<T> hasher;
+
+        for(int i2 = 0; i2 < number_of_containers; ++i2) {
+            BOOST_TEST(hasher(containers[i2]) == hasher(containers[i2]));
+
+            BOOST_TEST(hasher(containers[i2]) ==
+                    BOOST_HASH_TEST_NAMESPACE::hash_value(containers[i2]));
+
+            BOOST_TEST(hasher(containers[i2])
+                    == BOOST_HASH_TEST_NAMESPACE::hash_range(
+                        containers[i2].begin(), containers[i2].end()));
+
+            for(int j2 = i2 + 1; j2 < number_of_containers; ++j2) {
+                BOOST_TEST(
+                        (containers[i2] == containers[j2]) ==
+                        (hasher(containers[i2]) == hasher(containers[j2]))
+                        );
+            }
+        }
+    }
+
+    void BOOST_PP_CAT(CONTAINER_TYPE, _hash_integer_tests())
+    {
+        integer_tests((CONTAINER_TYPE<char, unsigned char>*) 0);
+        integer_tests((CONTAINER_TYPE<int, float>*) 0);
+        integer_tests((CONTAINER_TYPE<unsigned long, unsigned long>*) 0);
+        integer_tests((CONTAINER_TYPE<double, short>*) 0);
+    }
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#undef CONTAINER_TYPE
+#endif
diff --git a/libs/functional/hash/test/hash_no_ext_fail_test.cpp b/libs/functional/hash/test/hash_no_ext_fail_test.cpp
new file mode 100644
index 0000000..6d1636e
--- /dev/null
+++ b/libs/functional/hash/test/hash_no_ext_fail_test.cpp
@@ -0,0 +1,28 @@
+
+// Copyright 2006-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+// Simple test to make sure BOOST_HASH_NO_EXTENSIONS does disable extensions
+// (or at least one of them).
+#if !defined(BOOST_HASH_NO_EXTENSIONS)
+#  define BOOST_HASH_NO_EXTENSIONS
+#endif
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+#  include <functional>
+#else
+#  include <boost/functional/hash.hpp>
+#endif
+
+template <class T> void ignore(T const&) {}
+
+int main()
+{
+    BOOST_HASH_TEST_NAMESPACE::hash< int[10] > hasher;
+    ignore(hasher);
+
+    return 0;
+}
diff --git a/libs/functional/hash/test/hash_no_ext_macro_1.cpp b/libs/functional/hash/test/hash_no_ext_macro_1.cpp
new file mode 100644
index 0000000..a9dfa06
--- /dev/null
+++ b/libs/functional/hash/test/hash_no_ext_macro_1.cpp
@@ -0,0 +1,37 @@
+
+// Copyright 2006-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+
+// Include header without BOOST_HASH_NO_EXTENSIONS defined
+#  if defined(BOOST_HASH_NO_EXTENSIONS)
+#    undef BOOST_HASH_NO_EXTENSIONS
+#  endif
+#  include <boost/functional/hash.hpp>
+
+// Include header with BOOST_HASH_NO_EXTENSIONS defined
+#  define BOOST_HASH_NO_EXTENSIONS
+#  include <boost/functional/hash.hpp>
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include <deque>
+
+int main()
+{
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    std::deque<int> x;
+
+    x.push_back(1);
+    x.push_back(2);
+
+    BOOST_HASH_TEST_NAMESPACE::hash<std::deque<int> > hasher;
+    BOOST_TEST(hasher(x) == BOOST_HASH_TEST_NAMESPACE::hash_value(x));
+#endif
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_no_ext_macro_2.cpp b/libs/functional/hash/test/hash_no_ext_macro_2.cpp
new file mode 100644
index 0000000..73b422e
--- /dev/null
+++ b/libs/functional/hash/test/hash_no_ext_macro_2.cpp
@@ -0,0 +1,37 @@
+
+// Copyright 2006-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+
+// Include header with BOOST_HASH_NO_EXTENSIONS defined
+#  if !defined(BOOST_HASH_NO_EXTENSIONS)
+#    define BOOST_HASH_NO_EXTENSIONS
+#  endif
+#  include <boost/functional/hash.hpp>
+
+// Include header without BOOST_HASH_NO_EXTENSIONS defined
+#  undef BOOST_HASH_NO_EXTENSIONS
+#  include <boost/functional/hash.hpp>
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include <map>
+
+int main()
+{
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    std::map<int, int> x;
+
+    x.insert(std::map<int, int>::value_type(53, -42));
+    x.insert(std::map<int, int>::value_type(14, -75));
+
+    BOOST_HASH_TEST_NAMESPACE::hash<std::map<int, int> > hasher;
+    BOOST_TEST(hasher(x) == BOOST_HASH_TEST_NAMESPACE::hash_value(x));
+#endif
+    
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_number_test.cpp b/libs/functional/hash/test/hash_number_test.cpp
new file mode 100644
index 0000000..28ca6e8
--- /dev/null
+++ b/libs/functional/hash/test/hash_number_test.cpp
@@ -0,0 +1,196 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+#  include <functional>
+#else
+#  include <boost/functional/hash.hpp>
+#endif
+
+#include <iostream>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/functional/hash/detail/limits.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include "./compile_time.hpp"
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4127) // conditional expression is constant
+#pragma warning(disable:4309) // truncation of constant value
+#pragma warning(disable:4310) // cast truncates constant value
+#endif
+
+#if defined(__GNUC__) && !defined(BOOST_INTEL_CXX_VERSION)
+#pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
+
+template <class T>
+void numeric_extra_tests(typename
+    ndnboost::enable_if_c<ndnboost::hash_detail::limits<T>::is_integer,
+        void*>::type = 0)
+{
+    typedef ndnboost::hash_detail::limits<T> limits;
+
+    if(limits::is_signed ||
+        limits::digits <= ndnboost::hash_detail::limits<std::size_t>::digits)
+    {
+        BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(T(-5)) == (std::size_t)T(-5));
+    }
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(T(0)) == (std::size_t)T(0u));
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(T(10)) == (std::size_t)T(10u));
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(T(25)) == (std::size_t)T(25u));
+}
+
+template <class T>
+void numeric_extra_tests(typename
+    ndnboost::disable_if_c<ndnboost::hash_detail::limits<T>::is_integer,
+        void*>::type = 0)
+{
+}
+
+template <class T>
+void numeric_test(T*)
+{
+    typedef ndnboost::hash_detail::limits<T> limits;
+
+    compile_time_tests((T*) 0);
+
+    BOOST_HASH_TEST_NAMESPACE::hash<T> x1;
+    BOOST_HASH_TEST_NAMESPACE::hash<T> x2;
+
+    T v1 = (T) -5;
+    BOOST_TEST(x1(v1) == x2(v1));
+    BOOST_TEST(x1(T(-5)) == x2(T(-5)));
+    BOOST_TEST(x1(T(0)) == x2(T(0)));
+    BOOST_TEST(x1(T(10)) == x2(T(10)));
+    BOOST_TEST(x1(T(25)) == x2(T(25)));
+    BOOST_TEST(x1(T(5) - T(5)) == x2(T(0)));
+    BOOST_TEST(x1(T(6) + T(4)) == x2(T(10)));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    BOOST_TEST(x1(T(-5)) == BOOST_HASH_TEST_NAMESPACE::hash_value(T(-5)));
+    BOOST_TEST(x1(T(0)) == BOOST_HASH_TEST_NAMESPACE::hash_value(T(0)));
+    BOOST_TEST(x1(T(10)) == BOOST_HASH_TEST_NAMESPACE::hash_value(T(10)));
+    BOOST_TEST(x1(T(25)) == BOOST_HASH_TEST_NAMESPACE::hash_value(T(25)));
+
+    numeric_extra_tests<T>();
+#endif
+}
+
+template <class T>
+void limits_test(T*)
+{
+    typedef ndnboost::hash_detail::limits<T> limits;
+
+    if(limits::is_specialized)
+    {
+        BOOST_HASH_TEST_NAMESPACE::hash<T> x1;
+        BOOST_HASH_TEST_NAMESPACE::hash<T> x2;
+
+        T min_value = (limits::min)();
+        T max_value = (limits::max)();
+
+        BOOST_TEST(x1(min_value) == x2((limits::min)()));
+        BOOST_TEST(x1(max_value) == x2((limits::max)()));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+        BOOST_TEST(x1(min_value) == BOOST_HASH_TEST_NAMESPACE::hash_value(min_value));
+        BOOST_TEST(x1(max_value) == BOOST_HASH_TEST_NAMESPACE::hash_value(max_value));
+
+        if (limits::is_integer)
+        {
+            BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(min_value)
+                    == std::size_t(min_value));
+            BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(max_value)
+                    == std::size_t(max_value));
+        }
+#endif
+    }
+}
+
+template <class T>
+void poor_quality_tests(T*)
+{
+    typedef ndnboost::hash_detail::limits<T> limits;
+
+    BOOST_HASH_TEST_NAMESPACE::hash<T> x1;
+    BOOST_HASH_TEST_NAMESPACE::hash<T> x2;
+
+    // A hash function can legally fail these tests, but it'll not be a good
+    // sign.
+    if(T(1) != T(-1))
+        BOOST_TEST(x1(T(1)) !=  x2(T(-1)));
+    if(T(1) != T(2))
+        BOOST_TEST(x1(T(1)) !=  x2(T(2)));
+    if((limits::max)() != (limits::max)() - 1)
+        BOOST_TEST(x1(static_cast<T>((limits::max)()))
+            != x2(static_cast<T>((limits::max)() - 1)));
+}
+
+void bool_test()
+{
+    BOOST_HASH_TEST_NAMESPACE::hash<bool> x1;
+    BOOST_HASH_TEST_NAMESPACE::hash<bool> x2;
+    
+    BOOST_TEST(x1(true) == x2(true));
+    BOOST_TEST(x1(false) == x2(false));
+    BOOST_TEST(x1(true) != x2(false));
+    BOOST_TEST(x1(false) != x2(true));
+}
+
+#define NUMERIC_TEST(type, name) \
+    std::cerr<<"Testing: " BOOST_STRINGIZE(name) "\n"; \
+    numeric_test((type*) 0); \
+    limits_test((type*) 0); \
+    poor_quality_tests((type*) 0);
+#define NUMERIC_TEST_NO_LIMITS(type, name) \
+    std::cerr<<"Testing: " BOOST_STRINGIZE(name) "\n"; \
+    numeric_test((type*) 0); \
+    poor_quality_tests((type*) 0);
+
+int main()
+{
+    NUMERIC_TEST(char, char)
+    NUMERIC_TEST(signed char, schar)
+    NUMERIC_TEST(unsigned char, uchar)
+#ifndef BOOST_NO_INTRINSIC_WCHAR_T
+    NUMERIC_TEST(wchar_t, wchar)
+#endif
+    NUMERIC_TEST(short, short)
+    NUMERIC_TEST(unsigned short, ushort)
+    NUMERIC_TEST(int, int)
+    NUMERIC_TEST(unsigned int, uint)
+    NUMERIC_TEST(long, hash_long)
+    NUMERIC_TEST(unsigned long, ulong)
+
+#if !defined(BOOST_NO_LONG_LONG)
+    NUMERIC_TEST_NO_LIMITS(ndnboost::long_long_type, long_long)
+    NUMERIC_TEST_NO_LIMITS(ndnboost::ulong_long_type, ulong_long)
+#endif
+
+#if defined(BOOST_HAS_INT128)
+    NUMERIC_TEST_NO_LIMITS(ndnboost::int128_type, int128)
+    NUMERIC_TEST_NO_LIMITS(ndnboost::uint128_type, uint128)
+#endif
+
+    NUMERIC_TEST(float, float)
+    NUMERIC_TEST(double, double)
+
+    NUMERIC_TEST(std::size_t, size_t)
+    NUMERIC_TEST(std::ptrdiff_t, ptrdiff_t)
+
+    bool_test();
+
+    return ndnboost::report_errors();
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
diff --git a/libs/functional/hash/test/hash_pointer_test.cpp b/libs/functional/hash/test/hash_pointer_test.cpp
new file mode 100644
index 0000000..2720696
--- /dev/null
+++ b/libs/functional/hash/test/hash_pointer_test.cpp
@@ -0,0 +1,45 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+#  include <functional>
+#else
+#  include <boost/functional/hash.hpp>
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/limits.hpp>
+#include "./compile_time.hpp"
+
+void pointer_tests()
+{
+    compile_time_tests((int**) 0);
+    compile_time_tests((void**) 0);
+
+    BOOST_HASH_TEST_NAMESPACE::hash<int*> x1;
+    BOOST_HASH_TEST_NAMESPACE::hash<int*> x2;
+
+    int int1;
+    int int2;
+
+    BOOST_TEST(x1(0) == x2(0));
+    BOOST_TEST(x1(&int1) == x2(&int1));
+    BOOST_TEST(x1(&int2) == x2(&int2));
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    BOOST_TEST(x1(&int1) == BOOST_HASH_TEST_NAMESPACE::hash_value(&int1));
+    BOOST_TEST(x1(&int2) == BOOST_HASH_TEST_NAMESPACE::hash_value(&int2));
+
+    // This isn't specified in Peter's proposal:
+    BOOST_TEST(x1(0) == 0);
+#endif
+}
+
+int main()
+{
+    pointer_tests();
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_range_test.cpp b/libs/functional/hash/test/hash_range_test.cpp
new file mode 100644
index 0000000..c09239a
--- /dev/null
+++ b/libs/functional/hash/test/hash_range_test.cpp
@@ -0,0 +1,85 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#if !defined(BOOST_HASH_TEST_EXTENSIONS)
+
+int main() {}
+
+#else
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+#  include <functional>
+#else
+#  include <boost/functional/hash.hpp>
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/limits.hpp>
+#include <vector>
+
+void hash_range_tests()
+{
+    std::vector<int> empty, values1, values2, values3, values4, values5;
+    values1.push_back(0);
+    values2.push_back(10);
+    values3.push_back(10);
+    values3.push_back(20);
+    values4.push_back(15);
+    values4.push_back(75);
+    values5.push_back(10);
+    values5.push_back(20);
+    values5.push_back(15);
+    values5.push_back(75);
+    values5.push_back(10);
+    values5.push_back(20);
+
+    std::vector<int> x;
+
+    std::size_t x_seed = 0;
+    BOOST_TEST(x_seed == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(empty.begin(), empty.end())
+        == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(empty.begin(), empty.end())
+        != BOOST_HASH_TEST_NAMESPACE::hash_range(values1.begin(), values1.end()));
+
+    x.push_back(10);
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(x_seed, 10);
+    BOOST_TEST(x_seed == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(empty.begin(), empty.end())
+        != BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(values2.begin(), values2.end())
+        == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+
+    x.push_back(20);
+    BOOST_HASH_TEST_NAMESPACE::hash_combine(x_seed, 20);
+    BOOST_TEST(x_seed == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(empty.begin(), empty.end())
+        != BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(values2.begin(), values2.end())
+        != BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_range(values3.begin(), values3.end())
+        == BOOST_HASH_TEST_NAMESPACE::hash_range(x.begin(), x.end()));
+
+    std::size_t seed =
+        BOOST_HASH_TEST_NAMESPACE::hash_range(values3.begin(), values3.end());
+    BOOST_HASH_TEST_NAMESPACE::hash_range(seed, values4.begin(), values4.end());
+    BOOST_HASH_TEST_NAMESPACE::hash_range(seed, x.begin(), x.end());
+    BOOST_TEST(seed ==
+        BOOST_HASH_TEST_NAMESPACE::hash_range(values5.begin(), values5.end()));
+}
+
+int main()
+{
+    hash_range_tests();
+
+    return ndnboost::report_errors();
+}
+
+#endif // TEST_EXTESNIONS
diff --git a/libs/functional/hash/test/hash_sequence_test.hpp b/libs/functional/hash/test/hash_sequence_test.hpp
new file mode 100644
index 0000000..e0846b0
--- /dev/null
+++ b/libs/functional/hash/test/hash_sequence_test.hpp
@@ -0,0 +1,76 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#if !defined(CONTAINER_TYPE)
+#error "CONTAINER_TYPE not defined"
+#else
+
+#include <boost/preprocessor/cat.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4245) // signed/unsigned mismatch
+#endif
+
+namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
+{
+    template <class T>
+    void integer_tests(T* = 0)
+    {
+        const int number_of_containers = 11;
+        T containers[number_of_containers];
+
+        for(int i = 0; i < 5; ++i) {
+            for(int j = 0; j < i; ++j)
+                containers[i].push_back(0);
+        }
+
+        containers[5].push_back(1);
+        containers[6].push_back(1);
+        containers[6].push_back(1);
+        containers[7].push_back(-1);
+        containers[8].push_back(-1);
+        containers[8].push_back(-1);
+        containers[9].push_back(1);
+        containers[9].push_back(-1);
+        containers[10].push_back(-1);
+        containers[10].push_back(1);
+
+        BOOST_HASH_TEST_NAMESPACE::hash<T> hasher;
+
+        for(int i2 = 0; i2 < number_of_containers; ++i2) {
+            BOOST_TEST(hasher(containers[i2]) == hasher(containers[i2]));
+
+            BOOST_TEST(hasher(containers[i2]) ==
+                    BOOST_HASH_TEST_NAMESPACE::hash_value(containers[i2]));
+
+            BOOST_TEST(hasher(containers[i2])
+                    == BOOST_HASH_TEST_NAMESPACE::hash_range(
+                        containers[i2].begin(), containers[i2].end()));
+
+            for(int j2 = i2 + 1; j2 < number_of_containers; ++j2) {
+                BOOST_TEST(
+                        (containers[i2] == containers[j2]) ==
+                        (hasher(containers[i2]) == hasher(containers[j2]))
+                        );
+            }
+        }
+    }
+
+    void BOOST_PP_CAT(CONTAINER_TYPE, _hash_integer_tests())
+    {
+        integer_tests((CONTAINER_TYPE<char>*) 0);
+        integer_tests((CONTAINER_TYPE<int>*) 0);
+        integer_tests((CONTAINER_TYPE<unsigned long>*) 0);
+        integer_tests((CONTAINER_TYPE<double>*) 0);
+    }
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#undef CONTAINER_TYPE
+#endif
diff --git a/libs/functional/hash/test/hash_set_test.cpp b/libs/functional/hash/test/hash_set_test.cpp
new file mode 100644
index 0000000..be44e92
--- /dev/null
+++ b/libs/functional/hash/test/hash_set_test.cpp
@@ -0,0 +1,40 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+#  ifdef BOOST_HASH_TEST_STD_INCLUDES
+#    include <functional>
+#  else
+#    include <boost/functional/hash.hpp>
+#  endif
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <set>
+
+using std::set;
+#define CONTAINER_TYPE set
+#include "./hash_set_test.hpp"
+
+using std::multiset;
+#define CONTAINER_TYPE multiset
+#include "./hash_set_test.hpp"
+
+#endif
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+    set_tests::set_hash_integer_tests();
+    multiset_tests::multiset_hash_integer_tests();
+#endif
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_set_test.hpp b/libs/functional/hash/test/hash_set_test.hpp
new file mode 100644
index 0000000..31d4909
--- /dev/null
+++ b/libs/functional/hash/test/hash_set_test.hpp
@@ -0,0 +1,79 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#if !defined(CONTAINER_TYPE)
+#error "CONTAINER_TYPE not defined"
+#else
+
+#include <boost/preprocessor/cat.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4245) // signed/unsigned mismatch
+#endif
+
+namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
+{
+    template <class T>
+    void integer_tests(T* = 0)
+    {
+        const int number_of_containers = 12;
+        T containers[number_of_containers];
+
+        for(int i = 0; i < 5; ++i) {
+            for(int j = 0; j < i; ++j)
+                containers[i].insert(0);
+        }
+
+        containers[6].insert(1);
+        containers[7].insert(1);
+        containers[7].insert(1);
+        containers[8].insert(-1);
+        containers[9].insert(-1);
+        containers[9].insert(-1);
+        containers[10].insert(-1);
+        containers[10].insert(1);
+        containers[11].insert(1);
+        containers[11].insert(2);
+        containers[11].insert(3);
+        containers[11].insert(4);
+        containers[11].insert(5);
+
+        BOOST_HASH_TEST_NAMESPACE::hash<T> hasher;
+
+        for(int i2 = 0; i2 < number_of_containers; ++i2) {
+            BOOST_TEST(hasher(containers[i2]) == hasher(containers[i2]));
+
+            BOOST_TEST(hasher(containers[i2]) ==
+                    BOOST_HASH_TEST_NAMESPACE::hash_value(containers[i2]));
+
+            BOOST_TEST(hasher(containers[i2])
+                    == BOOST_HASH_TEST_NAMESPACE::hash_range(
+                        containers[i2].begin(), containers[i2].end()));
+
+            for(int j2 = i2 + 1; j2 < number_of_containers; ++j2) {
+                BOOST_TEST(
+                        (containers[i2] == containers[j2]) ==
+                        (hasher(containers[i2]) == hasher(containers[j2]))
+                        );
+            }
+        }
+    }
+
+    void BOOST_PP_CAT(CONTAINER_TYPE, _hash_integer_tests())
+    {
+        integer_tests((CONTAINER_TYPE<char>*) 0);
+        integer_tests((CONTAINER_TYPE<int>*) 0);
+        integer_tests((CONTAINER_TYPE<unsigned long>*) 0);
+        integer_tests((CONTAINER_TYPE<double>*) 0);
+    }
+}
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+#undef CONTAINER_TYPE
+#endif
diff --git a/libs/functional/hash/test/hash_std_array_test.cpp b/libs/functional/hash/test/hash_std_array_test.cpp
new file mode 100644
index 0000000..11a28ff
--- /dev/null
+++ b/libs/functional/hash/test/hash_std_array_test.cpp
@@ -0,0 +1,103 @@
+
+// Copyright 2012 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+#  ifdef BOOST_HASH_TEST_STD_INCLUDES
+#    include <functional>
+#  else
+#    include <boost/functional/hash.hpp>
+#  endif
+#endif
+
+#include <boost/config.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_NO_CXX11_HDR_ARRAY)
+#define TEST_ARRAY
+#include <array>
+#include <vector>
+#endif
+
+#ifdef TEST_ARRAY
+
+template <typename T>
+void array_tests(T const& v) {
+    ndnboost::hash<typename T::value_type> hf;
+    for(typename T::const_iterator i = v.begin(); i != v.end(); ++i) {
+        for(typename T::const_iterator j = v.begin(); j != v.end(); ++j) {
+            if (i != j)
+                BOOST_TEST(hf(*i) != hf(*j));
+            else
+                BOOST_TEST(hf(*i) == hf(*j));
+        }
+    }
+}
+
+void empty_array_test() {
+/*
+    ndnboost::hash<std::array<int, 0> > empty_array_hash;
+    std::array<int, 0> empty_array;
+    BOOST_TEST(empty_array_hash(empty_array) == ndnboost::hash_value(empty_array));
+*/
+}
+
+void int_1_array_test()
+{
+    std::vector<std::array<int, 1> > arrays;
+    std::array<int, 1> val;
+    val[0] = 0;
+    arrays.push_back(val);
+    val[0] = 1;
+    arrays.push_back(val);
+    val[0] = 2;
+    arrays.push_back(val);
+    array_tests(arrays);
+}
+
+void string_1_array_test()
+{
+    std::vector<std::array<std::string, 1> > arrays;
+    std::array<std::string, 1> val;
+    arrays.push_back(val);
+    val[0] = "one";
+    arrays.push_back(val);
+    val[0] = "two";
+    arrays.push_back(val);
+    array_tests(arrays);
+}
+
+void string_3_array_test()
+{
+    std::vector<std::array<std::string,3 > > arrays;
+    std::array<std::string, 3> val;
+    arrays.push_back(val);
+    val[0] = "one";
+    arrays.push_back(val);
+    val[0] = ""; val[1] = "one"; val[2] = "";
+    arrays.push_back(val);
+    val[0] = ""; val[1] = ""; val[2] = "one";
+    arrays.push_back(val);
+    val[0] = "one"; val[1] = "one"; val[2] = "one";
+    arrays.push_back(val);
+    val[0] = "one"; val[1] = "two"; val[2] = "three";
+    arrays.push_back(val);
+    array_tests(arrays);
+}
+
+#endif // TEST_ARRAY
+
+int main()
+{
+#ifdef TEST_ARRAY
+    empty_array_test();
+    int_1_array_test();
+    string_1_array_test();
+    string_3_array_test();
+#endif
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_std_smart_ptr_test.cpp b/libs/functional/hash/test/hash_std_smart_ptr_test.cpp
new file mode 100644
index 0000000..639c718
--- /dev/null
+++ b/libs/functional/hash/test/hash_std_smart_ptr_test.cpp
@@ -0,0 +1,80 @@
+
+// Copyright 2012 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+#  include <functional>
+#else
+#  include <boost/functional/hash.hpp>
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include "./compile_time.hpp"
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_NO_CXX11_SMART_PTR)
+#define TEST_SMART_PTRS
+#include <memory>
+#endif
+
+#ifdef TEST_SMART_PTRS
+
+void shared_ptr_tests()
+{
+    std::shared_ptr<int> x;
+    compile_time_tests(&x);
+
+    BOOST_HASH_TEST_NAMESPACE::hash<std::shared_ptr<int> > x1;
+    BOOST_HASH_TEST_NAMESPACE::hash<std::shared_ptr<int> > x2;
+
+    std::shared_ptr<int> ptr1(new int(10));
+    std::shared_ptr<int> ptr2;
+
+    BOOST_TEST(x1(x) == x2(ptr2));
+    BOOST_TEST(x1(x) != x2(ptr1));
+    ptr2.reset(new int(10));
+    BOOST_TEST(x1(ptr1) == x2(ptr1));
+    BOOST_TEST(x1(ptr1) != x2(ptr2));
+    ptr2 = ptr1;
+    BOOST_TEST(x1(ptr1) == x2(ptr2));
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    BOOST_TEST(x1(x) == BOOST_HASH_TEST_NAMESPACE::hash_value(x));
+    BOOST_TEST(x1(ptr1) == BOOST_HASH_TEST_NAMESPACE::hash_value(ptr2));
+#endif
+}
+
+void unique_ptr_tests()
+{
+    std::unique_ptr<int> x;
+    compile_time_tests(&x);
+
+    BOOST_HASH_TEST_NAMESPACE::hash<std::unique_ptr<int> > x1;
+    BOOST_HASH_TEST_NAMESPACE::hash<std::unique_ptr<int> > x2;
+
+    std::unique_ptr<int> ptr1(new int(10));
+    std::unique_ptr<int> ptr2;
+
+    BOOST_TEST(x1(x) == x2(ptr2));
+    BOOST_TEST(x1(x) != x2(ptr1));
+    ptr2.reset(new int(10));
+    BOOST_TEST(x1(ptr1) == x2(ptr1));
+    BOOST_TEST(x1(ptr1) != x2(ptr2));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    BOOST_TEST(x1(x) == BOOST_HASH_TEST_NAMESPACE::hash_value(x));
+#endif
+}
+
+#endif
+
+int main()
+{
+#ifdef TEST_SMART_PTRS
+    shared_ptr_tests();
+    unique_ptr_tests();
+#endif
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_std_tuple_test.cpp b/libs/functional/hash/test/hash_std_tuple_test.cpp
new file mode 100644
index 0000000..ba5346a
--- /dev/null
+++ b/libs/functional/hash/test/hash_std_tuple_test.cpp
@@ -0,0 +1,77 @@
+
+// Copyright 2012 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+#  ifdef BOOST_HASH_TEST_STD_INCLUDES
+#    include <functional>
+#  else
+#    include <boost/functional/hash.hpp>
+#  endif
+#endif
+
+#include <boost/config.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
+#define TEST_TUPLE
+#include <tuple>
+#include <vector>
+#endif
+
+#ifdef TEST_TUPLE
+
+template <typename T>
+void tuple_tests(T const& v) {
+    ndnboost::hash<typename T::value_type> hf;
+    for(typename T::const_iterator i = v.begin(); i != v.end(); ++i) {
+        for(typename T::const_iterator j = v.begin(); j != v.end(); ++j) {
+            if (i != j)
+                BOOST_TEST(hf(*i) != hf(*j));
+            else
+                BOOST_TEST(hf(*i) == hf(*j));
+        }
+    }
+}
+
+void empty_tuple_test() {
+    ndnboost::hash<std::tuple<> > empty_tuple_hash;
+    std::tuple<> empty_tuple;
+    BOOST_TEST(empty_tuple_hash(empty_tuple) == ndnboost::hash_value(empty_tuple));
+}
+
+void int_tuple_test() {
+    std::vector<std::tuple<int> > int_tuples;
+    int_tuples.push_back(std::make_tuple(0));
+    int_tuples.push_back(std::make_tuple(1));
+    int_tuples.push_back(std::make_tuple(2));
+    tuple_tests(int_tuples);
+}
+
+void int_string_tuple_test() {
+    std::vector<std::tuple<int, std::string> > int_string_tuples;
+    int_string_tuples.push_back(std::make_tuple(0, std::string("zero")));
+    int_string_tuples.push_back(std::make_tuple(1, std::string("one")));
+    int_string_tuples.push_back(std::make_tuple(2, std::string("two")));
+    int_string_tuples.push_back(std::make_tuple(0, std::string("one")));
+    int_string_tuples.push_back(std::make_tuple(1, std::string("zero")));
+    int_string_tuples.push_back(std::make_tuple(0, std::string("")));
+    int_string_tuples.push_back(std::make_tuple(1, std::string("")));
+    tuple_tests(int_string_tuples);
+}
+
+#endif // TEST_TUPLE
+
+int main()
+{
+#ifdef TEST_TUPLE
+    empty_tuple_test();
+    int_tuple_test();
+    int_string_tuple_test();
+#endif
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_string_test.cpp b/libs/functional/hash/test/hash_string_test.cpp
new file mode 100644
index 0000000..73e76af
--- /dev/null
+++ b/libs/functional/hash/test/hash_string_test.cpp
@@ -0,0 +1,73 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+#  include <functional>
+#else
+#  include <boost/functional/hash.hpp>
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include <string>
+#include "./compile_time.hpp"
+
+void string_tests()
+{
+    compile_time_tests((std::string*) 0);
+
+    BOOST_HASH_TEST_NAMESPACE::hash<std::string> x1;
+    BOOST_HASH_TEST_NAMESPACE::hash<std::string> x2;
+
+    BOOST_TEST(x1("Hello") == x2(std::string("Hel") + "lo"));
+    BOOST_TEST(x1("") == x2(std::string()));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    std::string value1;
+    std::string value2("Hello");
+
+    BOOST_TEST(x1(value1) == BOOST_HASH_TEST_NAMESPACE::hash_value(value1));
+    BOOST_TEST(x1(value2) == BOOST_HASH_TEST_NAMESPACE::hash_value(value2));
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value1) ==
+            BOOST_HASH_TEST_NAMESPACE::hash_range(value1.begin(), value1.end()));
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value2) ==
+            BOOST_HASH_TEST_NAMESPACE::hash_range(value2.begin(), value2.end()));
+#endif
+}
+
+#if !defined(BOOST_NO_STD_WSTRING)
+void wstring_tests()
+{
+    compile_time_tests((std::wstring*) 0);
+
+    BOOST_HASH_TEST_NAMESPACE::hash<std::wstring> x1;
+    BOOST_HASH_TEST_NAMESPACE::hash<std::wstring> x2;
+
+    BOOST_TEST(x1(L"Hello") == x2(std::wstring(L"Hel") + L"lo"));
+    BOOST_TEST(x1(L"") == x2(std::wstring()));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+    std::wstring value1;
+    std::wstring value2(L"Hello");
+
+    BOOST_TEST(x1(value1) == BOOST_HASH_TEST_NAMESPACE::hash_value(value1));
+    BOOST_TEST(x1(value2) == BOOST_HASH_TEST_NAMESPACE::hash_value(value2));
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value1) ==
+            BOOST_HASH_TEST_NAMESPACE::hash_range(value1.begin(), value1.end()));
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(value2) ==
+            BOOST_HASH_TEST_NAMESPACE::hash_range(value2.begin(), value2.end()));
+#endif
+}
+#endif
+
+int main()
+{
+    string_tests();
+#if !defined(BOOST_NO_STD_WSTRING)
+    wstring_tests();
+#endif
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_type_index_test.cpp b/libs/functional/hash/test/hash_type_index_test.cpp
new file mode 100644
index 0000000..a5f81ae
--- /dev/null
+++ b/libs/functional/hash/test/hash_type_index_test.cpp
@@ -0,0 +1,53 @@
+
+// Copyright 2011 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_STD_INCLUDES
+#  include <functional>
+#else
+#  include <boost/functional/hash.hpp>
+#endif
+#include <boost/config.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
+
+#include <typeindex>
+
+void test_type_index() {
+    BOOST_HASH_TEST_NAMESPACE::hash<std::type_index> hasher;
+
+#if defined(BOOST_NO_TYPEID)
+    std::cout<<"Unable to test std::type_index, as typeid isn't available"
+        <<std::endl;
+#else
+    std::type_index int_index = typeid(int);
+    std::type_index int2_index = typeid(int);
+    std::type_index char_index = typeid(char);
+    
+    BOOST_TEST(hasher(int_index) == int_index.hash_code());
+    BOOST_TEST(hasher(int_index) == int2_index.hash_code());
+    BOOST_TEST(hasher(char_index) == char_index.hash_code());
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(int_index) == int_index.hash_code());
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(int_index) == int2_index.hash_code());
+    BOOST_TEST(BOOST_HASH_TEST_NAMESPACE::hash_value(char_index) == char_index.hash_code());
+
+    BOOST_TEST(hasher(int_index) == hasher(int2_index));
+    BOOST_TEST(hasher(int_index) != hasher(char_index));
+#endif
+}
+#endif
+
+int main()
+{
+#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
+    test_type_index();
+#else
+    std::cout<<"<type_index> not available."<<std::endl;
+#endif
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/hash_value_array_test.cpp b/libs/functional/hash/test/hash_value_array_test.cpp
new file mode 100644
index 0000000..dc79ac7
--- /dev/null
+++ b/libs/functional/hash/test/hash_value_array_test.cpp
@@ -0,0 +1,64 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+// On some compilers hash_value isn't available for arrays, so I test it
+// separately from the main array tests.
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+#  ifdef BOOST_HASH_TEST_STD_INCLUDES
+#    include <functional>
+#  else
+#    include <boost/functional/hash.hpp>
+#  endif
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+void array_int_test()
+{
+    const int array1[25] = {
+        26, -43, 32, 65, 45,
+        12, 67, 32, 12, 23,
+        0, 0, 0, 0, 0,
+        8, -12, 23, 65, 45,
+        -1, 93, -54, 987, 3
+    };
+    BOOST_HASH_TEST_NAMESPACE::hash<int[25]> hasher1;
+
+    int array2[1] = {3};
+    BOOST_HASH_TEST_NAMESPACE::hash<int[1]> hasher2;
+
+    int array3[2] = {2, 3};
+    BOOST_HASH_TEST_NAMESPACE::hash<int[2]> hasher3;
+
+    BOOST_TEST(hasher1(array1) == BOOST_HASH_TEST_NAMESPACE::hash_value(array1));
+    BOOST_TEST(hasher2(array2) == BOOST_HASH_TEST_NAMESPACE::hash_value(array2));
+    BOOST_TEST(hasher3(array3) == BOOST_HASH_TEST_NAMESPACE::hash_value(array3));
+}
+
+void two_dimensional_array_test()
+{
+    int array[3][2] = {{-5, 6}, {7, -3}, {26, 1}};
+    BOOST_HASH_TEST_NAMESPACE::hash<int[3][2]> hasher;
+
+    BOOST_TEST(hasher(array) == BOOST_HASH_TEST_NAMESPACE::hash_value(array));
+}
+
+#endif
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+    array_int_test();
+    two_dimensional_array_test();
+#endif
+
+    return ndnboost::report_errors();
+}
+
diff --git a/libs/functional/hash/test/hash_vector_test.cpp b/libs/functional/hash/test/hash_vector_test.cpp
new file mode 100644
index 0000000..1eab7ff
--- /dev/null
+++ b/libs/functional/hash/test/hash_vector_test.cpp
@@ -0,0 +1,35 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+#  ifdef BOOST_HASH_TEST_STD_INCLUDES
+#    include <functional>
+#  else
+#    include <boost/functional/hash.hpp>
+#  endif
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+
+#include <vector>
+
+using std::vector;
+#define CONTAINER_TYPE vector
+#include "./hash_sequence_test.hpp"
+
+#endif // BOOST_HASH_TEST_EXTENSIONS
+
+int main()
+{
+#ifdef BOOST_HASH_TEST_EXTENSIONS
+    vector_tests::vector_hash_integer_tests();
+#endif
+
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/implicit_test.cpp b/libs/functional/hash/test/implicit_test.cpp
new file mode 100644
index 0000000..317d8de
--- /dev/null
+++ b/libs/functional/hash/test/implicit_test.cpp
@@ -0,0 +1,21 @@
+
+// Copyright 2010 Daniel James.
+// 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)
+
+#include <boost/functional/hash.hpp>
+
+namespace test
+{
+    struct base {};
+    std::size_t hash_value(base const&) { return 0; }
+    
+    struct converts { operator base() const { return base(); } };
+}
+
+int main() {
+    ndnboost::hash<test::converts> hash;
+    test::converts x;
+    
+    hash(x);
+}
diff --git a/libs/functional/hash/test/link_ext_test.cpp b/libs/functional/hash/test/link_ext_test.cpp
new file mode 100644
index 0000000..d15af56
--- /dev/null
+++ b/libs/functional/hash/test/link_ext_test.cpp
@@ -0,0 +1,33 @@
+
+// Copyright 2006-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#define BOOST_HASH_TEST_NAMESPACE ndnboost
+#include <boost/functional/hash.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <vector>
+
+int f(std::size_t hash1, int* x1) {
+
+    // Check that BOOST_HASH_TEST_NAMESPACE::hash<int*> works in both files.
+    BOOST_HASH_TEST_NAMESPACE::hash<int*> ptr_hasher;
+    BOOST_TEST(hash1 == ptr_hasher(x1));
+
+#if defined(BOOST_HASH_TEST_EXTENSIONS)
+
+    // Check that std::vector<std::size_t> is avaiable in this file.
+    std::vector<std::size_t> x;
+    x.push_back(*x1);
+    BOOST_HASH_TEST_NAMESPACE::hash<std::vector<std::size_t> > vector_hasher;
+    return vector_hasher(x) != BOOST_HASH_TEST_NAMESPACE::hash_value(x);
+    
+#else
+
+    return 0;
+
+#endif
+}
+
diff --git a/libs/functional/hash/test/link_no_ext_test.cpp b/libs/functional/hash/test/link_no_ext_test.cpp
new file mode 100644
index 0000000..64ee6df
--- /dev/null
+++ b/libs/functional/hash/test/link_no_ext_test.cpp
@@ -0,0 +1,20 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#define BOOST_HASH_TEST_NAMESPACE ndnboost
+#define BOOST_HASH_NO_EXTENSIONS
+#include <boost/functional/hash.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+extern int f(std::size_t, int*);
+
+int main() {
+    BOOST_HASH_TEST_NAMESPACE::hash<int*> ptr_hasher;
+    int x = 55;
+    BOOST_TEST(!f(ptr_hasher(&x), &x));
+    return ndnboost::report_errors();
+}
diff --git a/libs/functional/hash/test/link_test.cpp b/libs/functional/hash/test/link_test.cpp
new file mode 100644
index 0000000..bdae262
--- /dev/null
+++ b/libs/functional/hash/test/link_test.cpp
@@ -0,0 +1,11 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#include <boost/functional/hash.hpp>
+
+extern int f();
+int main() { return f(); }
diff --git a/libs/functional/hash/test/link_test_2.cpp b/libs/functional/hash/test/link_test_2.cpp
new file mode 100644
index 0000000..1beffc8
--- /dev/null
+++ b/libs/functional/hash/test/link_test_2.cpp
@@ -0,0 +1,10 @@
+
+// Copyright 2005-2009 Daniel James.
+// 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)
+
+#include "./config.hpp"
+
+#include <boost/functional/hash.hpp>
+
+int f() { return 0; }
diff --git a/libs/functional/hash/test/namespace_fail_test.cpp b/libs/functional/hash/test/namespace_fail_test.cpp
new file mode 100644
index 0000000..1db9fc6
--- /dev/null
+++ b/libs/functional/hash/test/namespace_fail_test.cpp
@@ -0,0 +1,16 @@
+
+// Copyright 2009 Daniel James.
+// 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)
+
+// Check that I haven't inadvertantly pulled namespace std into the global
+// namespace.
+
+#include "./config.hpp"
+
+#include <list>
+#include <boost/functional/hash.hpp>
+
+typedef list<int> foo;
+
+int main() {}
diff --git a/libs/functional/index.html b/libs/functional/index.html
new file mode 100644
index 0000000..86d8bac
--- /dev/null
+++ b/libs/functional/index.html
@@ -0,0 +1,263 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+  <meta http-equiv="Content-Language" content="en-us">
+  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+  <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
+  <meta name="ProgId" content="FrontPage.Editor.Document">
+
+  <title>Boost Function Object Adapter Library</title>
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+  <table border="1" bgcolor="#007F7F" cellpadding="2" summary="">
+    <tr>
+      <td bgcolor="#FFFFFF"><img src="../../boost.png" alt=
+      "boost.png (6897 bytes)" width="277" height="86"></td>
+
+      <td><a href="../../index.htm"><font face="Arial" color=
+      "#FFFFFF"><big>Home</big></font></a></td>
+
+      <td><a href="../libraries.htm"><font face="Arial" color=
+      "#FFFFFF"><big>Libraries</big></font></a></td>
+
+      <td><a href="http://www.boost.org/people/people.htm"><font face="Arial" color=
+      "#FFFFFF"><big>People</big></font></a></td>
+
+      <td><a href="http://www.boost.org/more/faq.htm"><font face="Arial" color=
+      "#FFFFFF"><big>FAQ</big></font></a></td>
+
+      <td><a href="../../more/index.htm"><font face="Arial" color=
+      "#FFFFFF"><big>More</big></font></a></td>
+    </tr>
+  </table>
+
+  <h1>Improved Function Object Adapters</h1>
+
+  <p>The header <a href="../../boost/functional.hpp">functional.hpp</a>
+  provides enhancements to the function object adapters specified in the C++
+  Standard Library (sections 20.3.5, through to 20.3.8). The enhancements are
+  principally possible due to two changes:</p>
+
+  <ol>
+    <li>We use the Boost <tt><a href=
+    "../utility/call_traits.htm">call_traits</a></tt> templates to avoid the
+    problem of <a href="binders.html#refref">references to references</a>,
+    and to improve the efficiency of <a href="mem_fun.html#args">parameter
+    passing</a>.</li>
+
+    <li>We use two <a href="function_traits.html">function object traits</a>
+    class templates to avoid the need for <tt><a href=
+    "ptr_fun.html">ptr_fun</a></tt> with the adapters in this library.</li>
+  </ol>
+
+  <h3>Contents</h3>
+
+  <p>The header contains the following function and class templates:</p>
+
+  <table border="1" cellpadding="5" summary="">
+    <tr>
+      <th align="left"><a href="function_traits.html">Function object
+      traits</a></th>
+
+      <td valign="top"><tt>unary_traits<br>
+      binary_traits</tt></td>
+
+      <td valign="top">Used to determine the types of function objects' and
+      functions' arguments. Eliminate the necessity for
+      <tt>ptr_fun</tt>.</td>
+    </tr>
+
+    <tr>
+      <th align="left"><a href="negators.html">Negators</a></th>
+
+      <td valign="top"><tt>unary_negate<br>
+      binary_negate<br>
+      not1<br>
+      not2</tt></td>
+
+      <td valign="top">Based on section 20.3.5 of the standard.</td>
+    </tr>
+
+    <tr>
+      <th align="left"><a href="binders.html">Binders</a></th>
+
+      <td valign="top"><tt>binder1st<br>
+      binder2nd<br>
+      bind1st<br>
+      bind2nd</tt></td>
+
+      <td valign="top">Based on section 20.3.6 of the standard.</td>
+    </tr>
+
+    <tr>
+      <th align="left"><a href="ptr_fun.html">Adapters for pointers to
+      functions</a></th>
+
+      <td valign="top"><tt>pointer_to_unary_function<br>
+      pointer_to_binary_function<br>
+      ptr_fun</tt></td>
+
+      <td valign="top">Based on section 20.3.7 of the standard. Not required
+      for use with this library since the binders and negators can adapt
+      functions, but may be needed with third party adapters.</td>
+    </tr>
+
+    <tr>
+      <th align="left"><a href="mem_fun.html">Adapters for pointers to member
+      functions</a></th>
+
+      <td valign="top"><tt>mem_fun_t<br>
+      mem_fun1_t<br>
+      const_mem_fun_t<br>
+      const_mem_fun1_t<br>
+      mem_fun_ref_t<br>
+      mem_fun1_ref_t<br>
+      const_mem_fun_ref_t<br>
+      const_mem_fun1_ref_t<br>
+      mem_fun<br>
+      mem_fun_ref</tt></td>
+
+      <td valign="top">Based on section 20.3.8 of the standard.</td>
+    </tr>
+  </table>
+
+  <h3>Usage</h3>
+
+  <p>Using these adapters should be pretty much the same as using the
+  standard function object adapters; the only differences are that you need
+  to write <tt>boost::</tt> instead of <tt>std::</tt>, and that you will get
+  fewer headaches.</p>
+
+  <p>For example, suppose you had a <tt>Person</tt> class that contained a
+  <tt>set_name</tt> function:</p>
+
+  <blockquote>
+    <pre>
+class Person
+{
+  public:
+    void set_name(const std::string &amp;name);
+  // ...
+};
+</pre>
+  </blockquote>
+
+  <p>You could rename a bunch of people in a collection, <tt>c</tt>, by
+  writing</p>
+
+  <blockquote>
+    <pre>
+std::for_each(c.begin(), c.end(), 
+              boost::bind2nd(boost::mem_fun_ref(&amp;Person::set_name), "Fred"));
+</pre>
+  </blockquote>
+
+  <p>If the standard adapters had been used instead then this code would
+  normally fail to compile, because <tt>set_name</tt> takes a reference
+  argument. Refer to the comments in the <a href="binders.html#refref">binder
+  documentation</a> to explain why this is so.</p>
+
+  <h3>Compiler Compatibility</h3>
+
+  <p>The header and <a href="test/function_test.cpp">test program</a> have been
+  compiled with the following compilers:</p>
+
+  <table border="1" cellpadding="5" summary="">
+    <tr>
+      <th>Compiler</th>
+
+      <th>Comments</th>
+    </tr>
+
+    <tr>
+      <td valign="top">Borland C++Builder 4 Update 2</td>
+
+      <td valign="top">No known issues.</td>
+    </tr>
+
+    <tr>
+      <td valign="top">Borland C++ 5.5</td>
+
+      <td valign="top">No known issues.</td>
+    </tr>
+
+    <tr>
+      <td valign="top">g++ 2.95.2</td>
+
+      <td valign="top">No known issues.</td>
+    </tr>
+
+    <tr>
+      <td valign="top">Microsoft Visual C++ Service Pack 3</td>
+
+      <td valign="top">
+        Compiler lacks partial specialisation, so this library offers little
+        more than is provided by the standard adapters:
+
+        <ul>
+          <li>The <tt>call_traits</tt> mechanism is unable to prevent
+          references to references, and so the adapters in this library will
+          be usable in fewer situations.</li>
+
+          <li>The <tt>function_traits</tt> mechanism is unable to determine
+          the argument and result types of functions, therefore
+          <tt>ptr_fun</tt> continues to be required to adapt functions.</li>
+        </ul>
+      </td>
+    </tr>
+  </table>
+
+  <h3>Future Directions</h3>
+
+  <p>This library's primary focus is to solve the problem of references to
+  references while maintaining as much compatibility as possible with the
+  standard library. This allows you to use the techniques you read about in
+  books and magazines with many of today's compilers.</p>
+
+  <p>In the longer term, even better solutions are likely:</p>
+
+  <ol>
+    <li>Several Boost members are working on expression template libraries.
+    These will allow a more natural syntax for combining and adapting
+    functions. As this is a new technology, it may be some time before it has
+    matured and is widely supported by major compilers but shows great
+    promise. In the meantime, the functional.hpp library fills the gap.</li>
+
+    <li>The Standard Committee has recognised the problem of references to
+    references occurring during template instantiation and has moved to fix
+    the standard (see the <a href=
+    "http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#106">C++
+    standard core language active issues list</a>).</li>
+  </ol>
+
+  <h3>Author</h3>
+
+  <p><a href="http://www.boost.org/people/mark_rodgers.htm">Mark Rodgers</a></p>
+
+  <h3>Acknowledgements</h3>
+
+  <p>Thanks to <a href="http://www.boost.org/people/john_maddock.htm">John Maddock</a> for
+  suggesting the mechanism that allowed the function objects traits to work
+  correctly. <a href="http://www.boost.org/people/jens_maurer.htm">Jens Maurer</a> provided
+  invaluable feedback during the <a href=
+  "http://www.boost.org/more/formal_review_process.htm">formal review process</a>.</p>
+  <hr>
+
+  <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
+  "../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
+  height="31" width="88"></a></p>
+
+  <p>Revised 
+  <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->02
+  December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38510" --></p>
+
+  <p><i>Copyright &copy; 2000 Cadenza New Zealand Ltd.</i></p>
+
+  <p><i>Distributed under the Boost Software License, Version 1.0. (See
+  accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
+  copy at <a href=
+  "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
+</body>
+</html>
diff --git a/libs/functional/mem_fun.html b/libs/functional/mem_fun.html
new file mode 100644
index 0000000..23dc102
--- /dev/null
+++ b/libs/functional/mem_fun.html
@@ -0,0 +1,201 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+  <meta http-equiv="Content-Language" content="en-us">
+  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+
+  <title>Boost Function Object Adapter Library</title>
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+  <table border="1" bgcolor="#007F7F" cellpadding="2" summary="">
+    <tr>
+      <td bgcolor="#FFFFFF"><img src="../../boost.png" alt=
+      "boost.png (6897 bytes)" width="277" height="86"></td>
+
+      <td><a href="../../index.htm"><font face="Arial" color=
+      "#FFFFFF"><big>Home</big></font></a></td>
+
+      <td><a href="../libraries.htm"><font face="Arial" color=
+      "#FFFFFF"><big>Libraries</big></font></a></td>
+
+      <td><a href="http://www.boost.org/people/people.htm"><font face="Arial" color=
+      "#FFFFFF"><big>People</big></font></a></td>
+
+      <td><a href="http://www.boost.org/more/faq.htm"><font face="Arial" color=
+      "#FFFFFF"><big>FAQ</big></font></a></td>
+
+      <td><a href="../../more/index.htm"><font face="Arial" color=
+      "#FFFFFF"><big>More</big></font></a></td>
+    </tr>
+  </table>
+
+  <h1>Member Function Adapters</h1>
+
+  <p>The header <a href="../../boost/functional.hpp">functional.hpp</a>
+  includes improved versions of the full range of member function adapters
+  from the the C++ Standard Library (&sect;20.3.8):</p>
+
+  <ul>
+    <li><tt>mem_fun_t</tt></li>
+
+    <li><tt>mem_fun1_t</tt></li>
+
+    <li><tt>const_mem_fun_t</tt></li>
+
+    <li><tt>const_mem_fun1_t</tt></li>
+
+    <li><tt>mem_fun_ref_t</tt></li>
+
+    <li><tt>mem_fun1_ref_t</tt></li>
+
+    <li><tt>const_mem_fun_ref_t</tt></li>
+
+    <li><tt>const_mem_fun1_ref_t</tt></li>
+  </ul>
+
+  <p>as well as the corresponding overloaded helper functions</p>
+
+  <ul>
+    <li><tt>mem_fun</tt></li>
+
+    <li><tt>mem_fun_ref</tt></li>
+  </ul>
+
+  <p>The following changes have been made to the adapters as specified in the
+  Standard:</p>
+
+  <ul>
+    <li>The <tt>first_argument_type</tt> typedef has been corrected for the
+    <tt>const_</tt> family of member function adapters (see <a href=
+    "#firstarg">below</a>).</li>
+
+    <li>The argument passed to <tt>mem_fun1_t</tt> and its variants is passed
+    using the <tt>call_traits::param_type</tt> for the member function's
+    argument type.</li>
+  </ul>
+
+  <h3 id="firstarg">first_argument_type</h3>
+
+  <p>The standard specifies <tt>const_mem_fun1_t</tt>, for example, like
+  this:</p>
+
+  <blockquote>
+    <pre>
+template &lt;class S, class T, class A&gt; class const_mem_fun1_t
+  : public binary_function&lt;<strong>T*</strong>, A, S&gt; {
+public:
+  explicit const_mem_fun1_t(S (T::*p)(A) const);
+  S operator()(<strong>const T*</strong> p, A x) const;
+};
+</pre>
+  </blockquote>
+
+  <p>Note that the first argument to <tt>binary_function</tt> is <tt>T*</tt>
+  despite the fact that the first argument to <tt>operator()</tt> is actually
+  of type <tt><em>const</em>&nbsp;T*</tt>.</p>
+
+  <p>Does this matter? Well, consider what happens when we write</p>
+
+  <blockquote>
+    <pre>
+struct Foo { void bar(int) const; };
+const Foo *cp = new Foo;
+std::bind1st(std::mem_fun(&amp;Foo::bar), cp);
+</pre>
+  </blockquote>
+
+  <p>We have created a <tt>const_mem_fun1_t</tt> object which will
+  effectively contain the following</p>
+
+  <blockquote>
+    <pre>
+typedef Foo* first_argument_type;
+</pre>
+  </blockquote>
+
+  <p>The <tt>bind1st</tt> will then create a <tt>binder1st</tt> object that
+  will use this <tt>typedef</tt> as the type of a member which will be
+  initialised with <tt>cp</tt>. In other words, we will need to initialise a
+  <tt>Foo*</tt> member with a <tt>const&nbsp;Foo*</tt> pointer! Clearly this
+  is not possible, so to implement this your Standard Library vendor will
+  have had to cast away the constness of <tt>cp</tt>, probably within the
+  body of <tt>bind1st</tt>.</p>
+
+  <p>This hack will not suffice with the improved <a href=
+  "binders.html">binders</a> in this library, so we have had to provide
+  corrected versions of the member function adapters as well.</p>
+
+  <h3 id="args">Argument Types</h3>
+
+  <p>The standard defines <tt>mem_fun1_t</tt>, for example, like this
+  (&sect;20.3.8&nbsp;&para;2):</p>
+
+  <blockquote>
+    <pre>
+template &lt;class S, class T, class A&gt; class mem_fun1_t
+  : public binary_function&lt;T*, A, S&gt; {
+public:
+  explicit mem_fun1_t(S (T::*p)(<strong>A</strong>));
+  S operator()(T* p, <strong>A</strong> x) const;
+};
+</pre>
+  </blockquote>
+
+  <p>Note that the second argument to <tt>operator()</tt> is exactly the same
+  type as the argument to the member function. If this is a value type, the
+  argument will be passed by value and copied twice.</p>
+
+  <p>However, if we were to try and eliminate this inefficiency by instead
+  declaring the argument as <tt>const&nbsp;A&amp;</tt>, then if A were a
+  reference type, we would have a reference to a reference, which is
+  currently illegal (but see <a href=
+  "http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#106">C++ core
+  language issue number 106)</a></p>
+
+  <p>So the way in which we want to declare the second argument for
+  <tt>operator()</tt> depends on whether or not the member function's
+  argument is a reference. If it is a reference, we want to declare it simply
+  as <tt>A</tt>; if it is a value we want to declare it as
+  <tt>const&nbsp;A&amp;</tt>.</p>
+
+  <p>The Boost <a href="../utility/call_traits.htm">call_traits</a> class
+  template contains a <tt>param_type</tt> typedef, which uses partial
+  specialisation to make precisely this decision. By declaring the
+  <tt>operator()</tt> as</p>
+
+  <blockquote>
+    <pre>
+S operator()(T* p, typename call_traits&lt;A&gt;::param_type x) const
+</pre>
+  </blockquote>
+
+  <p>we achieve the desired result - we improve efficiency without generating
+  references to references.</p>
+
+  <h3>Limitations</h3>
+
+  <p>The call traits template used to realise some improvements relies on
+  partial specialisation, so these improvements are only available on
+  compilers that support that feature. With other compilers, the argument
+  passed to the member function (in the <tt>mem_fun1_t</tt> family) will
+  always be passed by reference, thus generating the possibility of
+  references to references.</p>
+  <hr>
+
+  <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
+  "../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
+  height="31" width="88"></a></p>
+
+  <p>Revised 
+  <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->02 December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38510" --></p>
+
+  <p><i>Copyright &copy; 2000 Cadenza New Zealand Ltd.</i></p>
+
+  <p><i>Distributed under the Boost Software License, Version 1.0. (See
+  accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
+  copy at <a href=
+  "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
+</body>
+</html>
diff --git a/libs/functional/negators.html b/libs/functional/negators.html
new file mode 100644
index 0000000..9d31750
--- /dev/null
+++ b/libs/functional/negators.html
@@ -0,0 +1,158 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+  <meta http-equiv="Content-Language" content="en-us">
+  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+
+  <title>Boost Function Object Adapter Library</title>
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+  <table border="1" bgcolor="#007F7F" cellpadding="2" summary="">
+    <tr>
+      <td bgcolor="#FFFFFF"><img src="../../boost.png" alt=
+      "boost.png (6897 bytes)" width="277" height="86"></td>
+
+      <td><a href="../../index.htm"><font face="Arial" color=
+      "#FFFFFF"><big>Home</big></font></a></td>
+
+      <td><a href="../libraries.htm"><font face="Arial" color=
+      "#FFFFFF"><big>Libraries</big></font></a></td>
+
+      <td><a href="http://www.boost.org/people/people.htm"><font face="Arial" color=
+      "#FFFFFF"><big>People</big></font></a></td>
+
+      <td><a href="http://www.boost.org/more/faq.htm"><font face="Arial" color=
+      "#FFFFFF"><big>FAQ</big></font></a></td>
+
+      <td><a href="../../more/index.htm"><font face="Arial" color=
+      "#FFFFFF"><big>More</big></font></a></td>
+    </tr>
+  </table>
+
+  <h1>Negators</h1>
+
+  <p>The header <a href="../../boost/functional.hpp">functional.hpp</a>
+  provides enhanced versions of both the negator adapters from the C++
+  Standard Library (&sect;20.3.5):</p>
+
+  <ul>
+    <li><tt>unary_negate</tt></li>
+
+    <li><tt>binary_negate</tt></li>
+  </ul>
+
+  <p>As well as the corresponding helper functions</p>
+
+  <ul>
+    <li><tt>not1</tt></li>
+
+    <li><tt>not2</tt></li>
+  </ul>
+
+  <p>However, the negators in this library improve on the standard versions
+  in two ways:</p>
+
+  <ul>
+    <li>They use <a href="function_traits.html">function object traits</a> to
+    avoid the need for <tt>ptr_fun</tt> when negating a function rather than
+    an adaptable function object.</li>
+
+    <li>They use Boost <a href=
+    "../utility/call_traits.htm">call&nbsp;traits</a> to determine the best
+    way to declare their arguments and pass them through to the adapted
+    function (see <a href="#arguments">below</a>).</li>
+  </ul>
+
+  <h3>Usage</h3>
+
+  <p>Usage is identical to the standard negators. For example,</p>
+
+  <blockquote>
+    <pre>
+bool bad(const Foo &amp;foo) { ... }
+...
+std::vector&lt;Foo&gt; c;
+...
+std::find_if(c.begin(), c.end(), boost::not1(bad));
+</pre>
+  </blockquote>
+
+  <h3 id="arguments">Argument Types</h3>
+
+  <p>The C++ Standard (&sect;20.3.5) defines unary negate like this (binary
+  negate is similar):</p>
+
+  <blockquote>
+    <pre>
+template &lt;class Predicate&gt;
+  class unary_negate
+    : public unary_function&lt;typename Predicate::argument_type,bool&gt; {
+public:
+  explicit unary_negate(const Predicate&amp; pred);
+  bool operator()(<strong>const typename Predicate::argument_type&amp;</strong> x) const;
+};
+</pre>
+  </blockquote>
+
+  <p>Note that if the Predicate's <tt>argument_type</tt> is a reference, the
+  type of <tt>operator()</tt>'s argument would be a reference to a reference.
+  Currently this is illegal in C++ (but see the <a href=
+  "http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#106">C++
+  standard core language active issues list</a>).</p>
+
+  <p>However, if we instead defined <tt>operator()</tt> to accept Predicate's
+  argument_type unmodified, this would be needlessly inefficient if it were a
+  value type; the argument would be copied twice - once when calling
+  <tt>unary_negate</tt>'s <tt>operator()</tt>, and again when
+  <tt>operator()</tt> called the adapted function.</p>
+
+  <p>So how we want to declare the argument for <tt>operator()</tt> depends
+  on whether or not the Predicate's <tt>argument_type</tt> is a reference. If
+  it is a reference, we want to declare it simply as <tt>argument_type</tt>;
+  if it is a value we want to declare it as
+  <tt>const&nbsp;argument_type&amp;</tt>.</p>
+
+  <p>The Boost <a href="../utility/call_traits.htm">call_traits</a> class
+  template contains a <tt>param_type</tt> typedef, which uses partial
+  specialisation to make precisely this decision. If we were to declare
+  <tt>operator()</tt> as</p>
+
+  <blockquote>
+    <pre>
+bool operator()(typename call_traits&lt;typename Predicate::argument_type&gt;::param_type x) const
+</pre>
+  </blockquote>
+
+  <p>the desired result would be achieved - we would eliminate references to
+  references without loss of efficiency. In fact, the actual declaration is
+  slightly more complicated because of the use of function object traits, but
+  the effect remains the same.</p>
+
+  <h3>Limitations</h3>
+
+  <p>Both the function object traits and call traits used to realise these
+  improvements rely on partial specialisation, these improvements are only
+  available on compilers that support that feature. With other compilers, the
+  negators in this library behave very much like those in the Standard -
+  <tt>ptr_fun</tt> will be required to adapt functions, and references to
+  references will not be avoided.</p>
+  <hr>
+
+  <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
+  "../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
+  height="31" width="88"></a></p>
+
+  <p>Revised 
+  <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->02
+  December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38510" --></p>
+
+  <p><i>Copyright &copy; 2000 Cadenza New Zealand Ltd.</i></p>
+
+  <p><i>Distributed under the Boost Software License, Version 1.0. (See
+  accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
+  copy at <a href=
+  "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
+</body>
+</html>
diff --git a/libs/functional/overloaded_function/doc/Jamfile.v2 b/libs/functional/overloaded_function/doc/Jamfile.v2
new file mode 100644
index 0000000..04c13dd
--- /dev/null
+++ b/libs/functional/overloaded_function/doc/Jamfile.v2
@@ -0,0 +1,32 @@
+
+# Copyright (C) 2009-2012 Lorenzo Caminiti
+# Distributed under the Boost Software License, Version 1.0
+# (see accompanying file LICENSE_1_0.txt or a copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# Home at http://www.boost.org/libs/functional/overloaded_function
+
+import quickbook ;
+using boostbook ;
+
+doxygen reference
+    :   ../../../../boost/functional/overloaded_function.hpp
+        ../../../../boost/functional/overloaded_function/config.hpp
+    :   <reftitle>"Reference"
+        <doxygen:param>PREDEFINED="DOXYGEN"
+        <doxygen:param>QUIET=YES
+        <doxygen:param>WARN_IF_UNDOCUMENTED=NO
+        <doxygen:param>HIDE_UNDOC_MEMBERS=YES
+        <doxygen:param>HIDE_UNDOC_CLASSES=YES
+        <doxygen:param>ALIASES=" Params=\"<b>Parameters:</b> <table border="0">\" Param{2}=\"<tr><td><b><tt>\\1</tt></b></td><td>\\2</td></tr>\" EndParams=\"</table>\" Returns=\"<b>Returns:</b>\" Note=\"<b>Note:</b>\" Warning=\"<b>Warning:</b>\" See=\"<b>See:</b>\" RefSect{2}=\"\\xmlonly<link linkend='boost_functional_overloadedfunction.\\1'>\\2</link>\\endxmlonly\" RefClass{1}=\"\\xmlonly<computeroutput><classname alt='\\1'>\\1</classname></computeroutput>\\endxmlonly\" RefFunc{1}=\"\\xmlonly<computeroutput><functionname alt='\\1'>\\1</functionname></computeroutput>\\endxmlonly\" RefMacro{1}=\"\\xmlonly<computeroutput><macroname alt='\\1'>\\1</macroname></computeroutput>\\endxmlonly\" "
+    ;
+
+xml qbk : overloaded_function.qbk : <dependency>reference ;
+
+boostbook doc : qbk
+    :   <xsl:param>boost.root=../../../../..
+        <xsl:param>boost.defaults=Boost
+        <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/functional/overloaded_function/doc/html
+    ;
+
+install pdfinstall : doc/<format>pdf : <location>. <install-type>PDF <name>overloaded_function.pdf ;
+explicit pdfinstall ;
diff --git a/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html b/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html
new file mode 100644
index 0000000..4baf1a8
--- /dev/null
+++ b/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html
@@ -0,0 +1,54 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="up" href="reference.html#header.boost.functional.overloaded_function.config_hpp" title="Header &lt;boost/functional/overloaded_function/config.hpp&gt;">
+<link rel="prev" href="boost/make_overloaded_function.html" title="Function template make_overloaded_function">
+<link rel="next" href="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="boost/make_overloaded_function.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.functional.overloaded_function.config_hpp"><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="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX</span></h2>
+<p>BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX &#8212; Specify the maximum number of arguments of the functions being overloaded. </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="reference.html#header.boost.functional.overloaded_function.config_hpp" title="Header &lt;boost/functional/overloaded_function/config.hpp&gt;">boost/functional/overloaded_function/config.hpp</a>&gt;
+
+</span>BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX</pre></div>
+<div class="refsect1">
+<a name="id821556"></a><h2>Description</h2>
+<p>If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When specified by the user, this macro must be a non-negative integer number.</p>
+<p><span class="bold"><strong>See:</strong></span>  <a class="link" href="boost_functional_overloadedfunction/getting_started.html" title="Getting Started"> Getting Started</a>,  <code class="computeroutput"><a class="link" href="boost/overloaded_function.html" title="Class template overloaded_function">boost::overloaded_function</a></code>. </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011, 2012 Lorenzo Caminiti<p>
+        Distributed under the Boost Software License, Version 1.0 (see accompanying
+        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>)
+      </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="boost/make_overloaded_function.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.functional.overloaded_function.config_hpp"><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="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html b/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html
new file mode 100644
index 0000000..3ebb559
--- /dev/null
+++ b/libs/functional/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html
@@ -0,0 +1,54 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="up" href="reference.html#header.boost.functional.overloaded_function.config_hpp" title="Header &lt;boost/functional/overloaded_function/config.hpp&gt;">
+<link rel="prev" href="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX">
+<link rel="next" href="boost_functional_overloadedfunction/acknowledgments.html" title="Acknowledgments">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.functional.overloaded_function.config_hpp"><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="boost_functional_overloadedfunction/acknowledgments.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</span></h2>
+<p>BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX &#8212; Specify the maximum number of functions that can be overloaded. </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="reference.html#header.boost.functional.overloaded_function.config_hpp" title="Header &lt;boost/functional/overloaded_function/config.hpp&gt;">boost/functional/overloaded_function/config.hpp</a>&gt;
+
+</span>BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</pre></div>
+<div class="refsect1">
+<a name="id821614"></a><h2>Description</h2>
+<p>If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When defined by the user, this macro must be an integer number greater or equal than 2 (because at least two distinct functions need to be specified in order to define an overload).</p>
+<p><span class="bold"><strong>See:</strong></span>  <a class="link" href="boost_functional_overloadedfunction/getting_started.html" title="Getting Started"> Getting Started</a>,  <code class="computeroutput"><a class="link" href="boost/overloaded_function.html" title="Class template overloaded_function">boost::overloaded_function</a></code>. </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011, 2012 Lorenzo Caminiti<p>
+        Distributed under the Boost Software License, Version 1.0 (see accompanying
+        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>)
+      </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.functional.overloaded_function.config_hpp"><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="boost_functional_overloadedfunction/acknowledgments.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/functional/overloaded_function/doc/html/boost/make_overloaded_function.html b/libs/functional/overloaded_function/doc/html/boost/make_overloaded_function.html
new file mode 100644
index 0000000..21f5f39
--- /dev/null
+++ b/libs/functional/overloaded_function/doc/html/boost/make_overloaded_function.html
@@ -0,0 +1,60 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Function template make_overloaded_function</title>
+<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="up" href="../reference.html#header.boost.functional.overloaded_function_hpp" title="Header &lt;boost/functional/overloaded_function.hpp&gt;">
+<link rel="prev" href="overloaded_function.html" title="Class template overloaded_function">
+<link rel="next" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="overloaded_function.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.boost.functional.overloaded_function_hpp"><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="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="boost.make_overloaded_function"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Function template make_overloaded_function</span></h2>
+<p>boost::make_overloaded_function &#8212; Make an overloaded function object without explicitly specifying the function types. </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../reference.html#header.boost.functional.overloaded_function_hpp" title="Header &lt;boost/functional/overloaded_function.hpp&gt;">boost/functional/overloaded_function.hpp</a>&gt;
+
+</span>
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F1<span class="special">,</span> <span class="keyword">typename</span> F2<span class="special">,</span> <span class="special">...</span> <span class="special">&gt;</span> 
+  <a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a><span class="special">&lt;</span> <span class="identifier">__function_type__</span><span class="special">&lt;</span> <span class="identifier">F1</span> <span class="special">&gt;</span><span class="special">,</span> <span class="identifier">__function_type__</span><span class="special">&lt;</span> <span class="identifier">F2</span> <span class="special">&gt;</span><span class="special">,</span><span class="special">...</span><span class="special">&gt;</span> 
+  <span class="identifier">make_overloaded_function</span><span class="special">(</span><span class="identifier">F1</span> f1<span class="special">,</span> <span class="identifier">F2</span> f2<span class="special">,</span> <span class="special">...</span><span class="special">)</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id821376"></a><h2>Description</h2>
+<p>This function template creates and returns an  <code class="computeroutput"><code class="computeroutput"><a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a></code></code> object that overloads all the specified functions <code class="computeroutput">f1</code>, <code class="computeroutput">f2</code>, etc.</p>
+<p>The function types are internally determined from the template parameter types so they do not need to be explicitly specified. Therefore, this function template usually has a more concise syntax when compared with  <code class="computeroutput"><code class="computeroutput"><a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a></code></code>. This is especially useful when the explicit type of the returned  <code class="computeroutput"><code class="computeroutput"><a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a></code></code> object does not need to be known (e.g., when used with Boost.Typeof's <code class="computeroutput">BOOST_AUTO</code>, C++11 <code class="computeroutput">auto</code>, or when the overloaded function object is handled using a function template parameter, see the  <a class="link" href="../boost_functional_overloadedfunction/tutorial.html" title="Tutorial"> Tutorial</a> section).</p>
+<p>The maximum number of functions to overload is given by the  <code class="computeroutput"><code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></code></code> configuration macro.</p>
+<p><span class="bold"><strong>Note:</strong></span> In this documentation, <code class="computeroutput">__function_type__</code> is a placeholder for a symbol that is specific to the implementation of this library.</p>
+<p><span class="bold"><strong>See:</strong></span>  <a class="link" href="../boost_functional_overloadedfunction/tutorial.html" title="Tutorial"> Tutorial</a> section,  <code class="computeroutput"><code class="computeroutput"><a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a></code></code>,  <code class="computeroutput"><code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></code></code>. </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011, 2012 Lorenzo Caminiti<p>
+        Distributed under the Boost Software License, Version 1.0 (see accompanying
+        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>)
+      </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="overloaded_function.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.boost.functional.overloaded_function_hpp"><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="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/functional/overloaded_function/doc/html/boost/overloaded_function.html b/libs/functional/overloaded_function/doc/html/boost/overloaded_function.html
new file mode 100644
index 0000000..c8c600f
--- /dev/null
+++ b/libs/functional/overloaded_function/doc/html/boost/overloaded_function.html
@@ -0,0 +1,112 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Class template overloaded_function</title>
+<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="up" href="../reference.html#header.boost.functional.overloaded_function_hpp" title="Header &lt;boost/functional/overloaded_function.hpp&gt;">
+<link rel="prev" href="../reference.html" title="Reference">
+<link rel="next" href="make_overloaded_function.html" title="Function template make_overloaded_function">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../reference.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.boost.functional.overloaded_function_hpp"><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="make_overloaded_function.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="boost.overloaded_function"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Class template overloaded_function</span></h2>
+<p>boost::overloaded_function &#8212; Function object to overload functions with distinct signatures. </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../reference.html#header.boost.functional.overloaded_function_hpp" title="Header &lt;boost/functional/overloaded_function.hpp&gt;">boost/functional/overloaded_function.hpp</a>&gt;
+
+</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F1<span class="special">,</span> <span class="keyword">typename</span> F2<span class="special">,</span> <span class="special">...</span> <span class="special">&gt;</span> 
+<span class="keyword">class</span> <a class="link" href="overloaded_function.html" title="Class template overloaded_function">overloaded_function</a> <span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+  <span class="comment">// <a class="link" href="overloaded_function.html#boost.overloaded_functionconstruct-copy-destruct">construct/copy/destruct</a></span>
+  <a class="link" href="overloaded_function.html#id259090-bb"><span class="identifier">overloaded_function</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span> <span class="identifier">F1</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> 
+                      <span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span> <span class="identifier">F2</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span><span class="special">;</span>
+
+  <span class="comment">// <a class="link" href="overloaded_function.html#id259020-bb">public member functions</a></span>
+  <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">F1</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">result_type</span> 
+  <a class="link" href="overloaded_function.html#id259023-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">F1</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">arg1_type</span><span class="special">,</span> 
+             <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">F1</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">arg2_type</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+  <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">F2</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">result_type</span> 
+  <a class="link" href="overloaded_function.html#id259049-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">F2</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">arg1_type</span><span class="special">,</span> 
+             <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">F2</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">arg2_type</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+<span class="special">}</span><span class="special">;</span></pre></div>
+<div class="refsect1">
+<a name="id820590"></a><h2>Description</h2>
+<p>This function object aggregates together calls to functions of all the specified function types <code class="computeroutput">F1</code>, <code class="computeroutput">F2</code>, etc which must have distinct function signatures from one another.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">F<span class="emphasis"><em>i</em></span></code></strong></span></td>
+<td>Each function type must be specified using the following syntax (which is Boost.Function's preferred syntax): <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting">    <span class="identifier">result_type</span> <span class="special">(</span><span class="identifier">argument1_type</span><span class="special">,</span> <span class="identifier">argumgnet2_type</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span>
+</pre>  </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p>In some cases, the  <code class="computeroutput"><a class="link" href="make_overloaded_function.html" title="Function template make_overloaded_function">make_overloaded_function</a></code> function template can be useful to construct an overloaded function object without explicitly specifying the function types.</p>
+<p>At least two distinct function types must be specified (because there is nothing to overload between one or zero functions). The maximum number of functions to overload is given by the  <code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></code> configuration macro. The maximum number of function parameters for each of the specified function types is given by the  <code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX</a></code> configuration macro.</p>
+<p><span class="bold"><strong>See:</strong></span>  <a class="link" href="../boost_functional_overloadedfunction/tutorial.html" title="Tutorial"> Tutorial</a> section,  <code class="computeroutput"><a class="link" href="make_overloaded_function.html" title="Function template make_overloaded_function">make_overloaded_function</a></code>,  <code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></code>,  <code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX</a></code>, Boost.Function. </p>
+<div class="refsect2">
+<a name="id820738"></a><h3>
+<a name="boost.overloaded_functionconstruct-copy-destruct"></a><code class="computeroutput">overloaded_function</code> 
+        public
+       construct/copy/destruct</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<pre class="literallayout"><a name="id259090-bb"></a><span class="identifier">overloaded_function</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span> <span class="identifier">F1</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> 
+                    <span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span> <span class="identifier">F2</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span><span class="special">;</span></pre>Construct the overloaded function object. <p>Any function pointer, function reference, and monomorphic function object that can be converted to a <code class="computeroutput">boost::function</code> function object can be specified as parameter.</p>
+<p><span class="bold"><strong>Note:</strong></span> Unfortunately, it is not possible to support polymorphic function objects (as explained <a href="http://lists.boost.org/Archives/boost/2012/03/191744.php" target="_top">here</a>). </p>
+</li></ol></div>
+</div>
+<div class="refsect2">
+<a name="id820874"></a><h3>
+<a name="id259020-bb"></a><code class="computeroutput">overloaded_function</code> public member functions</h3>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+<pre class="literallayout"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">F1</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">result_type</span> 
+<a name="id259023-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">F1</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">arg1_type</span><span class="special">,</span> 
+           <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">F1</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">arg2_type</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Call operator matching the signature of the function type specified as 1st template parameter. <p>This will in turn invoke the call operator of the 1st function passed to the constructor. </p>
+</li>
+<li class="listitem">
+<pre class="literallayout"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">F2</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">result_type</span> 
+<a name="id259049-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">F2</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">arg1_type</span><span class="special">,</span> 
+           <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_traits</span><span class="special">&lt;</span> <span class="identifier">F2</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">arg2_type</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Call operator matching the signature of the function type specified as 2nd template parameter. <p>This will in turn invoke the call operator of the 2nd function passed to the constructor.</p>
+<p><span class="bold"><strong>Note:</strong></span> Similar call operators are present for all specified function types <code class="computeroutput">F1</code>, <code class="computeroutput">F2</code>, etc (even if not exhaustively listed by this documentation). </p>
+</li>
+</ol></div>
+</div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011, 2012 Lorenzo Caminiti<p>
+        Distributed under the Boost Software License, Version 1.0 (see accompanying
+        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>)
+      </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../reference.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html#header.boost.functional.overloaded_function_hpp"><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="make_overloaded_function.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/functional/overloaded_function/doc/html/boost_functional_overloadedfunction/acknowledgments.html b/libs/functional/overloaded_function/doc/html/boost_functional_overloadedfunction/acknowledgments.html
new file mode 100644
index 0000000..605d481
--- /dev/null
+++ b/libs/functional/overloaded_function/doc/html/boost_functional_overloadedfunction/acknowledgments.html
@@ -0,0 +1,60 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Acknowledgments</title>
+<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="prev" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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>
+</div>
+<div class="section boost_functional_overloadedfunction_acknowledgments">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_overloadedfunction.acknowledgments"></a><a class="link" href="acknowledgments.html" title="Acknowledgments">Acknowledgments</a>
+</h2></div></div></div>
+<p>
+      Many thanks to Mathias Gaunard for suggesting to implement <code class="computeroutput"><a class="link" href="../boost/overloaded_function.html" title="Class template overloaded_function">boost::overloaded_function</a></code>
+      and for some sample code.
+    </p>
+<p>
+      Thanks to John Bytheway for suggesting to implement <code class="computeroutput"><a class="link" href="../boost/make_overloaded_function.html" title="Function template make_overloaded_function">boost::make_overloaded_function</a></code>.
+    </p>
+<p>
+      Thanks to Nathan Ridge for suggestions on how to implement <code class="computeroutput"><a class="link" href="../boost/make_overloaded_function.html" title="Function template make_overloaded_function">boost::make_overloaded_function</a></code>.
+    </p>
+<p>
+      Thanks to Robert Stewart for commenting on the library name.
+    </p>
+<p>
+      Many thanks to the entire <a href="http://www.boost.org" target="_top">Boost</a> community
+      and mailing list for providing valuable comments about this library and great
+      insights on the C++ programming language.
+    </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011, 2012 Lorenzo Caminiti<p>
+        Distributed under the Boost Software License, Version 1.0 (see accompanying
+        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>)
+      </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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>
+</div>
+</body>
+</html>
diff --git a/libs/functional/overloaded_function/doc/html/boost_functional_overloadedfunction/getting_started.html b/libs/functional/overloaded_function/doc/html/boost_functional_overloadedfunction/getting_started.html
new file mode 100644
index 0000000..459e7d5
--- /dev/null
+++ b/libs/functional/overloaded_function/doc/html/boost_functional_overloadedfunction/getting_started.html
@@ -0,0 +1,95 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Getting Started</title>
+<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="prev" href="../index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="next" href="tutorial.html" title="Tutorial">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="tutorial.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section boost_functional_overloadedfunction_getting_started">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_overloadedfunction.getting_started"></a><a class="link" href="getting_started.html" title="Getting Started">Getting
+    Started</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="getting_started.html#boost_functional_overloadedfunction.getting_started.compilers_and_platforms">Compilers
+      and Platforms</a></span></dt>
+<dt><span class="section"><a href="getting_started.html#boost_functional_overloadedfunction.getting_started.installation">Installation</a></span></dt>
+</dl></div>
+<p>
+      This section explains how to setup a system to use this library.
+    </p>
+<div class="section boost_functional_overloadedfunction_getting_started_compilers_and_platforms">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_functional_overloadedfunction.getting_started.compilers_and_platforms"></a><a class="link" href="getting_started.html#boost_functional_overloadedfunction.getting_started.compilers_and_platforms" title="Compilers and Platforms">Compilers
+      and Platforms</a>
+</h3></div></div></div>
+<p>
+        The authors originally developed and tested this library on:
+      </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+            GNU Compiler Collection (GCC) C++ 4.5.3 (with and without C++11 features
+            enabled <code class="computeroutput"><span class="special">-</span><span class="identifier">std</span><span class="special">=</span><span class="identifier">c</span><span class="special">++</span><span class="number">0</span><span class="identifier">x</span></code>)
+            on Cygwin.
+          </li>
+<li class="listitem">
+            Miscrosoft Visual C++ (MSVC) 8.0 on Windows 7.
+          </li>
+</ol></div>
+<p>
+        See the library <a href="http://www.boost.org/development/tests/release/developer/functional-overloaded_function.html" target="_top">regressions
+        test results</a> for detailed information on supported compilers and
+        platforms. Check the library regression test <a href="../../../test/Jamfile.v2" target="_top"><code class="literal">Jamfile.v2</code></a>
+        for any special configuration that might be required for a specific compiler.
+      </p>
+</div>
+<div class="section boost_functional_overloadedfunction_getting_started_installation">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_functional_overloadedfunction.getting_started.installation"></a><a class="link" href="getting_started.html#boost_functional_overloadedfunction.getting_started.installation" title="Installation">Installation</a>
+</h3></div></div></div>
+<p>
+        This library is composed of header files only. Therefore there is no pre-compiled
+        object file which needs to be installed. Programmers can simply instruct
+        the compiler where to find the library header files (<code class="computeroutput"><span class="special">-</span><span class="identifier">I</span></code> option on GCC, <code class="computeroutput"><span class="special">/</span><span class="identifier">I</span></code> option on MSVC, etc) and compile code
+        using the library.
+      </p>
+<p>
+        The maximum number of functions to overload is given by the <code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></code>
+        configuration macro. The maximum number of function parameters for each of
+        the specified function type is given by the <code class="computeroutput"><a class="link" href="../BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX</a></code>
+        configuration macro. All configuration macros have appropriate default values
+        when they are left undefined.
+      </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011, 2012 Lorenzo Caminiti<p>
+        Distributed under the Boost Software License, Version 1.0 (see accompanying
+        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>)
+      </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="tutorial.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/functional/overloaded_function/doc/html/boost_functional_overloadedfunction/tutorial.html b/libs/functional/overloaded_function/doc/html/boost_functional_overloadedfunction/tutorial.html
new file mode 100644
index 0000000..98493ac
--- /dev/null
+++ b/libs/functional/overloaded_function/doc/html/boost_functional_overloadedfunction/tutorial.html
@@ -0,0 +1,228 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Tutorial</title>
+<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="prev" href="getting_started.html" title="Getting Started">
+<link rel="next" href="../reference.html" title="Reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="getting_started.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="../reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section boost_functional_overloadedfunction_tutorial">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_overloadedfunction.tutorial"></a><a class="link" href="tutorial.html" title="Tutorial">Tutorial</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="tutorial.html#boost_functional_overloadedfunction.tutorial.overloading">Overloading</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#boost_functional_overloadedfunction.tutorial.without_function_types">Without
+      Function Types</a></span></dt>
+</dl></div>
+<p>
+      This section explains how to use this library.
+    </p>
+<div class="section boost_functional_overloadedfunction_tutorial_overloading">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_functional_overloadedfunction.tutorial.overloading"></a><a class="link" href="tutorial.html#boost_functional_overloadedfunction.tutorial.overloading" title="Overloading">Overloading</a>
+</h3></div></div></div>
+<p>
+        Consider the following functions which have distinct signatures:
+      </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;</span> <span class="identifier">identity_s</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">)</span> <span class="comment">// Function (as pointer).</span>
+    <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">x</span><span class="special">;</span> <span class="special">}</span>
+
+<span class="keyword">int</span> <span class="identifier">identity_i_impl</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">x</span><span class="special">;</span> <span class="special">}</span>
+<span class="keyword">int</span> <span class="special">(&amp;</span><span class="identifier">identity_i</span><span class="special">)(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">identity_i_impl</span><span class="special">;</span> <span class="comment">// Function reference.</span>
+
+<span class="keyword">double</span> <span class="identifier">identity_d_impl</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">x</span><span class="special">;</span> <span class="special">}</span>
+<span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="keyword">double</span> <span class="special">(</span><span class="keyword">double</span><span class="special">)&gt;</span> <span class="identifier">identity_d</span> <span class="special">=</span> <span class="identifier">identity_d_impl</span><span class="special">;</span> <span class="comment">// Functor.</span>
+</pre>
+<p>
+      </p>
+<p>
+        This library header <code class="computeroutput"><a class="link" href="../reference.html#header.boost.functional.overloaded_function_hpp" title="Header &lt;boost/functional/overloaded_function.hpp&gt;">boost/functional/overloaded_function.hpp</a></code>
+        provides a <code class="computeroutput"><a class="link" href="../boost/overloaded_function.html" title="Class template overloaded_function">boost::overloaded_function</a></code>
+        class template that creates a single overloaded function object that can
+        be used to call the specified functions instead of using the separate function
+        names (see also <a href="../../../test/functor.cpp" target="_top"><code class="literal">functor.cpp</code></a>
+        and <a href="../../../test/identity.hpp" target="_top"><code class="literal">identity.hpp</code></a>):
+      </p>
+<p>
+</p>
+<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">overloaded_function</span><span class="special">&lt;</span>
+      <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;)</span>
+    <span class="special">,</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span>
+    <span class="special">,</span> <span class="keyword">double</span> <span class="special">(</span><span class="keyword">double</span><span class="special">)</span>
+<span class="special">&gt;</span> <span class="identifier">identity</span><span class="special">(</span><span class="identifier">identity_s</span><span class="special">,</span> <span class="identifier">identity_i</span><span class="special">,</span> <span class="identifier">identity_d</span><span class="special">);</span>
+
+<span class="comment">// All calls via single `identity` function.</span>
+<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity</span><span class="special">(</span><span class="string">"abc"</span><span class="special">)</span> <span class="special">==</span> <span class="string">"abc"</span><span class="special">);</span>
+<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity</span><span class="special">(</span><span class="number">123</span><span class="special">)</span> <span class="special">==</span> <span class="number">123</span><span class="special">);</span>
+<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity</span><span class="special">(</span><span class="number">1.23</span><span class="special">)</span> <span class="special">==</span> <span class="number">1.23</span><span class="special">);</span>
+</pre>
+<p>
+      </p>
+<p>
+        Note how each function type is passed as a template parameter of <code class="computeroutput"><a class="link" href="../boost/overloaded_function.html" title="Class template overloaded_function">boost::overloaded_function</a></code> using
+        the following syntax (this is <a href="http://www.boost.org/libs/function" target="_top">Boost.Function</a>'s
+        preferred syntax):
+      </p>
+<pre class="programlisting"><span class="emphasis"><em>result-type</em></span> <span class="special">(</span><span class="emphasis"><em>argument1-type</em></span><span class="special">,</span> <span class="emphasis"><em>argument2-type</em></span><span class="special">,</span> <span class="special">...)</span>
+</pre>
+<p>
+        Then the relative function pointers, function references, or <a href="http://en.wikipedia.org/wiki/Polymorphism_(computer_science)" target="_top">monomorphic
+        function</a> objects are passed to the <code class="computeroutput"><a class="link" href="../boost/overloaded_function.html" title="Class template overloaded_function">boost::overloaded_function</a></code>
+        constructor matching the order of the specified template parameters. <sup>[<a name="boost_functional_overloadedfunction.tutorial.overloading.f0" href="#ftn.boost_functional_overloadedfunction.tutorial.overloading.f0" class="footnote">2</a>]</sup> In the above example, <code class="computeroutput"><span class="identifier">identity_s</span></code>
+        is passed as a function pointer (the function address is automatically taken
+        from the function name by the compiler), <code class="computeroutput"><span class="identifier">identity_i</span></code>
+        as a function reference, and <code class="computeroutput"><span class="identifier">identity_d</span></code>
+        as a function object.
+      </p>
+<p>
+        All specified function types must have distinct parameters from one another
+        (so the overloaded calls can be resolved by this library). <sup>[<a name="boost_functional_overloadedfunction.tutorial.overloading.f1" href="#ftn.boost_functional_overloadedfunction.tutorial.overloading.f1" class="footnote">3</a>]</sup> In order to create an overloaded function object, it is necessary
+        to specify at least two function types (because there is nothing to overload
+        between one or zero functions).
+      </p>
+</div>
+<div class="section boost_functional_overloadedfunction_tutorial_without_function_types">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_functional_overloadedfunction.tutorial.without_function_types"></a><a class="link" href="tutorial.html#boost_functional_overloadedfunction.tutorial.without_function_types" title="Without Function Types">Without
+      Function Types</a>
+</h3></div></div></div>
+<p>
+        For convenience, this library also provides the <code class="computeroutput"><a class="link" href="../boost/make_overloaded_function.html" title="Function template make_overloaded_function">boost::make_overloaded_function</a></code>
+        function template which allows to create the overloaded function object without
+        explicitly specifying the function types. The function types are automatically
+        deduced from the specified functions and the appropriate <code class="computeroutput"><a class="link" href="../boost/overloaded_function.html" title="Class template overloaded_function">boost::overloaded_function</a></code>
+        instantiation is returned by <code class="computeroutput"><a class="link" href="../boost/make_overloaded_function.html" title="Function template make_overloaded_function">boost::make_overloaded_function</a></code>.
+      </p>
+<p>
+        The <code class="computeroutput"><a class="link" href="../boost/make_overloaded_function.html" title="Function template make_overloaded_function">boost::make_overloaded_function</a></code>
+        function template can be useful when used together with <a href="http://www.boost.org/doc/libs/typeof" target="_top">Boost.Typeof</a>'s
+        <code class="computeroutput"><span class="identifier">BOOST_AUTO</span></code> (or C++11 <code class="computeroutput"><span class="keyword">auto</span></code>). For example (see also <a href="../../../test/make_decl.cpp" target="_top"><code class="literal">make_decl.cpp</code></a>
+        and <a href="../../../test/identity.hpp" target="_top"><code class="literal">identity.hpp</code></a>):
+      </p>
+<p>
+</p>
+<pre class="programlisting"><span class="identifier">BOOST_AUTO</span><span class="special">(</span><span class="identifier">identity</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_overloaded_function</span><span class="special">(</span>
+        <span class="identifier">identity_s</span><span class="special">,</span> <span class="identifier">identity_i</span><span class="special">,</span> <span class="identifier">identity_d</span><span class="special">));</span>
+
+<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity</span><span class="special">(</span><span class="string">"abc"</span><span class="special">)</span> <span class="special">==</span> <span class="string">"abc"</span><span class="special">);</span>
+<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity</span><span class="special">(</span><span class="number">123</span><span class="special">)</span> <span class="special">==</span> <span class="number">123</span><span class="special">);</span>
+<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity</span><span class="special">(</span><span class="number">1.23</span><span class="special">)</span> <span class="special">==</span> <span class="number">1.23</span><span class="special">);</span>
+</pre>
+<p>
+      </p>
+<p>
+        Note how the overloaded function object <code class="computeroutput"><span class="identifier">identity</span></code>
+        has been created specifying only the functions <code class="computeroutput"><span class="identifier">identity_s</span></code>,
+        <code class="computeroutput"><span class="identifier">identity_i</span></code>, <code class="computeroutput"><span class="identifier">identity_d</span></code> and without specifying the function
+        types <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;</span> <span class="special">(</span><span class="keyword">const</span>
+        <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;)</span></code>,
+        <code class="computeroutput"><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span></code>, and
+        <code class="computeroutput"><span class="keyword">double</span> <span class="special">(</span><span class="keyword">double</span><span class="special">)</span></code> as
+        required instead by <code class="computeroutput"><a class="link" href="../boost/overloaded_function.html" title="Class template overloaded_function">boost::overloaded_function</a></code>.
+        Therefore, <code class="computeroutput"><a class="link" href="../boost/make_overloaded_function.html" title="Function template make_overloaded_function">boost::make_overloaded_function</a></code>
+        provides a more concise syntax in this context when compared with <code class="computeroutput"><a class="link" href="../boost/overloaded_function.html" title="Class template overloaded_function">boost::overloaded_function</a></code>.
+      </p>
+<p>
+        Another case where <code class="computeroutput"><a class="link" href="../boost/make_overloaded_function.html" title="Function template make_overloaded_function">boost::make_overloaded_function</a></code>
+        can be useful is when the overloaded function object is passed to a function
+        template which can hold the specific <code class="computeroutput"><a class="link" href="../boost/overloaded_function.html" title="Class template overloaded_function">boost::overloaded_function</a></code>
+        type using a template parameter. For example (see also <a href="../../../test/make_call.cpp" target="_top"><code class="literal">make_call.cpp</code></a>
+        and <a href="../../../test/identity.hpp" target="_top"><code class="literal">identity.hpp</code></a>):
+      </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">check</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">identity</span><span class="special">)</span> <span class="special">{</span>
+    <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity</span><span class="special">(</span><span class="string">"abc"</span><span class="special">)</span> <span class="special">==</span> <span class="string">"abc"</span><span class="special">);</span>
+    <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity</span><span class="special">(</span><span class="number">123</span><span class="special">)</span> <span class="special">==</span> <span class="number">123</span><span class="special">);</span>
+    <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity</span><span class="special">(</span><span class="number">1.23</span><span class="special">)</span> <span class="special">==</span> <span class="number">1.23</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+      </p>
+<p>
+</p>
+<pre class="programlisting"><span class="identifier">check</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_overloaded_function</span><span class="special">(</span><span class="identifier">identity_s</span><span class="special">,</span> <span class="identifier">identity_i</span><span class="special">,</span> <span class="identifier">identity_d</span><span class="special">));</span>
+</pre>
+<p>
+      </p>
+<p>
+        The library implementation of <code class="computeroutput"><a class="link" href="../boost/make_overloaded_function.html" title="Function template make_overloaded_function">boost::make_overloaded_function</a></code>
+        uses <a href="http://www.boost.org/doc/libs/typeof" target="_top">Boost.Typeof</a>
+        to automatically deduce some of the function types. In order to compile code
+        in <a href="http://www.boost.org/doc/libs/typeof" target="_top">Boost.Typeof</a>
+        emulation mode, all types should be properly registered using <code class="computeroutput"><span class="identifier">BOOST_TYPEOF_REGISTER_TYPE</span></code> and <code class="computeroutput"><span class="identifier">BOOST_TYPEOF_REGISTER_TEMPLATE</span></code>, or appropriate
+        <a href="http://www.boost.org/doc/libs/typeof" target="_top">Boost.Typeof</a> headers
+        should be included (see <a href="http://www.boost.org/doc/libs/typeof" target="_top">Boost.Typeof</a>
+        for more information). For the above examples, it is sufficient to include
+        the <a href="http://www.boost.org/doc/libs/typeof" target="_top">Boost.Typeof</a>
+        header that registers <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span></code>
+        (this library does not require to register <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code>
+        for <a href="http://www.boost.org/doc/libs/typeof" target="_top">Boost.Typeof</a>
+        emulation):
+      </p>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">typeof</span><span class="special">/</span><span class="identifier">std</span><span class="special">/</span><span class="identifier">string</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span> <span class="comment">// No need to register `boost::function`.</span>
+</pre>
+<p>
+      </p>
+</div>
+<div class="footnotes">
+<br><hr width="100" align="left">
+<div class="footnote"><p><sup>[<a id="ftn.boost_functional_overloadedfunction.tutorial.overloading.f0" href="#boost_functional_overloadedfunction.tutorial.overloading.f0" class="para">2</a>] </sup>
+          Function pointers are of the form <code class="literal"><span class="emphasis"><em>result-type </em></span></code><code class="computeroutput"><span class="special">(*)(</span></code><code class="literal"><span class="emphasis"><em>argument1-type</em></span></code><code class="computeroutput"><span class="special">,</span> <span class="special">...)</span></code> (the
+          C++ compiler is usually able to automatically promote a function name to
+          a function pointer in a context where a function pointer is expected even
+          if the function name is not prefixed by <code class="computeroutput"><span class="special">&amp;</span></code>).
+          Function references are of the form <code class="literal"><span class="emphasis"><em>result-type </em></span></code><code class="computeroutput"><span class="special">(&amp;)(</span></code><code class="literal"><span class="emphasis"><em>argument1-type</em></span></code><code class="computeroutput"><span class="special">,</span> <span class="special">...)</span></code>.
+          Function types are of the form <code class="literal"><span class="emphasis"><em>result-type </em></span></code><code class="computeroutput"><span class="special">(</span></code><code class="literal"><span class="emphasis"><em>argument1-type</em></span></code><code class="computeroutput"><span class="special">,</span> <span class="special">...)</span></code> (note
+          how they lack of both <code class="computeroutput"><span class="special">*</span></code> and
+          <code class="computeroutput"><span class="special">&amp;</span></code> when compared to function
+          pointers and function references). Finally, monomorphic function objects
+          are instances of classes with a non-template call operator of the form
+          <code class="literal"><span class="emphasis"><em>result-type </em></span></code><code class="computeroutput"><span class="keyword">operator</span><span class="special">()(</span></code><code class="literal"><span class="emphasis"><em>argument1-type</em></span></code><code class="computeroutput"><span class="special">,</span> <span class="special">...)</span></code>.
+          Unfortunately, it is not possible to support polymorphic function objects
+          (see <a href="http://lists.boost.org/Archives/boost/2012/03/191744.php" target="_top">http://lists.boost.org/Archives/boost/2012/03/191744.php</a>).
+        </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.boost_functional_overloadedfunction.tutorial.overloading.f1" href="#boost_functional_overloadedfunction.tutorial.overloading.f1" class="para">3</a>] </sup>
+          Note that in C++ the function result type is not used for overload resolution
+          (to avoid making the overload resolution context dependent). Therefore,
+          at least one of the function parameters must be distinct for each specified
+          function type.
+        </p></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011, 2012 Lorenzo Caminiti<p>
+        Distributed under the Boost Software License, Version 1.0 (see accompanying
+        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>)
+      </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="getting_started.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="../reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/functional/overloaded_function/doc/html/index.html b/libs/functional/overloaded_function/doc/html/index.html
new file mode 100644
index 0000000..5e6c0e9
--- /dev/null
+++ b/libs/functional/overloaded_function/doc/html/index.html
@@ -0,0 +1,147 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="next" href="boost_functional_overloadedfunction/getting_started.html" title="Getting Started">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="boost_functional_overloadedfunction/getting_started.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a></div>
+<div class="chapter">
+<div class="titlepage"><div>
+<div><h2 class="title">
+<a name="boost_functional_overloadedfunction"></a>Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0</h2></div>
+<div><div class="author"><h3 class="author">
+<span class="firstname">Lorenzo</span> <span class="surname">Caminiti <code class="email">&lt;<a class="email" href="mailto:lorcaminiti@gmail.com">lorcaminiti@gmail.com</a>&gt;</code></span>
+</h3></div></div>
+<div><p class="copyright">Copyright &#169; 2011, 2012 Lorenzo Caminiti</p></div>
+<div><div class="legalnotice">
+<a name="boost_functional_overloadedfunction.legal"></a><p>
+        Distributed under the Boost Software License, Version 1.0 (see accompanying
+        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>)
+      </p>
+</div></div>
+</div></div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section"><a href="index.html#boost_functional_overloadedfunction.introduction">Introduction</a></span></dt>
+<dt><span class="section"><a href="boost_functional_overloadedfunction/getting_started.html">Getting
+    Started</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="boost_functional_overloadedfunction/getting_started.html#boost_functional_overloadedfunction.getting_started.compilers_and_platforms">Compilers
+      and Platforms</a></span></dt>
+<dt><span class="section"><a href="boost_functional_overloadedfunction/getting_started.html#boost_functional_overloadedfunction.getting_started.installation">Installation</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="boost_functional_overloadedfunction/tutorial.html">Tutorial</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="boost_functional_overloadedfunction/tutorial.html#boost_functional_overloadedfunction.tutorial.overloading">Overloading</a></span></dt>
+<dt><span class="section"><a href="boost_functional_overloadedfunction/tutorial.html#boost_functional_overloadedfunction.tutorial.without_function_types">Without
+      Function Types</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="reference.html">Reference</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="reference.html#header.boost.functional.overloaded_function_hpp">Header &lt;boost/functional/overloaded_function.hpp&gt;</a></span></dt>
+<dt><span class="section"><a href="reference.html#header.boost.functional.overloaded_function.config_hpp">Header &lt;boost/functional/overloaded_function/config.hpp&gt;</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="boost_functional_overloadedfunction/acknowledgments.html">Acknowledgments</a></span></dt>
+</dl>
+</div>
+<p>
+    This library allows to overload different functions into a single function object.
+  </p>
+<div class="section boost_functional_overloadedfunction_introduction">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="boost_functional_overloadedfunction.introduction"></a><a class="link" href="index.html#boost_functional_overloadedfunction.introduction" title="Introduction">Introduction</a>
+</h2></div></div></div>
+<p>
+      Consider the following functions which have distinct signatures:
+    </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;</span> <span class="identifier">identity_s</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">)</span> <span class="comment">// Function (as pointer).</span>
+    <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">x</span><span class="special">;</span> <span class="special">}</span>
+
+<span class="keyword">int</span> <span class="identifier">identity_i_impl</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">x</span><span class="special">;</span> <span class="special">}</span>
+<span class="keyword">int</span> <span class="special">(&amp;</span><span class="identifier">identity_i</span><span class="special">)(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">identity_i_impl</span><span class="special">;</span> <span class="comment">// Function reference.</span>
+
+<span class="keyword">double</span> <span class="identifier">identity_d_impl</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">x</span><span class="special">;</span> <span class="special">}</span>
+<span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="keyword">double</span> <span class="special">(</span><span class="keyword">double</span><span class="special">)&gt;</span> <span class="identifier">identity_d</span> <span class="special">=</span> <span class="identifier">identity_d_impl</span><span class="special">;</span> <span class="comment">// Functor.</span>
+</pre>
+<p>
+    </p>
+<p>
+      Instead of calling them using their separate names (here <code class="computeroutput"><span class="identifier">BOOST_TEST</span></code>
+      is equivalent to <code class="computeroutput"><span class="identifier">assert</span></code>):
+      <sup>[<a name="boost_functional_overloadedfunction.introduction.f0" href="#ftn.boost_functional_overloadedfunction.introduction.f0" class="footnote">1</a>]</sup>
+    </p>
+<p>
+</p>
+<pre class="programlisting"><span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity_s</span><span class="special">(</span><span class="string">"abc"</span><span class="special">)</span> <span class="special">==</span> <span class="string">"abc"</span><span class="special">);</span>
+<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity_i</span><span class="special">(</span><span class="number">123</span><span class="special">)</span> <span class="special">==</span> <span class="number">123</span><span class="special">);</span>
+<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity_d</span><span class="special">(</span><span class="number">1.23</span><span class="special">)</span> <span class="special">==</span> <span class="number">1.23</span><span class="special">);</span>
+</pre>
+<p>
+    </p>
+<p>
+      It is possible to use this library to create a single <a href="http://en.wikipedia.org/wiki/Function_overloading" target="_top">overloaded</a>
+      function object (or <a href="http://en.wikipedia.org/wiki/Functor" target="_top">functor</a>)
+      named <code class="computeroutput"><span class="identifier">identity</span></code> that aggregates
+      together the calls to the specific functions (see also <a href="../../test/functor.cpp" target="_top"><code class="literal">functor.cpp</code></a>
+      and <a href="../../test/identity.hpp" target="_top"><code class="literal">identity.hpp</code></a>):
+    </p>
+<p>
+</p>
+<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">overloaded_function</span><span class="special">&lt;</span>
+      <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;)</span>
+    <span class="special">,</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span>
+    <span class="special">,</span> <span class="keyword">double</span> <span class="special">(</span><span class="keyword">double</span><span class="special">)</span>
+<span class="special">&gt;</span> <span class="identifier">identity</span><span class="special">(</span><span class="identifier">identity_s</span><span class="special">,</span> <span class="identifier">identity_i</span><span class="special">,</span> <span class="identifier">identity_d</span><span class="special">);</span>
+
+<span class="comment">// All calls via single `identity` function.</span>
+<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity</span><span class="special">(</span><span class="string">"abc"</span><span class="special">)</span> <span class="special">==</span> <span class="string">"abc"</span><span class="special">);</span>
+<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity</span><span class="special">(</span><span class="number">123</span><span class="special">)</span> <span class="special">==</span> <span class="number">123</span><span class="special">);</span>
+<span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">identity</span><span class="special">(</span><span class="number">1.23</span><span class="special">)</span> <span class="special">==</span> <span class="number">1.23</span><span class="special">);</span>
+</pre>
+<p>
+    </p>
+<p>
+      Note how the functions are called via a single overloaded function object
+      <code class="computeroutput"><span class="identifier">identity</span></code> instead of using their
+      different names <code class="computeroutput"><span class="identifier">identity_s</span></code>,
+      <code class="computeroutput"><span class="identifier">identity_i</span></code>, and <code class="computeroutput"><span class="identifier">identity_d</span></code>.
+    </p>
+</div>
+<div class="footnotes">
+<br><hr width="100" align="left">
+<div class="footnote"><p><sup>[<a id="ftn.boost_functional_overloadedfunction.introduction.f0" href="#boost_functional_overloadedfunction.introduction.f0" class="para">1</a>] </sup>
+        In most of the examples presented in this documentation, the Boost.Detail/LightweightTest
+        (<code class="literal">boost/detail/lightweight_test.hpp</code>) macro <code class="computeroutput"><span class="identifier">BOOST_TEST</span></code> is used to check correctness
+        conditions (conceptually similar to <code class="computeroutput"><span class="identifier">assert</span></code>).
+        A failure of the checked condition does not abort the execution of the program,
+        it will instead make <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span></code>
+        return a non-zero program exit code. Using Boost.Detail/LightweightTest allows
+        to add the examples to the library regression tests so to make sure that
+        they always compile and run correctly.
+      </p></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: April 28, 2012 at 02:19:13 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="boost_functional_overloadedfunction/getting_started.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a></div>
+</body>
+</html>
diff --git a/libs/functional/overloaded_function/doc/html/reference.html b/libs/functional/overloaded_function/doc/html/reference.html
new file mode 100644
index 0000000..55a89f0
--- /dev/null
+++ b/libs/functional/overloaded_function/doc/html/reference.html
@@ -0,0 +1,66 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Reference</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="up" href="index.html" title="Chapter&#160;1.&#160;Boost.Functional/OverloadedFunction 1.0.0">
+<link rel="prev" href="boost_functional_overloadedfunction/tutorial.html" title="Tutorial">
+<link rel="next" href="boost/overloaded_function.html" title="Class template overloaded_function">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="boost_functional_overloadedfunction/tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.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="boost/overloaded_function.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section reference">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="reference"></a>Reference</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="reference.html#header.boost.functional.overloaded_function_hpp">Header &lt;boost/functional/overloaded_function.hpp&gt;</a></span></dt>
+<dt><span class="section"><a href="reference.html#header.boost.functional.overloaded_function.config_hpp">Header &lt;boost/functional/overloaded_function/config.hpp&gt;</a></span></dt>
+</dl></div>
+<div class="section header_boost_functional_overloaded_function_hpp">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.boost.functional.overloaded_function_hpp"></a>Header &lt;<a href="../../../../../boost/functional/overloaded_function.hpp" target="_top">boost/functional/overloaded_function.hpp</a>&gt;</h3></div></div></div>
+<p>Overload distinct function pointers, function references, and monomorphic function objects into a single function object. </p>
+<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F1<span class="special">,</span> <span class="keyword">typename</span> F2<span class="special">,</span> <span class="special">...</span> <span class="special">&gt;</span> <span class="keyword">class</span> <a class="link" href="boost/overloaded_function.html" title="Class template overloaded_function">overloaded_function</a><span class="special">;</span>
+  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F1<span class="special">,</span> <span class="keyword">typename</span> F2<span class="special">,</span> <span class="special">...</span> <span class="special">&gt;</span> 
+    <a class="link" href="boost/overloaded_function.html" title="Class template overloaded_function">overloaded_function</a><span class="special">&lt;</span> <span class="identifier">__function_type__</span><span class="special">&lt;</span> <span class="identifier">F1</span> <span class="special">&gt;</span><span class="special">,</span> <span class="identifier">__function_type__</span><span class="special">&lt;</span> <span class="identifier">F2</span> <span class="special">&gt;</span><span class="special">,</span><span class="special">...</span><span class="special">&gt;</span> 
+    <a class="link" href="boost/make_overloaded_function.html" title="Function template make_overloaded_function"><span class="identifier">make_overloaded_function</span></a><span class="special">(</span><span class="identifier">F1</span><span class="special">,</span> <span class="identifier">F2</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span><span class="special">;</span>
+<span class="special">}</span></pre>
+</div>
+<div class="section header_boost_functional_overloaded_function_config_hpp">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.boost.functional.overloaded_function.config_hpp"></a>Header &lt;<a href="../../../../../boost/functional/overloaded_function/config.hpp" target="_top">boost/functional/overloaded_function/config.hpp</a>&gt;</h3></div></div></div>
+<p>Change the compile-time configuration of this library. </p>
+<pre class="synopsis">
+
+<a class="link" href="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX</a>
+<a class="link" href="BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html" title="Macro BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX">BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX</a></pre>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011, 2012 Lorenzo Caminiti<p>
+        Distributed under the Boost Software License, Version 1.0 (see accompanying
+        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>)
+      </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="boost_functional_overloadedfunction/tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.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="boost/overloaded_function.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/functional/overloaded_function/doc/overloaded_function.qbk b/libs/functional/overloaded_function/doc/overloaded_function.qbk
new file mode 100644
index 0000000..6cf6964
--- /dev/null
+++ b/libs/functional/overloaded_function/doc/overloaded_function.qbk
@@ -0,0 +1,171 @@
+
+[/ Copyright (C) 2009-2012 Lorenzo Caminiti ]
+[/ Distributed under the Boost Software License, Version 1.0 ]
+[/ (see accompanying file LICENSE_1_0.txt or a copy at ]
+[/ http://www.boost.org/LICENSE_1_0.txt) ]
+[/ Home at http://www.boost.org/libs/functional/overloaded_function ]
+
+[library Boost.Functional/OverloadedFunction
+    [quickbook 1.5]
+    [version 1.0.0]
+    [copyright 2011-2012 Lorenzo Caminiti]
+    [purpose overload functions with one function object]
+    [license
+        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])
+    ]
+    [authors [Caminiti <email>lorcaminiti@gmail.com</email>, Lorenzo]]
+    [category Function Objects and Higher-Order Programming]
+]
+
+[def __Introduction__ [link functional_overloaded_function.introduction Introduction]]
+[def __Getting_Started__ [link functional_overloaded_function.getting_started Getting Started]]
+[def __Tutorial__ [link functional_overloaded_function.tutorial Tutorial]]
+[def __Boost__ [@http://www.boost.org Boost]]
+[def __Boost_Test__ [@http://www.boost.org/libs/test Boost.Test]]
+[def __Boost_Function__ [@http://www.boost.org/libs/function Boost.Function]]
+[def __Boost_Typeof__ [@http://www.boost.org/doc/libs/typeof Boost.Typeof]]
+
+[import ../test/identity.hpp]
+[import ../test/functor.cpp]
+[import ../test/make_decl.cpp]
+[import ../test/make_call.cpp]
+
+This library allows to overload different functions into a single function object.
+
+[section Introduction]
+
+Consider the following functions which have distinct signatures:
+
+[identity_decls]
+
+Instead of calling them using their separate names (here `BOOST_TEST` is equivalent to `assert`):
+[footnote
+In most of the examples presented in this documentation, the Boost.Detail/LightweightTest (=boost/detail/lightweight_test.hpp=) macro `BOOST_TEST` is used to check correctness conditions (conceptually similar to `assert`).
+A failure of the checked condition does not abort the execution of the program, it will instead make `boost::report_errors` return a non-zero program exit code.
+Using Boost.Detail/LightweightTest allows to add the examples to the library regression tests so to make sure that they always compile and run correctly.
+]
+
+[identity_calls]
+
+It is possible to use this library to create a single [@http://en.wikipedia.org/wiki/Function_overloading overloaded] function object (or [@http://en.wikipedia.org/wiki/Functor functor]) named `identity` that aggregates together the calls to the specific functions (see also [@../../test/functor.cpp =functor.cpp=] and [@../../test/identity.hpp =identity.hpp=]):
+
+[identity_functor]
+
+Note how the functions are called via a single overloaded function object `identity` instead of using their different names `identity_s`, `identity_i`, and `identity_d`.
+
+[endsect]
+
+[section Getting Started]
+
+This section explains how to setup a system to use this library.
+
+[section Compilers and Platforms]
+
+The authors originally developed and tested this library on:
+
+# GNU Compiler Collection (GCC) C++ 4.5.3 (with and without C++11 features enabled `-std=c++0x`) on Cygwin.
+# Miscrosoft Visual C++ (MSVC) 8.0 on Windows 7.
+
+See the library [@http://www.boost.org/development/tests/release/developer/functional-overloaded_function.html regressions test results] for detailed information on supported compilers and platforms.
+Check the library regression test [@../../test/Jamfile.v2 =Jamfile.v2=] for any special configuration that might be required for a specific compiler.
+
+[endsect]
+
+[section Installation]
+
+This library is composed of header files only.
+Therefore there is no pre-compiled object file which needs to be installed.
+Programmers can simply instruct the compiler where to find the library header files (`-I` option on GCC, `/I` option on MSVC, etc) and compile code using the library.
+
+The maximum number of functions to overload is given by the [macroref BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX] configuration macro.
+The maximum number of function parameters for each of the specified function type is given by the [macroref BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX] configuration macro.
+All configuration macros have appropriate default values when they are left undefined.
+
+[endsect]
+
+[endsect]
+
+[section Tutorial]
+
+This section explains how to use this library.
+
+[section Overloading]
+
+Consider the following functions which have distinct signatures:
+
+[identity_decls]
+
+This library header [headerref boost/functional/overloaded_function.hpp] provides a [classref boost::overloaded_function] class template that creates a single overloaded function object that can be used to call the specified functions instead of using the separate function names (see also [@../../test/functor.cpp =functor.cpp=] and [@../../test/identity.hpp =identity.hpp=]):
+
+[identity_functor]
+
+Note how each function type is passed as a template parameter of [classref boost::overloaded_function] using the following syntax (this is __Boost_Function__'s preferred syntax):
+
+    ``/result-type/`` (``/argument1-type/``, ``/argument2-type/``, ...)
+
+Then the relative function pointers, function references, or [@http://en.wikipedia.org/wiki/Polymorphism_(computer_science) monomorphic function] objects are passed to the [classref boost::overloaded_function] constructor matching the order of the specified template parameters.
+[footnote
+Function pointers are of the form [^['result-type ]]`(*)(`[^['argument1-type]]`, ...)` (the C++ compiler is usually able to automatically promote a function name to a function pointer in a context where a function pointer is expected even if the function name is not prefixed by `&`).
+Function references are of the form [^['result-type ]]`(&)(`[^['argument1-type]]`, ...)`.
+Function types are of the form [^['result-type ]]`(`[^['argument1-type]]`, ...)` (note how they lack of both `*` and `&` when compared to function pointers and function references).
+Finally, monomorphic function objects are instances of classes with a non-template call operator of the form [^['result-type ]]`operator()(`[^['argument1-type]]`, ...)`.
+Unfortunately, it is not possible to support polymorphic function objects (see [@http://lists.boost.org/Archives/boost/2012/03/191744.php]).
+]
+In the above example, `identity_s` is passed as a function pointer (the function address is automatically taken from the function name by the compiler), `identity_i` as a function reference, and `identity_d` as a function object.
+
+All specified function types must have distinct parameters from one another (so the overloaded calls can be resolved by this library).
+[footnote
+Note that in C++ the function result type is not used for overload resolution (to avoid making the overload resolution context dependent).
+Therefore, at least one of the function parameters must be distinct for each specified function type.
+]
+In order to create an overloaded function object, it is necessary to specify at least two function types (because there is nothing to overload between one or zero functions).
+
+[endsect]
+
+[section Without Function Types]
+
+For convenience, this library also provides the [funcref boost::make_overloaded_function] function template which allows to create the overloaded function object without explicitly specifying the function types.
+The function types are automatically deduced from the specified functions and the appropriate [classref boost::overloaded_function] instantiation is returned by [funcref boost::make_overloaded_function].
+
+The [funcref boost::make_overloaded_function] function template can be useful when used together with __Boost_Typeof__'s `BOOST_AUTO` (or C++11 `auto`).
+For example (see also [@../../test/make_decl.cpp =make_decl.cpp=] and [@../../test/identity.hpp =identity.hpp=]):
+
+[identity_make_decl]
+
+Note how the overloaded function object `identity` has been created specifying only the functions `identity_s`, `identity_i`, `identity_d` and without specifying the function types `const std::string& (const std::string&)`, `int (int)`, and `double (double)` as required instead by [classref boost::overloaded_function].
+Therefore, [funcref boost::make_overloaded_function] provides a more concise syntax in this context when compared with [classref boost::overloaded_function].
+
+Another case where [funcref boost::make_overloaded_function] can be useful is when the overloaded function object is passed to a function template which can hold the specific [classref boost::overloaded_function] type using a template parameter.
+For example (see also [@../../test/make_call.cpp =make_call.cpp=] and [@../../test/identity.hpp =identity.hpp=]):
+
+[identity_make_checks]
+[identity_make_call]
+
+The library implementation of [funcref boost::make_overloaded_function] uses __Boost_Typeof__ to automatically deduce some of the function types.
+In order to compile code in __Boost_Typeof__ emulation mode, all types should be properly registered using `BOOST_TYPEOF_REGISTER_TYPE` and `BOOST_TYPEOF_REGISTER_TEMPLATE`, or appropriate __Boost_Typeof__ headers should be included (see __Boost_Typeof__ for more information).
+For the above examples, it is sufficient to include the __Boost_Typeof__ header that registers `std::string` (this library does not require to register `boost::function` for __Boost_Typeof__ emulation):
+
+[identity_typeof]
+
+[endsect]
+
+[endsect]
+
+[xinclude reference.xml]
+
+[section Acknowledgments]
+
+Many thanks to Mathias Gaunard for suggesting to implement [classref boost::overloaded_function] and for some sample code.
+
+Thanks to John Bytheway for suggesting to implement [funcref boost::make_overloaded_function].
+
+Thanks to Nathan Ridge for suggestions on how to implement [funcref boost::make_overloaded_function].
+
+Thanks to Robert Stewart for commenting on the library name.
+
+Many thanks to the entire __Boost__ community and mailing list for providing valuable comments about this library and great insights on the C++ programming language.
+
+[endsect]
+
diff --git a/libs/functional/overloaded_function/index.html b/libs/functional/overloaded_function/index.html
new file mode 100644
index 0000000..00b3362
--- /dev/null
+++ b/libs/functional/overloaded_function/index.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <meta http-equiv="refresh" content="0; URL=doc/html/index.html">
+  </head>
+  <body>
+    Automatic redirection failed, click this 
+    <a href="doc/html/index.html">link</a> &nbsp;<hr>
+    <p>© Copyright Lorenzo Caminiti, 2009-2012</p>
+    <p>Distributed under the Boost Software License, Version 1.0 (see 
+    accompanying file <a href="../../../LICENSE_1_0.txt">
+    LICENSE_1_0.txt</a> or a copy at
+    <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
+  </body>
+</html>
diff --git a/libs/functional/overloaded_function/test/Jamfile.v2 b/libs/functional/overloaded_function/test/Jamfile.v2
new file mode 100644
index 0000000..3871ee5
--- /dev/null
+++ b/libs/functional/overloaded_function/test/Jamfile.v2
@@ -0,0 +1,16 @@
+
+# Copyright (C) 2009-2012 Lorenzo Caminiti
+# Distributed under the Boost Software License, Version 1.0
+# (see accompanying file LICENSE_1_0.txt or a copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# Home at http://www.boost.org/libs/functional/overloaded_function
+
+import testing ;
+
+# Sun does not automatically detect type-of emulation (force it).
+project : requirements <toolset>sun:<define>BOOST_TYPEOF_EMULATION ;
+
+run functor.cpp ;
+run make_decl.cpp ;
+run make_call.cpp ;
+
diff --git a/libs/functional/overloaded_function/test/functor.cpp b/libs/functional/overloaded_function/test/functor.cpp
new file mode 100644
index 0000000..078d977
--- /dev/null
+++ b/libs/functional/overloaded_function/test/functor.cpp
@@ -0,0 +1,34 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#include "identity.hpp"
+#include <boost/functional/overloaded_function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int main() {
+    //[identity_calls
+    BOOST_TEST(identity_s("abc") == "abc");
+    BOOST_TEST(identity_i(123) == 123);
+    BOOST_TEST(identity_d(1.23) == 1.23);
+    //]
+
+    //[identity_functor
+    ndnboost::overloaded_function<
+          const std::string& (const std::string&)
+        , int (int)
+        , double (double)
+    > identity(identity_s, identity_i, identity_d);
+
+    // All calls via single `identity` function.
+    BOOST_TEST(identity("abc") == "abc");
+    BOOST_TEST(identity(123) == 123);
+    BOOST_TEST(identity(1.23) == 1.23);
+    //]
+
+    return ndnboost::report_errors();
+}
+
diff --git a/libs/functional/overloaded_function/test/identity.hpp b/libs/functional/overloaded_function/test/identity.hpp
new file mode 100644
index 0000000..85c5a2c
--- /dev/null
+++ b/libs/functional/overloaded_function/test/identity.hpp
@@ -0,0 +1,29 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#ifndef IDENTITY_HPP_
+#define IDENTITY_HPP_
+
+//[identity_typeof
+#include <boost/typeof/std/string.hpp> // No need to register `ndnboost::function`.
+//]
+#include <boost/function.hpp>
+#include <string>
+
+//[identity_decls
+const std::string& identity_s(const std::string& x) // Function (as pointer).
+    { return x; }
+
+int identity_i_impl(int x) { return x; }
+int (&identity_i)(int) = identity_i_impl; // Function reference.
+
+double identity_d_impl(double x) { return x; }
+ndnboost::function<double (double)> identity_d = identity_d_impl; // Functor.
+//]
+
+#endif // #include guard
+
diff --git a/libs/functional/overloaded_function/test/make_call.cpp b/libs/functional/overloaded_function/test/make_call.cpp
new file mode 100644
index 0000000..4c55b52
--- /dev/null
+++ b/libs/functional/overloaded_function/test/make_call.cpp
@@ -0,0 +1,27 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#include "identity.hpp"
+#include <boost/functional/overloaded_function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+//[identity_make_checks
+template<typename F>
+void check(F identity) {
+    BOOST_TEST(identity("abc") == "abc");
+    BOOST_TEST(identity(123) == 123);
+    BOOST_TEST(identity(1.23) == 1.23);
+}
+//]
+
+int main() {
+    //[identity_make_call
+    check(ndnboost::make_overloaded_function(identity_s, identity_i, identity_d));
+    //]
+    return ndnboost::report_errors();
+}
+
diff --git a/libs/functional/overloaded_function/test/make_decl.cpp b/libs/functional/overloaded_function/test/make_decl.cpp
new file mode 100644
index 0000000..b76834e
--- /dev/null
+++ b/libs/functional/overloaded_function/test/make_decl.cpp
@@ -0,0 +1,24 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/functional/overloaded_function
+
+#include "identity.hpp"
+#include <boost/functional/overloaded_function.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int main() {
+    //[identity_make_decl
+    BOOST_AUTO(identity, ndnboost::make_overloaded_function(
+            identity_s, identity_i, identity_d));
+
+    BOOST_TEST(identity("abc") == "abc");
+    BOOST_TEST(identity(123) == 123);
+    BOOST_TEST(identity(1.23) == 1.23);
+    //]
+    return ndnboost::report_errors();
+}
+
diff --git a/libs/functional/ptr_fun.html b/libs/functional/ptr_fun.html
new file mode 100644
index 0000000..0dc62b4
--- /dev/null
+++ b/libs/functional/ptr_fun.html
@@ -0,0 +1,158 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+  <meta http-equiv="Content-Language" content="en-us">
+  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+
+  <title>Boost Function Object Adapter Library</title>
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+  <table border="1" bgcolor="#007F7F" cellpadding="2" summary="">
+    <tr>
+      <td bgcolor="#FFFFFF"><img src="../../boost.png" alt=
+      "boost.png (6897 bytes)" width="277" height="86"></td>
+
+      <td><a href="../../index.htm"><font face="Arial" color=
+      "#FFFFFF"><big>Home</big></font></a></td>
+
+      <td><a href="../libraries.htm"><font face="Arial" color=
+      "#FFFFFF"><big>Libraries</big></font></a></td>
+
+      <td><a href="http://www.boost.org/people/people.htm"><font face="Arial" color=
+      "#FFFFFF"><big>People</big></font></a></td>
+
+      <td><a href="http://www.boost.org/more/faq.htm"><font face="Arial" color=
+      "#FFFFFF"><big>FAQ</big></font></a></td>
+
+      <td><a href="../../more/index.htm"><font face="Arial" color=
+      "#FFFFFF"><big>More</big></font></a></td>
+    </tr>
+  </table>
+
+  <h1>Function Pointer Adapters</h1>
+
+  <p>The header <a href="../../boost/functional.hpp">functional.hpp</a>
+  provides enhanced versions of both the function pointer adapters from the
+  C++ Standard Library (&sect;20.3.7):</p>
+
+  <ul>
+    <li><tt>pointer_to_unary_function</tt></li>
+
+    <li><tt>pointer_to_binary_function</tt></li>
+  </ul>
+
+  <p>As well as the corresponding helper function template:</p>
+
+  <ul>
+    <li><tt>ptr_fun</tt></li>
+  </ul>
+
+  <p>However, you should not need to use the adapters in conjunction with the
+  adapters in this library due to our use of <a href=
+  "function_traits.html">function object traits</a>. You will however need to
+  use them if your implementation fails to work properly with our traits
+  classes (due to lack if partial specialisation), or if you wish to use a
+  function object adapter from a third party.</p>
+
+  <h3>Usage</h3>
+
+  <p>If you need to use these adapters, usage is identical to the standard
+  function pointer adapters. For example,</p>
+
+  <blockquote>
+    <pre>
+bool bad(std::string foo) { ... }
+...
+std::vector&lt;std::string&gt; c;
+...
+std::vector&lt;std::string&gt;::iterator it
+     = std::find_if(c.begin(), c.end(), std::not1(boost::ptr_fun(bad)));
+</pre>
+  </blockquote>
+
+  <p>Note however that this library contains enhanced <a href=
+  "negators.html">negators</a> that support function object traits, so the
+  line above could equally be written</p>
+
+  <blockquote>
+    <pre>
+std::vector&lt;std::string&gt;::iterator it
+     = std::find_if(c.begin(), c.end(), boost::not1(bad));
+</pre>
+  </blockquote>
+
+  <h3>Argument Types</h3>
+
+  <p>The standard defines <tt>pointer_to_unary_function</tt> like this
+  (&sect;20.3.8&nbsp;&para;2):</p>
+
+  <blockquote>
+    <pre>
+template &lt;class Arg, class Result&gt;
+class pointer_to_unary_function : public unary_function&lt;Arg, Result&gt; {
+public:
+  explicit pointer_to_unary_function(Result (* f)(<strong>Arg</strong>));
+  Result operator()(<strong>Arg</strong> x) const;
+};
+</pre>
+  </blockquote>
+
+  <p>Note that the argument to <tt>operator()</tt> is exactly the same type
+  as the argument to the wrapped function. If this is a value type, the
+  argument will be passed by value and copied twice.
+  <tt>pointer_to_binary_function</tt> has a similar problem.</p>
+
+  <p>However, if we were to try and eliminate this inefficiency by instead
+  declaring the argument as <tt>const&nbsp;Arg&amp;</tt>, then if Arg were a
+  reference type, we would have a reference to a reference, which is
+  currently illegal (but see <a href=
+  "http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#106">C++ core
+  language issue number 106)</a></p>
+
+  <p>So the way in which we want to declare the argument for
+  <tt>operator()</tt> depends on whether or not the wrapped function's
+  argument is a reference. If it is a reference, we want to declare it simply
+  as <tt>Arg</tt>; if it is a value we want to declare it as
+  <tt>const&nbsp;Arg&amp;</tt>.</p>
+
+  <p>The Boost <a href="../utility/call_traits.htm">call_traits</a> class
+  template contains a <tt>param_type</tt> typedef, which uses partial
+  specialisation to make precisely this decision. By declaring the
+  <tt>operator()</tt> as</p>
+
+  <blockquote>
+    <pre>
+Result operator()(typename call_traits&lt;Arg&gt;::param_type x) const
+</pre>
+  </blockquote>
+
+  <p>we achieve the desired result - we improve efficiency without generating
+  references to references.</p>
+
+  <h3>Limitations</h3>
+
+  <p>The call traits template used to realise this improvement relies on
+  partial specialisation, so this improvement is only available on compilers
+  that support that feature. With other compilers, the argument passed to the
+  function will always be passed by reference, thus generating the
+  possibility of references to references.</p>
+  <hr>
+
+  <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
+  "../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
+  height="31" width="88"></a></p>
+
+  <p>Revised 
+  <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->02
+  December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38510" --></p>
+
+  <p><i>Copyright &copy; 2000 Cadenza New Zealand Ltd.</i></p>
+
+  <p><i>Distributed under the Boost Software License, Version 1.0. (See
+  accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
+  copy at <a href=
+  "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
+</body>
+</html>
diff --git a/libs/functional/sublibs b/libs/functional/sublibs
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libs/functional/sublibs
diff --git a/libs/functional/test/Jamfile.v2 b/libs/functional/test/Jamfile.v2
new file mode 100644
index 0000000..dbe379c
--- /dev/null
+++ b/libs/functional/test/Jamfile.v2
@@ -0,0 +1,9 @@
+#~ Copyright Rene Rivera 2008
+#~ 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)
+
+import testing ;
+
+test-suite functional :
+    [ run function_test.cpp ]
+    ;
diff --git a/libs/functional/test/function_test.cpp b/libs/functional/test/function_test.cpp
new file mode 100644
index 0000000..cf63bea
--- /dev/null
+++ b/libs/functional/test/function_test.cpp
@@ -0,0 +1,334 @@
+// ------------------------------------------------------------------------------
+// Copyright (c) 2000 Cadenza New Zealand Ltd
+// Distributed under the Boost Software License, Version 1.0. (See accompany-
+// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+// ------------------------------------------------------------------------------
+// Tests for the Boost functional.hpp header file
+//
+// Note that functional.hpp relies on partial specialisation to be
+// effective.  If your compiler lacks this feature, very few of the
+// tests would compile, and so have been excluded from the test.
+// ------------------------------------------------------------------------------
+// $Id: function_test.cpp 50456 2009-01-04 05:17:02Z bgubenko $
+// ------------------------------------------------------------------------------
+// $Log$
+// Revision 1.3  2006/12/02 13:57:32  andreas_huber69
+// Fixed license & copyright issues.
+//
+// From Mark Rodgers Fri Dec 1 12:59:14 2006
+// X-Apparently-To: ahd6974-boostorg -at- yahoo.com via 68.142.206.160; Fri, 01 Dec 2006 12:59:41 -0800
+// X-Originating-IP: [195.112.4.54]
+// Return-Path: <mark.rodgers -at- cadenza.co.nz>
+// Authentication-Results: mta550.mail.mud.yahoo.com from=cadenza.co.nz; domainkeys=neutral (no sig)
+// Received: from 195.112.4.54 (EHLO smtp.nildram.co.uk) (195.112.4.54) by mta550.mail.mud.yahoo.com with SMTP; Fri, 01 Dec 2006 12:59:40 -0800
+// Received: from snagglepuss.cadenza.co.nz (81-6-246-87.dyn.gotadsl.co.uk [81.6.246.87]) by smtp.nildram.co.uk (Postfix) with ESMTP id D32EA2B6D8C for <ahd6974-boostorg -at- yahoo.com>; Fri, 1 Dec 2006 20:59:35 +0000 (GMT)
+// Received: from penfold.cadenza.co.nz ([192.168.55.56]) by snagglepuss.cadenza.co.nz with esmtp (Exim 4.63) (envelope-from <mark.rodgers -at- cadenza.co.nz>) id J9M4Y9-0009TO-9K for ahd6974-boostorg -at- yahoo.com; Fri, 01 Dec 2006 20:58:57 +0000
+// Message-ID: <457097A2.1090305@cadenza.co.nz>
+// Date: Fri, 01 Dec 2006 20:59:14 +0000
+// From: "Mark Rodgers" <mark.rodgers -at- cadenza.co.nz>
+// User-Agent: Thunderbird 1.5.0.8 (Macintosh/20061025)
+// MIME-Version: 1.0
+// To: ahd6974-boostorg -at- yahoo.com [Edit - Delete]
+// Subject: Re: [boost] Reminder: Need your permission to correct license & copyright issues
+// References: <379990.36007.qm@web33507.mail.mud.yahoo.com>
+// In-Reply-To: <379990.36007.qm@web33507.mail.mud.yahoo.com>
+// Content-Type: text/plain; charset=ISO-8859-1; format=flowed
+// Content-Transfer-Encoding: 7bit
+// Content-Length: 812
+// Gidday Andreas
+//
+// Sure that's fine.  I'm happy for you to do 1, 2 and 3.
+//
+// Regards
+// Mark
+//
+// Andreas Huber wrote:
+// > Hello Mark
+// >
+// > Quite a while ago it was decided that every file that goes into the
+// > 1.34 release of the Boost distribution (www.boost.org) needs uniform
+// > license and copyright information. For more information please see:
+// >
+// > <http://www.boost.org/more/license_info.html>
+// >
+// > You are receiving this email because several files you contributed
+// > lack such information or have an old license:
+// >
+// > boost/functional/functional.hpp
+// > boost/libs/functional/binders.html
+// > boost/libs/functional/function_test.cpp
+// > boost/libs/functional/function_traits.html
+// > boost/libs/functional/index.html
+// > boost/libs/functional/mem_fun.html
+// > boost/libs/functional/negators.html
+// > boost/libs/functional/ptr_fun.html
+// > boost/people/mark_rodgers.htm
+// >
+// > I therefore kindly ask you to grant the permission to do the
+// > following:
+// >
+// > 1. For the files above that already have a license text (all except
+// > mark_rodgers.htm), replace the license text with:
+// >
+// > "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)"
+// >
+// > 2. For the file that does not yet have a license and copyright
+// > (mark_rodgers.htm) add the same license text as under 1. and add the
+// > following copyright:
+// >
+// > "(c) Copyright Mark Rodgers 2000"
+// >
+// > 3. (Optional) I would also want to convert all HTML files to conform
+// > the HTML 4.01 Standard by running them through HTML Tidy, see
+// > <http://tidy.sf.net>
+// >
+// > It would be great if you could grant me permission to do 1 & 2 and
+// > optionally also 3.
+// >
+// > Thank you!
+// >
+// > Regards,
+// >
+// > Andreas Huber
+// >
+//
+// Revision 1.2  2001/09/22 11:52:24  johnmaddock
+// Intel C++ fixes: no void return types supported.
+//
+// Revision 1.1.1.1  2000/07/07 16:04:18  beman
+// 1.16.1 initial CVS checkin
+//
+// Revision 1.3  2000/06/26 09:44:01  mark
+// Updated following feedback from Jens Maurer.
+//
+// Revision 1.2  2000/05/17 08:31:45  mark
+// Added extra tests now that function traits work correctly.
+// For compilers with no support for partial specialisation,
+// excluded tests that won't work.
+//
+// Revision 1.1  2000/05/07 09:14:41  mark
+// Initial revision
+// ------------------------------------------------------------------------------
+
+// To demonstrate what the boosted function object adapters do for
+// you, try compiling with USE_STD defined.  This will endeavour to
+// use the standard function object adapters, but is likely to result
+// in numerous errors due to the fact that you cannot have references
+// to references.
+#ifdef USE_STD
+#include <functional>
+#define boost std
+#else
+#include <boost/functional.hpp>
+#endif
+
+#include <algorithm>
+#include <iostream>
+#include <iterator>
+#include <string>
+#include <vector>
+
+class Person
+{
+  public:
+    Person() {}
+    Person(const char *n) : name(n) {}
+
+    const std::string &get_name() const { return name; }
+    void print(std::ostream &os) const { os << name << " "; }
+    void set_name(const std::string &n) { name = n; std::cout << name << " "; }
+    std::string clear_name() { std::string ret = name; name = ""; return ret; }
+    void do_something(int) const {}
+
+    bool is_fred() const { return name == "Fred"; }
+    
+  private:
+    std::string name;
+};
+
+namespace
+{
+    bool is_equal(const std::string &s1, const std::string &s2)
+    {
+        return s1 == s2;
+    }
+
+    bool is_betty(const std::string &s)
+    {
+        return s == "Betty";
+    }
+
+    void do_set_name(Person *p, const std::string &name)
+    {
+        p->set_name(name);
+    }
+    
+    void do_set_name_ref(Person &p, const std::string &name)
+    {
+        p.set_name(name);
+    }
+}
+
+int main()
+{
+    std::vector<Person> v1;
+    v1.push_back("Fred");
+    v1.push_back("Wilma");
+    v1.push_back("Barney");
+    v1.push_back("Betty");
+
+    const std::vector<Person> cv1(v1.begin(), v1.end());
+
+    std::vector<std::string> v2;
+    v2.push_back("Fred");
+    v2.push_back("Wilma");
+    v2.push_back("Barney");
+    v2.push_back("Betty");
+
+    Person person;
+    Person &r = person;
+
+    Person fred("Fred");
+    Person wilma("Wilma");
+    Person barney("Barney");
+    Person betty("Betty");
+    std::vector<Person*> v3;
+    v3.push_back(&fred);
+    v3.push_back(&wilma);
+    v3.push_back(&barney);
+    v3.push_back(&betty);
+
+    const std::vector<Person*> cv3(v3.begin(), v3.end());
+    std::vector<const Person*> v3c(v3.begin(), v3.end());
+
+    std::ostream &os = std::cout;
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(__ICL)
+    // unary_traits, unary_negate
+    std::transform(v2.begin(), v2.end(),
+                   std::ostream_iterator<bool>(std::cout, " "),
+                   ndnboost::not1(is_betty));
+
+    std::cout << '\n';
+    std::transform(v1.begin(), v1.end(),
+                   std::ostream_iterator<bool>(std::cout, " "),
+                   ndnboost::not1(ndnboost::mem_fun_ref(&Person::is_fred)));
+
+    // binary_traits, binary_negate
+    std::cout << '\n';
+    std::transform(v2.begin(), v2.end(),
+                   std::ostream_iterator<bool>(std::cout, " "),
+                   ndnboost::bind1st(ndnboost::not2(is_equal), "Betty"));
+
+    std::cout << '\n';
+    std::transform(v2.begin(), v2.end(),
+                   std::ostream_iterator<bool>(std::cout, " "),
+                   ndnboost::bind2nd(ndnboost::not2(is_equal), "Betty"));
+
+    // pointer_to_unary_function
+    std::cout << '\n';
+    std::transform(v2.begin(), v2.end(),
+                   std::ostream_iterator<bool>(std::cout, " "),
+                   ndnboost::not1(ndnboost::ptr_fun(is_betty)));
+
+    // binary_traits, bind1st, bind2nd
+    std::cout << '\n';
+    std::transform(v2.begin(), v2.end(),
+                   std::ostream_iterator<bool>(std::cout, " "),
+                   ndnboost::bind1st(is_equal, "Betty"));
+
+    std::cout << '\n';
+    std::transform(v2.begin(), v2.end(),
+                   std::ostream_iterator<bool>(std::cout, " "),
+                   ndnboost::bind2nd(is_equal, "Betty"));
+
+    // pointer_to_binary_function, bind1st
+    std::cout << '\n';
+    std::for_each(v2.begin(), v2.end(), ndnboost::bind1st(ndnboost::ptr_fun(do_set_name), &person));
+
+    std::cout << '\n';
+    std::for_each(v2.begin(), v2.end(), ndnboost::bind1st(ndnboost::ptr_fun(do_set_name_ref), person));
+
+    std::cout << '\n';
+    std::for_each(v2.begin(), v2.end(), ndnboost::bind1st(ndnboost::ptr_fun(do_set_name_ref), r));
+
+    // binary_traits
+    std::cout << '\n';
+    std::for_each(v2.begin(), v2.end(), ndnboost::bind1st(do_set_name, &person));
+
+    std::cout << '\n';
+    std::for_each(v2.begin(), v2.end(), ndnboost::bind1st(do_set_name_ref, person));
+
+    std::cout << '\n';
+    std::for_each(v2.begin(), v2.end(), ndnboost::bind1st(do_set_name_ref, r));
+#endif
+
+    // const_mem_fun_t
+    std::cout << '\n';
+    std::transform(v3.begin(), v3.end(),
+                   std::ostream_iterator<std::string>(std::cout, " "),
+                   ndnboost::mem_fun(&Person::get_name));
+
+    std::cout << '\n';
+    std::transform(cv3.begin(), cv3.end(),
+                   std::ostream_iterator<std::string>(std::cout, " "),
+                   ndnboost::mem_fun(&Person::get_name));
+
+    std::cout << '\n';
+    std::transform(v3c.begin(), v3c.end(),
+                   std::ostream_iterator<std::string>(std::cout, " "),
+                   ndnboost::mem_fun(&Person::get_name));
+
+    // const_mem_fun_ref_t
+    std::cout << '\n';
+    std::transform(v1.begin(), v1.end(),
+                   std::ostream_iterator<std::string>(std::cout, " "),
+                   ndnboost::mem_fun_ref(&Person::get_name));
+
+    std::cout << '\n';
+    std::transform(cv1.begin(), cv1.end(),
+                   std::ostream_iterator<std::string>(std::cout, " "),
+                   ndnboost::mem_fun_ref(&Person::get_name));
+
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+    // const_mem_fun1_t, bind2nd
+    std::cout << '\n';
+    std::for_each(v3.begin(), v3.end(), ndnboost::bind2nd(ndnboost::mem_fun(&Person::print), std::cout));
+
+    std::cout << '\n';
+    std::for_each(v3.begin(), v3.end(), ndnboost::bind2nd(ndnboost::mem_fun(&Person::print), os));
+
+    // const_mem_fun1_ref_t, bind2nd
+    std::cout << '\n';
+    std::for_each(v1.begin(), v1.end(), ndnboost::bind2nd(ndnboost::mem_fun_ref(&Person::print), std::cout));
+
+    std::cout << '\n';
+    std::for_each(v1.begin(), v1.end(), ndnboost::bind2nd(ndnboost::mem_fun_ref(&Person::print), os));
+
+    // mem_fun1_t, bind1st
+    std::cout << '\n';
+    std::for_each(v2.begin(), v2.end(), ndnboost::bind1st(ndnboost::mem_fun(&Person::set_name), &person));
+
+    // mem_fun1_ref_t, bind1st
+    std::cout << '\n';
+    std::for_each(v2.begin(), v2.end(), ndnboost::bind1st(ndnboost::mem_fun_ref(&Person::set_name), person));
+
+    std::cout << '\n';
+    std::for_each(v2.begin(), v2.end(), ndnboost::bind1st(ndnboost::mem_fun_ref(&Person::set_name), r));
+#endif
+
+    // mem_fun_t
+    std::cout << '\n';
+    std::transform(v3.begin(), v3.end(), std::ostream_iterator<std::string>(std::cout, " "),
+                   ndnboost::mem_fun(&Person::clear_name));
+    
+    // mem_fun_ref_t
+    std::cout << '\n';
+    std::transform(v1.begin(), v1.end(), std::ostream_iterator<std::string>(std::cout, " "),
+                   ndnboost::mem_fun_ref(&Person::clear_name));    
+
+    std::cout << '\n';
+    return 0;
+}
diff --git a/libs/smart_ptr/src/sp_collector.cpp b/libs/smart_ptr/src/sp_collector.cpp
new file mode 100644
index 0000000..379f8e9
--- /dev/null
+++ b/libs/smart_ptr/src/sp_collector.cpp
@@ -0,0 +1,270 @@
+//
+//  sp_collector.cpp
+//
+//  Copyright (c) 2002, 2003 Peter Dimov
+//
+// 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)
+//
+
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+
+#include <boost/assert.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/detail/lightweight_mutex.hpp>
+#include <cstdlib>
+#include <map>
+#include <deque>
+#include <iostream>
+
+typedef std::map< void const *, std::pair<void *, size_t> > map_type;
+
+static map_type & get_map()
+{
+    static map_type m;
+    return m;
+}
+
+typedef ndnboost::detail::lightweight_mutex mutex_type;
+
+static mutex_type & get_mutex()
+{
+    static mutex_type m;
+    return m;
+}
+
+static void * init_mutex_before_main = &get_mutex();
+
+namespace
+{
+    class X;
+
+    struct count_layout
+    {
+        ndnboost::detail::sp_counted_base * pi;
+        int id;
+    };
+
+    struct shared_ptr_layout
+    {
+        X * px;
+        count_layout pn;
+    };
+}
+
+// assume 4 byte alignment for pointers when scanning
+size_t const pointer_align = 4;
+
+typedef std::map<void const *, long> map2_type;
+
+static void scan_and_count(void const * area, size_t size, map_type const & m, map2_type & m2)
+{
+    unsigned char const * p = static_cast<unsigned char const *>(area);
+
+    for(size_t n = 0; n + sizeof(shared_ptr_layout) <= size; p += pointer_align, n += pointer_align)
+    {
+        shared_ptr_layout const * q = reinterpret_cast<shared_ptr_layout const *>(p);
+
+        if(q->pn.id == ndnboost::detail::shared_count_id && q->pn.pi != 0 && m.count(q->pn.pi) != 0)
+        {
+            ++m2[q->pn.pi];
+        }
+    }
+}
+
+typedef std::deque<void const *> open_type;
+
+static void scan_and_mark(void const * area, size_t size, map2_type & m2, open_type & open)
+{
+    unsigned char const * p = static_cast<unsigned char const *>(area);
+
+    for(size_t n = 0; n + sizeof(shared_ptr_layout) <= size; p += pointer_align, n += pointer_align)
+    {
+        shared_ptr_layout const * q = reinterpret_cast<shared_ptr_layout const *>(p);
+
+        if(q->pn.id == ndnboost::detail::shared_count_id && q->pn.pi != 0 && m2.count(q->pn.pi) != 0)
+        {
+            open.push_back(q->pn.pi);
+            m2.erase(q->pn.pi);
+        }
+    }
+}
+
+static void find_unreachable_objects_impl(map_type const & m, map2_type & m2)
+{
+    // scan objects for shared_ptr members, compute internal counts
+
+    {
+        std::cout << "... " << m.size() << " objects in m.\n";
+
+        for(map_type::const_iterator i = m.begin(); i != m.end(); ++i)
+        {
+            ndnboost::detail::sp_counted_base const * p = static_cast<ndnboost::detail::sp_counted_base const *>(i->first);
+
+            BOOST_ASSERT(p->use_count() != 0); // there should be no inactive counts in the map
+
+            m2[ i->first ];
+
+            scan_and_count(i->second.first, i->second.second, m, m2);
+        }
+
+        std::cout << "... " << m2.size() << " objects in m2.\n";
+    }
+
+    // mark reachable objects
+
+    {
+        open_type open;
+
+        for(map2_type::iterator i = m2.begin(); i != m2.end(); ++i)
+        {
+            ndnboost::detail::sp_counted_base const * p = static_cast<ndnboost::detail::sp_counted_base const *>(i->first);
+            if(p->use_count() != i->second) open.push_back(p);
+        }
+
+        std::cout << "... " << open.size() << " objects in open.\n";
+
+        for(open_type::iterator j = open.begin(); j != open.end(); ++j)
+        {
+            m2.erase(*j);
+        }
+
+        while(!open.empty())
+        {
+            void const * p = open.front();
+            open.pop_front();
+
+            map_type::const_iterator i = m.find(p);
+            BOOST_ASSERT(i != m.end());
+
+            scan_and_mark(i->second.first, i->second.second, m2, open);
+        }
+    }
+
+    // m2 now contains the unreachable objects
+}
+
+std::size_t find_unreachable_objects(bool report)
+{
+    map2_type m2;
+
+#ifdef BOOST_HAS_THREADS
+
+    // This will work without the #ifdef, but some compilers warn
+    // that lock is not referenced
+
+    mutex_type::scoped_lock lock(get_mutex());
+
+#endif
+
+    map_type const & m = get_map();
+
+    find_unreachable_objects_impl(m, m2);
+
+    if(report)
+    {
+        for(map2_type::iterator j = m2.begin(); j != m2.end(); ++j)
+        {
+            map_type::const_iterator i = m.find(j->first);
+            BOOST_ASSERT(i != m.end());
+            std::cout << "Unreachable object at " << i->second.first << ", " << i->second.second << " bytes long.\n";
+        }
+    }
+
+    return m2.size();
+}
+
+typedef std::deque< ndnboost::shared_ptr<X> > free_list_type;
+
+static void scan_and_free(void * area, size_t size, map2_type const & m2, free_list_type & free)
+{
+    unsigned char * p = static_cast<unsigned char *>(area);
+
+    for(size_t n = 0; n + sizeof(shared_ptr_layout) <= size; p += pointer_align, n += pointer_align)
+    {
+        shared_ptr_layout * q = reinterpret_cast<shared_ptr_layout *>(p);
+
+        if(q->pn.id == ndnboost::detail::shared_count_id && q->pn.pi != 0 && m2.count(q->pn.pi) != 0 && q->px != 0)
+        {
+            ndnboost::shared_ptr<X> * ppx = reinterpret_cast< ndnboost::shared_ptr<X> * >(p);
+            free.push_back(*ppx);
+            ppx->reset();
+        }
+    }
+}
+
+void free_unreachable_objects()
+{
+    free_list_type free;
+
+    {
+        map2_type m2;
+
+#ifdef BOOST_HAS_THREADS
+
+        mutex_type::scoped_lock lock(get_mutex());
+
+#endif
+
+        map_type const & m = get_map();
+
+        find_unreachable_objects_impl(m, m2);
+
+        for(map2_type::iterator j = m2.begin(); j != m2.end(); ++j)
+        {
+            map_type::const_iterator i = m.find(j->first);
+            BOOST_ASSERT(i != m.end());
+            scan_and_free(i->second.first, i->second.second, m2, free);
+        }
+    }
+
+    std::cout << "... about to free " << free.size() << " objects.\n";
+}
+
+// debug hooks
+
+namespace ndnboost
+{
+
+void sp_scalar_constructor_hook(void *)
+{
+}
+
+void sp_scalar_constructor_hook(void * px, std::size_t size, void * pn)
+{
+#ifdef BOOST_HAS_THREADS
+
+    mutex_type::scoped_lock lock(get_mutex());
+
+#endif
+
+    get_map()[pn] = std::make_pair(px, size);
+}
+
+void sp_scalar_destructor_hook(void *)
+{
+}
+
+void sp_scalar_destructor_hook(void *, std::size_t, void * pn)
+{
+#ifdef BOOST_HAS_THREADS
+
+    mutex_type::scoped_lock lock(get_mutex());
+
+#endif
+
+    get_map().erase(pn);
+}
+
+void sp_array_constructor_hook(void *)
+{
+}
+
+void sp_array_destructor_hook(void *)
+{
+}
+
+} // namespace ndnboost
+
+#endif // defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
diff --git a/libs/smart_ptr/src/sp_debug_hooks.cpp b/libs/smart_ptr/src/sp_debug_hooks.cpp
new file mode 100644
index 0000000..227cc8c
--- /dev/null
+++ b/libs/smart_ptr/src/sp_debug_hooks.cpp
@@ -0,0 +1,243 @@
+//
+//  sp_debug_hooks.cpp
+//
+//  Copyright (c) 2002, 2003 Peter Dimov
+//
+// 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)
+//
+
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+
+#include <boost/assert.hpp>
+#include <new>
+#include <cstdlib>
+
+int const m = 2; // m * sizeof(int) must be aligned appropriately
+
+// magic values to mark heap blocks with
+
+int const allocated_scalar  = 0x1234560C;
+int const allocated_array   = 0x1234560A;
+int const adopted_scalar    = 0x0567890C;
+int const adopted_array     = 0x0567890A;
+int const deleted           = 0x498769DE;
+
+using namespace std; // for compilers where things aren't in std
+
+// operator new
+
+static new_handler get_new_handler()
+{
+    new_handler p = set_new_handler(0);
+    set_new_handler(p);
+    return p;
+}
+
+static void * allocate(size_t n, int mark)
+{
+    int * pm;
+
+    for(;;)
+    {
+        pm = static_cast<int*>(malloc(n + m * sizeof(int)));
+
+        if(pm != 0) break;
+
+        if(new_handler pnh = get_new_handler())
+        {
+            pnh();
+        }
+        else
+        {
+            return 0;
+        }
+    }
+
+    *pm = mark;
+
+    return pm + m;
+}
+
+void * operator new(size_t n) throw(bad_alloc)
+{
+    void * p = allocate(n, allocated_scalar);
+
+#if !defined(BOOST_NO_EXCEPTIONS)
+
+    if(p == 0) throw bad_alloc();
+
+#endif
+
+    return p;
+}
+
+#if !defined(__BORLANDC__) || (__BORLANDC__ > 0x551)
+
+void * operator new(size_t n, nothrow_t const &) throw()
+{
+    return allocate(n, allocated_scalar);
+}
+
+#endif
+
+void * operator new[](size_t n) throw(bad_alloc)
+{
+    void * p = allocate(n, allocated_array);
+
+#if !defined(BOOST_NO_EXCEPTIONS)
+
+    if(p == 0) throw bad_alloc();
+
+#endif
+
+    return p;
+}
+
+#if !defined(__BORLANDC__) || (__BORLANDC__ > 0x551)
+
+void * operator new[](size_t n, nothrow_t const &) throw()
+{
+    return allocate(n, allocated_array);
+}
+
+#endif
+
+// debug hooks
+
+namespace ndnboost
+{
+
+void sp_scalar_constructor_hook(void * p)
+{
+    if(p == 0) return;
+
+    int * pm = static_cast<int*>(p);
+    pm -= m;
+
+    BOOST_ASSERT(*pm != adopted_scalar);    // second smart pointer to the same address
+    BOOST_ASSERT(*pm != allocated_array);   // allocated with new[]
+    BOOST_ASSERT(*pm == allocated_scalar);  // not allocated with new
+
+    *pm = adopted_scalar;
+}
+
+void sp_scalar_constructor_hook(void * px, std::size_t, void *)
+{
+    sp_scalar_constructor_hook(px);
+}
+
+void sp_scalar_destructor_hook(void * p)
+{
+    if(p == 0) return;
+
+    int * pm = static_cast<int*>(p);
+    pm -= m;
+
+    BOOST_ASSERT(*pm == adopted_scalar);    // attempt to destroy nonmanaged block
+
+    *pm = allocated_scalar;
+}
+
+void sp_scalar_destructor_hook(void * px, std::size_t, void *)
+{
+    sp_scalar_destructor_hook(px);
+}
+
+// It is not possible to handle the array hooks in a portable manner.
+// The implementation typically reserves a bit of storage for the number
+// of objects in the array, and the argument of the array hook isn't
+// equal to the return value of operator new[].
+
+void sp_array_constructor_hook(void * /* p */)
+{
+/*
+    if(p == 0) return;
+
+    // adjust p depending on the implementation
+
+    int * pm = static_cast<int*>(p);
+    pm -= m;
+
+    BOOST_ASSERT(*pm != adopted_array);     // second smart array pointer to the same address
+    BOOST_ASSERT(*pm != allocated_scalar);  // allocated with new
+    BOOST_ASSERT(*pm == allocated_array);   // not allocated with new[]
+
+    *pm = adopted_array;
+*/
+}
+
+void sp_array_destructor_hook(void * /* p */)
+{
+/*
+    if(p == 0) return;
+
+    // adjust p depending on the implementation
+
+    int * pm = static_cast<int*>(p);
+    pm -= m;
+
+    BOOST_ASSERT(*pm == adopted_array); // attempt to destroy nonmanaged block
+
+    *pm = allocated_array;
+*/
+}
+
+} // namespace ndnboost
+
+// operator delete
+
+void operator delete(void * p) throw()
+{
+    if(p == 0) return;
+
+    int * pm = static_cast<int*>(p);
+    pm -= m;
+
+    BOOST_ASSERT(*pm != deleted);           // double delete
+    BOOST_ASSERT(*pm != adopted_scalar);    // delete p.get();
+    BOOST_ASSERT(*pm != allocated_array);   // allocated with new[]
+    BOOST_ASSERT(*pm == allocated_scalar);  // not allocated with new
+
+    *pm = deleted;
+
+    free(pm);
+}
+
+#if !defined(__BORLANDC__) || (__BORLANDC__ > 0x551)
+
+void operator delete(void * p, nothrow_t const &) throw()
+{
+    ::operator delete(p);
+}
+
+#endif
+
+void operator delete[](void * p) throw()
+{
+    if(p == 0) return;
+
+    int * pm = static_cast<int*>(p);
+    pm -= m;
+
+    BOOST_ASSERT(*pm != deleted);           // double delete
+    BOOST_ASSERT(*pm != adopted_scalar);    // delete p.get();
+    BOOST_ASSERT(*pm != allocated_scalar);  // allocated with new
+    BOOST_ASSERT(*pm == allocated_array);   // not allocated with new[]
+
+    *pm = deleted;
+
+    free(pm);
+}
+
+#if !defined(__BORLANDC__) || (__BORLANDC__ > 0x551)
+
+void operator delete[](void * p, nothrow_t const &) throw()
+{
+    ::operator delete[](p);
+}
+
+#endif
+
+#endif // defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
diff --git a/libs/test/build/Jamfile.v2 b/libs/test/build/Jamfile.v2
new file mode 100644
index 0000000..fad71ac
--- /dev/null
+++ b/libs/test/build/Jamfile.v2
@@ -0,0 +1,111 @@
+#  (C) Copyright boost 2004.
+#  Distributed under the Boost Software License, Version 1.0. 
+#  (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)
+#
+#  See http://www.boost.org/libs/test for the library home page.
+
+project boost/test 
+    : source-location ../src
+    : requirements <link>shared:<define>BOOST_TEST_DYN_LINK=1
+                   <toolset>msvc:<asynch-exceptions>on
+                   <toolset>borland:<cxxflags>-w-8080
+                   <toolset>borland:<cxxflags>-w-8001
+                   # Disable Warning about boost::noncopyable not being exported
+                   <link>shared,<toolset>msvc:<cxxflags>-wd4275
+                   <toolset>msvc:<cxxflags>-wd4671
+                   <toolset>msvc:<cxxflags>-wd4673
+                   <warnings>all
+    : usage-requirements
+                   <define>BOOST_TEST_NO_AUTO_LINK=1
+                   # Disable Warning about boost::noncopyable not being exported
+                   <link>shared,<toolset>msvc:<cxxflags>-wd4275
+    ;
+
+PRG_EXEC_MON_SOURCES =
+  execution_monitor
+  debug
+  cpp_main
+  ;
+
+TEST_EXEC_MON_SOURCES =
+  compiler_log_formatter
+  debug
+  execution_monitor
+  framework
+  plain_report_formatter
+  progress_monitor
+  results_collector
+  results_reporter
+  test_main
+  test_tools
+  unit_test_log
+  unit_test_main
+  unit_test_monitor
+  unit_test_parameters
+  unit_test_suite
+  xml_log_formatter
+  xml_report_formatter
+  ;
+
+UTF_SOURCES =
+  compiler_log_formatter
+  debug
+  exception_safety
+  execution_monitor
+  framework
+  interaction_based
+  logged_expectations
+  plain_report_formatter
+  progress_monitor
+  results_collector
+  results_reporter
+  test_tools
+  unit_test_log
+  unit_test_main
+  unit_test_monitor
+  unit_test_parameters
+  unit_test_suite
+  xml_log_formatter
+  xml_report_formatter
+  ;
+
+lib ndnboost_prg_exec_monitor 
+  : # sources
+    $(PRG_EXEC_MON_SOURCES).cpp 
+  : # requirements
+  : # default build
+  : # usage-requirements
+    <link>shared:<define>BOOST_TEST_DYN_LINK=1
+  ;
+
+lib ndnboost_test_exec_monitor
+  : # sources
+    $(TEST_EXEC_MON_SOURCES).cpp
+  : # requirements
+    <link>static
+  : # default build
+  : # usage-requirements
+    <link>shared:<define>BOOST_TEST_DYN_LINK=1
+  ;
+
+lib ndnboost_unit_test_framework
+  : # sources
+    $(UTF_SOURCES).cpp
+  : # requirements
+  : # default build
+  : # usage-requirements
+    <link>shared:<define>BOOST_TEST_DYN_LINK=1
+  ;
+
+alias minimal : : : :
+                   <toolset>msvc:<asynch-exceptions>on
+       ;
+
+alias included : : : :
+                   <toolset>msvc:<asynch-exceptions>on
+       ;
+
+boost-install ndnboost_prg_exec_monitor 
+              ndnboost_test_exec_monitor
+              ndnboost_unit_test_framework ;
+          
\ No newline at end of file
diff --git a/libs/test/src/compiler_log_formatter.cpp b/libs/test/src/compiler_log_formatter.cpp
new file mode 100644
index 0000000..3b1c6da
--- /dev/null
+++ b/libs/test/src/compiler_log_formatter.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/compiler_log_formatter.ipp>
+
+// EOF
diff --git a/libs/test/src/cpp_main.cpp b/libs/test/src/cpp_main.cpp
new file mode 100644
index 0000000..d3b7d77
--- /dev/null
+++ b/libs/test/src/cpp_main.cpp
@@ -0,0 +1,19 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/cpp_main.ipp>
+
+// EOF
+
diff --git a/libs/test/src/debug.cpp b/libs/test/src/debug.cpp
new file mode 100644
index 0000000..94e6f3e
--- /dev/null
+++ b/libs/test/src/debug.cpp
@@ -0,0 +1,24 @@
+//  (C) Copyright Gennadiy Rozental 2006-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/debug.ipp>
+
+// ***************************************************************************
+//  Revision History :
+//  
+//  $Log$
+// ***************************************************************************
+
+// EOF
diff --git a/libs/test/src/exception_safety.cpp b/libs/test/src/exception_safety.cpp
new file mode 100644
index 0000000..c1ec55b
--- /dev/null
+++ b/libs/test/src/exception_safety.cpp
@@ -0,0 +1,19 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/exception_safety.ipp>
+
+// EOF
+
diff --git a/libs/test/src/execution_monitor.cpp b/libs/test/src/execution_monitor.cpp
new file mode 100644
index 0000000..d610ea5
--- /dev/null
+++ b/libs/test/src/execution_monitor.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/execution_monitor.ipp>
+
+// EOF
diff --git a/libs/test/src/framework.cpp b/libs/test/src/framework.cpp
new file mode 100644
index 0000000..c6fbd1e
--- /dev/null
+++ b/libs/test/src/framework.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/framework.ipp>
+
+// EOF
diff --git a/libs/test/src/interaction_based.cpp b/libs/test/src/interaction_based.cpp
new file mode 100644
index 0000000..15b9d86
--- /dev/null
+++ b/libs/test/src/interaction_based.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/interaction_based.ipp>
+
+// EOF
diff --git a/libs/test/src/logged_expectations.cpp b/libs/test/src/logged_expectations.cpp
new file mode 100644
index 0000000..b12ab53
--- /dev/null
+++ b/libs/test/src/logged_expectations.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/logged_expectations.ipp>
+
+// EOF
diff --git a/libs/test/src/plain_report_formatter.cpp b/libs/test/src/plain_report_formatter.cpp
new file mode 100644
index 0000000..825696d
--- /dev/null
+++ b/libs/test/src/plain_report_formatter.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/plain_report_formatter.ipp>
+
+// EOF
diff --git a/libs/test/src/progress_monitor.cpp b/libs/test/src/progress_monitor.cpp
new file mode 100644
index 0000000..0c77f45
--- /dev/null
+++ b/libs/test/src/progress_monitor.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/progress_monitor.ipp>
+
+// EOF
diff --git a/libs/test/src/results_collector.cpp b/libs/test/src/results_collector.cpp
new file mode 100644
index 0000000..ddf8d21
--- /dev/null
+++ b/libs/test/src/results_collector.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/results_collector.ipp>
+
+// EOF
diff --git a/libs/test/src/results_reporter.cpp b/libs/test/src/results_reporter.cpp
new file mode 100644
index 0000000..b6848c4
--- /dev/null
+++ b/libs/test/src/results_reporter.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/results_reporter.ipp>
+
+// EOF
diff --git a/libs/test/src/test_main.cpp b/libs/test/src/test_main.cpp
new file mode 100644
index 0000000..f9fffbf
--- /dev/null
+++ b/libs/test/src/test_main.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/test_main.ipp>
+
+// EOF
diff --git a/libs/test/src/test_tools.cpp b/libs/test/src/test_tools.cpp
new file mode 100644
index 0000000..3154fa5
--- /dev/null
+++ b/libs/test/src/test_tools.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/test_tools.ipp>
+
+// EOF
diff --git a/libs/test/src/unit_test_log.cpp b/libs/test/src/unit_test_log.cpp
new file mode 100644
index 0000000..b22017e
--- /dev/null
+++ b/libs/test/src/unit_test_log.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/unit_test_log.ipp>
+
+// EOF
diff --git a/libs/test/src/unit_test_main.cpp b/libs/test/src/unit_test_main.cpp
new file mode 100644
index 0000000..44fc10a
--- /dev/null
+++ b/libs/test/src/unit_test_main.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/unit_test_main.ipp>
+
+// EOF
diff --git a/libs/test/src/unit_test_monitor.cpp b/libs/test/src/unit_test_monitor.cpp
new file mode 100644
index 0000000..413016b
--- /dev/null
+++ b/libs/test/src/unit_test_monitor.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/unit_test_monitor.ipp>
+
+// EOF
diff --git a/libs/test/src/unit_test_parameters.cpp b/libs/test/src/unit_test_parameters.cpp
new file mode 100644
index 0000000..527258e
--- /dev/null
+++ b/libs/test/src/unit_test_parameters.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/unit_test_parameters.ipp>
+
+// EOF
diff --git a/libs/test/src/unit_test_suite.cpp b/libs/test/src/unit_test_suite.cpp
new file mode 100644
index 0000000..8308085
--- /dev/null
+++ b/libs/test/src/unit_test_suite.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/unit_test_suite.ipp>
+
+// EOF
diff --git a/libs/test/src/xml_log_formatter.cpp b/libs/test/src/xml_log_formatter.cpp
new file mode 100644
index 0000000..4921670
--- /dev/null
+++ b/libs/test/src/xml_log_formatter.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/xml_log_formatter.ipp>
+
+// EOF
diff --git a/libs/test/src/xml_report_formatter.cpp b/libs/test/src/xml_report_formatter.cpp
new file mode 100644
index 0000000..5b706ad
--- /dev/null
+++ b/libs/test/src/xml_report_formatter.cpp
@@ -0,0 +1,18 @@
+//  (C) Copyright Gennadiy Rozental 2005-2008.
+//  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)
+
+//  See http://www.boost.org/libs/test for the library home page.
+//
+//  File        : $RCSfile$
+//
+//  Version     : $Revision: 49313 $
+//
+//  Description : forwarding source
+// ***************************************************************************
+
+#define BOOST_TEST_SOURCE
+#include <boost/test/impl/xml_report_formatter.ipp>
+
+// EOF