Squashed 'third_party/boostorg/bind/' content from commit d67200b
Change-Id: I21573b0bd786f4e8482a7bb79a73b7574be6bdae
git-subtree-dir: third_party/boostorg/bind
git-subtree-split: d67200bd2a1f67135a4c677636546ec9615e21ea
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..3e84d7c
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,96 @@
+* text=auto !eol svneol=native#text/plain
+*.gitattributes text svneol=native#text/plain
+
+# Scriptish formats
+*.bat text svneol=native#text/plain
+*.bsh text svneol=native#text/x-beanshell
+*.cgi text svneol=native#text/plain
+*.cmd text svneol=native#text/plain
+*.js text svneol=native#text/javascript
+*.php text svneol=native#text/x-php
+*.pl text svneol=native#text/x-perl
+*.pm text svneol=native#text/x-perl
+*.py text svneol=native#text/x-python
+*.sh eol=lf svneol=LF#text/x-sh
+configure eol=lf svneol=LF#text/x-sh
+
+# Image formats
+*.bmp binary svneol=unset#image/bmp
+*.gif binary svneol=unset#image/gif
+*.ico binary svneol=unset#image/ico
+*.jpeg binary svneol=unset#image/jpeg
+*.jpg binary svneol=unset#image/jpeg
+*.png binary svneol=unset#image/png
+*.tif binary svneol=unset#image/tiff
+*.tiff binary svneol=unset#image/tiff
+*.svg text svneol=native#image/svg%2Bxml
+
+# Data formats
+*.pdf binary svneol=unset#application/pdf
+*.avi binary svneol=unset#video/avi
+*.doc binary svneol=unset#application/msword
+*.dsp text svneol=crlf#text/plain
+*.dsw text svneol=crlf#text/plain
+*.eps binary svneol=unset#application/postscript
+*.gz binary svneol=unset#application/gzip
+*.mov binary svneol=unset#video/quicktime
+*.mp3 binary svneol=unset#audio/mpeg
+*.ppt binary svneol=unset#application/vnd.ms-powerpoint
+*.ps binary svneol=unset#application/postscript
+*.psd binary svneol=unset#application/photoshop
+*.rdf binary svneol=unset#text/rdf
+*.rss text svneol=unset#text/xml
+*.rtf binary svneol=unset#text/rtf
+*.sln text svneol=native#text/plain
+*.swf binary svneol=unset#application/x-shockwave-flash
+*.tgz binary svneol=unset#application/gzip
+*.vcproj text svneol=native#text/xml
+*.vcxproj text svneol=native#text/xml
+*.vsprops text svneol=native#text/xml
+*.wav binary svneol=unset#audio/wav
+*.xls binary svneol=unset#application/vnd.ms-excel
+*.zip binary svneol=unset#application/zip
+
+# Text formats
+.htaccess text svneol=native#text/plain
+*.bbk text svneol=native#text/xml
+*.cmake text svneol=native#text/plain
+*.css text svneol=native#text/css
+*.dtd text svneol=native#text/xml
+*.htm text svneol=native#text/html
+*.html text svneol=native#text/html
+*.ini text svneol=native#text/plain
+*.log text svneol=native#text/plain
+*.mak text svneol=native#text/plain
+*.qbk text svneol=native#text/plain
+*.rst text svneol=native#text/plain
+*.sql text svneol=native#text/x-sql
+*.txt text svneol=native#text/plain
+*.xhtml text svneol=native#text/xhtml%2Bxml
+*.xml text svneol=native#text/xml
+*.xsd text svneol=native#text/xml
+*.xsl text svneol=native#text/xml
+*.xslt text svneol=native#text/xml
+*.xul text svneol=native#text/xul
+*.yml text svneol=native#text/plain
+boost-no-inspect text svneol=native#text/plain
+CHANGES text svneol=native#text/plain
+COPYING text svneol=native#text/plain
+INSTALL text svneol=native#text/plain
+Jamfile text svneol=native#text/plain
+Jamroot text svneol=native#text/plain
+Jamfile.v2 text svneol=native#text/plain
+Jamrules text svneol=native#text/plain
+Makefile* text svneol=native#text/plain
+README text svneol=native#text/plain
+TODO text svneol=native#text/plain
+
+# Code formats
+*.c text svneol=native#text/plain
+*.cpp text svneol=native#text/plain
+*.h text svneol=native#text/plain
+*.hpp text svneol=native#text/plain
+*.ipp text svneol=native#text/plain
+*.tpp text svneol=native#text/plain
+*.jam text svneol=native#text/plain
+*.java text svneol=native#text/plain
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..1398d31
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,199 @@
+# Copyright 2016, 2017 Peter Dimov
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
+
+language: cpp
+
+sudo: false
+
+python: "2.7"
+
+branches:
+ only:
+ - master
+ - develop
+ - /feature\/.*/
+
+env:
+ matrix:
+ - BOGUS_JOB=true
+
+matrix:
+
+ exclude:
+ - env: BOGUS_JOB=true
+
+ include:
+ - os: linux
+ compiler: g++
+ env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
+
+ - os: linux
+ compiler: g++-4.7
+ env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11
+ addons:
+ apt:
+ packages:
+ - g++-4.7
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: g++-4.8
+ env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11
+ addons:
+ apt:
+ packages:
+ - g++-4.8
+ sources:
+ - ubuntu-toolchain-r-test
+ - os: linux
+ compiler: g++-4.9
+ env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11
+ addons:
+ apt:
+ packages:
+ - g++-4.9
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: g++-5
+ env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - g++-5
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: g++-6
+ env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - g++-6
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ dist: trusty
+ compiler: g++-7
+ env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
+ addons:
+ apt:
+ packages:
+ - g++-7
+ sources:
+ - ubuntu-toolchain-r-test
+
+ - os: linux
+ compiler: clang++
+ env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
+
+ - os: linux
+ compiler: clang++-3.5
+ env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-3.5
+ - libstdc++-4.9-dev
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-precise-3.5
+
+ - os: linux
+ compiler: clang++-3.6
+ env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-3.6
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-precise-3.6
+
+ - os: linux
+ compiler: clang++-3.7
+ env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-3.7
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-precise-3.7
+
+ - os: linux
+ compiler: clang++-3.8
+ env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-3.8
+ - libstdc++-4.9-dev
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-precise-3.8
+
+ - os: linux
+ compiler: clang++-3.9
+ env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-3.9
+ - libstdc++-4.9-dev
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-precise-3.9
+
+ - os: linux
+ compiler: clang++-4.0
+ env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-4.0
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-trusty-4.0
+
+ - os: linux
+ compiler: clang++-5.0
+ env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
+ addons:
+ apt:
+ packages:
+ - clang-5.0
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-trusty-5.0
+
+ - os: osx
+ compiler: clang++
+ env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
+
+install:
+ - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
+ - cd ..
+ - git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
+ - cd boost-root
+ - git submodule update --init tools/build
+ - git submodule update --init libs/config
+ - git submodule update --init tools/boostdep
+ - cp -r $TRAVIS_BUILD_DIR/* libs/bind
+ - python tools/boostdep/depinst/depinst.py bind
+ - ./bootstrap.sh
+ - ./b2 headers
+
+script:
+ - |-
+ echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
+ - ./b2 -j 3 libs/bind/test toolset=$TOOLSET cxxstd=$CXXSTD
+
+notifications:
+ email:
+ on_success: always
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..ebe5553
--- /dev/null
+++ b/README.md
@@ -0,0 +1,6 @@
+# Boost.Bind
+
+Branch | Travis | Appveyor
+---------|--------|---------
+Develop | [](https://travis-ci.org/boostorg/bind) | [](https://ci.appveyor.com/project/pdimov/bind)
+Master | [](https://travis-ci.org/boostorg/bind) | [](https://ci.appveyor.com/project/pdimov/bind)
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..4c9991f
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,43 @@
+# Copyright 2016, 2017 Peter Dimov
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
+
+version: 1.0.{build}-{branch}
+
+shallow_clone: true
+
+branches:
+ only:
+ - master
+ - develop
+ - /feature\/.*/
+
+environment:
+ matrix:
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
+ TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ TOOLSET: msvc-14.0
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+ TOOLSET: msvc-14.1
+ CXXSTD: 14,17
+
+install:
+ - set BOOST_BRANCH=develop
+ - if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
+ - cd ..
+ - git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
+ - cd boost-root
+ - git submodule update --init tools/build
+ - git submodule update --init libs/config
+ - git submodule update --init tools/boostdep
+ - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\bind
+ - python tools/boostdep/depinst/depinst.py bind
+ - cmd /c bootstrap
+ - b2 -d0 headers
+
+build: off
+
+test_script:
+ - if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
+ - b2 -j 3 libs/bind/test toolset=%TOOLSET% %CXXSTD%
diff --git a/bind.html b/bind.html
new file mode 100644
index 0000000..bcc5add
--- /dev/null
+++ b/bind.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Boost.Bind</title>
+<meta charset="utf-8">
+<meta http-equiv="refresh" content="0; url=doc/html/bind.html">
+<style>
+ body {
+ background: #fff;
+ color: #000;
+ }
+ a {
+ color: #00f;
+ text-decoration: none;
+ }
+</style>
+</head>
+<body>
+ <p>
+ Automatic redirection failed, please go to
+ <a href="doc/html/bind.html">doc/html/bind.html</a>
+ </p>
+ <p>
+ © 2001, 2002 Peter Dimov and Multi Media Ltd.<br>
+ © 2003-2008 Peter Dimov
+ </p>
+</body>
+</html>
diff --git a/bind_as_compose.cpp b/bind_as_compose.cpp
new file mode 100644
index 0000000..999856c
--- /dev/null
+++ b/bind_as_compose.cpp
@@ -0,0 +1,76 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_as_compose.cpp - function composition using bind.hpp
+//
+// Version 1.00.0001 (2001-08-30)
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+//
+// 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/bind.hpp>
+#include <iostream>
+#include <string>
+
+std::string f(std::string const & x)
+{
+ return "f(" + x + ")";
+}
+
+std::string g(std::string const & x)
+{
+ return "g(" + x + ")";
+}
+
+std::string h(std::string const & x, std::string const & y)
+{
+ return "h(" + x + ", " + y + ")";
+}
+
+std::string k()
+{
+ return "k()";
+}
+
+template<class F> void test(F f)
+{
+ std::cout << f("x", "y") << '\n';
+}
+
+int main()
+{
+ using namespace boost;
+
+ // compose_f_gx
+
+ test( bind(f, bind(g, _1)) );
+
+ // compose_f_hxy
+
+ test( bind(f, bind(h, _1, _2)) );
+
+ // compose_h_fx_gx
+
+ test( bind(h, bind(f, _1), bind(g, _1)) );
+
+ // compose_h_fx_gy
+
+ test( bind(h, bind(f, _1), bind(g, _2)) );
+
+ // compose_f_k
+
+ test( bind(f, bind(k)) );
+
+ return 0;
+}
diff --git a/bind_visitor.cpp b/bind_visitor.cpp
new file mode 100644
index 0000000..1ce7b53
--- /dev/null
+++ b/bind_visitor.cpp
@@ -0,0 +1,65 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_visitor.cpp - tests bind.hpp with a visitor
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+//
+// 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/bind.hpp>
+#include <boost/ref.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+#include <typeinfo>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+//
+
+struct visitor
+{
+ template<class T> void operator()( boost::reference_wrapper<T> const & r ) const
+ {
+ std::cout << "Reference to " << typeid(T).name() << " @ " << &r.get() << " (with value " << r.get() << ")\n";
+ }
+
+ template<class T> void operator()( T const & t ) const
+ {
+ std::cout << "Value of type " << typeid(T).name() << " (with value " << t << ")\n";
+ }
+};
+
+int f(int & i, int & j, int)
+{
+ ++i;
+ --j;
+ return i + j;
+}
+
+int x = 2;
+int y = 7;
+
+int main()
+{
+ using namespace boost;
+
+ visitor v;
+ visit_each(v, bind<int>(bind(f, ref(x), _1, 42), ref(y)), 0);
+}
diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2
new file mode 100644
index 0000000..c9d0689
--- /dev/null
+++ b/doc/Jamfile.v2
@@ -0,0 +1,60 @@
+# 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 doc/bind ;
+
+import boostbook ;
+import quickbook ;
+
+xml bind_ : bind.qbk ;
+boostbook standalone_bind
+ :
+ bind_
+ :
+ <xsl:param>boost.root=../../../..
+ # File name of HTML output:
+ <xsl:param>root.filename=bind
+ # How far down we chunk nested sections, basically all of them:
+ <xsl:param>chunk.section.depth=0
+ # Don't put the first section on the same page as the TOC:
+ <xsl:param>chunk.first.sections=0
+ # How far down sections get TOC's
+ <xsl:param>toc.section.depth=2
+ # Max depth in each TOC:
+ <xsl:param>toc.max.depth=2
+ # How far down we go with TOC's
+ <xsl:param>generate.section.toc.level=0
+
+ <xsl:param>generate.manifest=0
+ ;
+
+xml mem_fn_ : mem_fn.qbk ;
+boostbook standalone_mem_fn
+ :
+ mem_fn_
+ :
+ <xsl:param>boost.root=../../../..
+ # File name of HTML output:
+ <xsl:param>root.filename=mem_fn
+ # How far down we chunk nested sections, basically all of them:
+ <xsl:param>chunk.section.depth=0
+ # Don't put the first section on the same page as the TOC:
+ <xsl:param>chunk.first.sections=0
+ # How far down sections get TOC's
+ <xsl:param>toc.section.depth=2
+ # Max depth in each TOC:
+ <xsl:param>toc.max.depth=2
+ # How far down we go with TOC's
+ <xsl:param>generate.section.toc.level=0
+
+ <xsl:param>generate.manifest=0
+ ;
+
+###############################################################################
+alias boostdoc ;
+explicit boostdoc ;
+alias boostrelease : standalone_bind standalone_mem_fn ;
+explicit boostrelease ;
diff --git a/doc/bind.qbk b/doc/bind.qbk
new file mode 100644
index 0000000..807ba68
--- /dev/null
+++ b/doc/bind.qbk
@@ -0,0 +1,35 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2008 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)
+ /]
+
+[library Boost.Bind
+ [quickbook 1.6]
+ [id bind]
+ [copyright 2001, 2002 Peter Dimov and Multi Media Ltd.]
+ [copyright 2003-2008 Peter Dimov]
+ [dirname bind]
+ [license Distributed under the
+ [@http://boost.org/LICENSE_1_0.txt Boost Software License,
+ Version 1.0].
+ ]
+]
+
+[template simplesect[title]
+[block '''<simplesect><title>'''[title]'''</title>''']]
+
+[template endsimplesect[]
+[block '''</simplesect>''']]
+
+[include bind/purpose.qbk]
+[include bind/examples.qbk]
+[include bind/limitations.qbk]
+[include bind/faq.qbk]
+[include bind/troubleshooting.qbk]
+[include bind/interface.qbk]
+[include bind/implementation.qbk]
+[include bind/acknowledgements.qbk]
diff --git a/doc/bind/acknowledgements.qbk b/doc/bind/acknowledgements.qbk
new file mode 100644
index 0000000..3c87519
--- /dev/null
+++ b/doc/bind/acknowledgements.qbk
@@ -0,0 +1,48 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2008 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)
+ /]
+
+[section:acknowledgements Acknowledgements]
+
+Earlier efforts that have influenced the library design:
+
+* The [@http://staff.cs.utu.fi/BL/ Binder Library] by Jaakko J\u00E4rvi;
+
+* The [@boost:/libs/lambda/index.html Lambda Library] (now part of Boost) by
+ Jaakko J\u00E4rvi and Gary Powell (the successor to the Binder Library);
+
+* [@http://more.sourceforge.net/ Extensions to the STL] by Petter Urkedal.
+
+Doug Gregor suggested that a visitor mechanism would allow `bind` to
+interoperate with a signal/slot library.
+
+John Maddock fixed a MSVC-specific conflict between `bind` and the
+[@boost:/libs/type_traits/index.html type traits library].
+
+Numerous improvements were suggested during the formal review period by Ross
+Smith, Richard Crossley, Jens Maurer, Ed Brey, and others. Review manager was
+Darin Adler.
+
+The precise semantics of `bind` were refined in discussions with Jaakko
+J\u00E4rvi.
+
+Dave Abrahams fixed a MSVC-specific conflict between `bind` and the
+[@boost:/libs/utility/iterator_adaptors.htm iterator adaptors library].
+
+Dave Abrahams modified `bind` and `mem_fn` to support `void` returns on
+deficient compilers.
+
+Mac Murrett contributed the "pascal" support enabled by
+`BOOST_BIND_ENABLE_PASCAL`.
+
+The alternative `bind(type<R>(), f, ...)` syntax was inspired by a discussion
+with Dave Abrahams and Joel de Guzman.
+
+This documentation was ported to Quickbook by Agustín Bergé.
+
+[endsect]
diff --git a/doc/bind/examples.qbk b/doc/bind/examples.qbk
new file mode 100644
index 0000000..7a36d06
--- /dev/null
+++ b/doc/bind/examples.qbk
@@ -0,0 +1,70 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2008 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)
+ /]
+
+[section:examples Examples]
+
+[section Using bind with standard algorithms]
+
+ class image;
+
+ class animation
+ {
+ public:
+ void advance(int ms);
+ bool inactive() const;
+ void render(image & target) const;
+ };
+
+ std::vector<animation> anims;
+
+ template<class C, class P> void erase_if(C & c, P pred)
+ {
+ c.erase(std::remove_if(c.begin(), c.end(), pred), c.end());
+ }
+
+ void update(int ms)
+ {
+ std::for_each(anims.begin(), anims.end(), boost::bind(&animation::advance, _1, ms));
+ erase_if(anims, boost::mem_fn(&animation::inactive));
+ }
+
+ void render(image & target)
+ {
+ std::for_each(anims.begin(), anims.end(), boost::bind(&animation::render, _1, boost::ref(target)));
+ }
+
+[endsect]
+
+[section Using bind with Boost.Function]
+
+ class button
+ {
+ public:
+ ``[@boost:/libs/function/index.html `boost::function`]``<void()> onClick;
+ };
+
+ class player
+ {
+ public:
+ void play();
+ void stop();
+ };
+
+ button playButton, stopButton;
+ player thePlayer;
+
+ void connect()
+ {
+ playButton.onClick = boost::bind(&player::play, &thePlayer);
+ stopButton.onClick = boost::bind(&player::stop, &thePlayer);
+ }
+
+[endsect]
+
+[endsect]
diff --git a/doc/bind/faq.qbk b/doc/bind/faq.qbk
new file mode 100644
index 0000000..8406a19
--- /dev/null
+++ b/doc/bind/faq.qbk
@@ -0,0 +1,99 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2008 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)
+ /]
+
+[section:faq Frequently Asked Questions]
+
+[section Why doesn't this compile?]
+
+See the dedicated [link bind.troubleshooting Troubleshooting section].
+
+[endsect]
+
+[section Why does this compile? It should not.]
+
+Probably because you used the general `bind<R>(f, ...)` syntax, thereby
+instructing `bind` to not "inspect" f to detect arity and return type errors.
+
+[endsect]
+
+[section:Q_forms What is the difference between `bind(f, ...)` and `bind<R>(f, ...)`?]
+
+The first form instructs `bind` to inspect the type of `f` in order to
+determine its arity (number of arguments) and return type. Arity errors will
+be detected at "bind time". This syntax, of course, places some requirements
+on `f`. It must be a function, function pointer, member function pointer, or a
+function object that defines a nested type named `result_type`; in short, it
+must be something that `bind` can recognize.
+
+The second form instructs `bind` to not attempt to recognize the type of `f`.
+It is generally used with function objects that do not, or cannot, expose
+`result_type`, but it can also be used with nonstandard functions. For example,
+the current implementation does not automatically recognize variable-argument
+functions like `printf`, so you will have to use `bind<int>(printf, ...)`.
+Note that an alternative `bind(type<R>(), f, ...)` syntax is supported for
+portability reasons.
+
+Another important factor to consider is that compilers without partial
+template specialization or function template partial ordering support cannot
+handle the first form when `f` is a function object, and in most cases will
+not handle the second form when `f` is a function (pointer) or a member
+function pointer.
+
+[endsect]
+
+[section Does bind work with Windows API functions?]
+
+Yes, if you [link bind.implementation.stdcall `#define
+BOOST_BIND_ENABLE_STDCALL`]. An alternative is to treat the function as a
+[link bind.purpose.with_function_objects generic function object] and use the
+`bind<R>(f, ...)` syntax.
+
+[endsect]
+
+[section Does bind work with COM methods?]
+
+Yes, if you [link bind.implementation.stdcall `#define
+BOOST_MEM_FN_ENABLE_STDCALL`].
+
+[endsect]
+
+[section Does bind work with Mac toolbox functions?]
+
+Yes, if you [link bind.implementation.stdcall `#define
+BOOST_BIND_ENABLE_PASCAL`]. An alternative is to treat the function as a [link
+bind.purpose.with_function_objects generic function object] and use the
+`bind<R>(f, ...)` syntax.
+
+[endsect]
+
+[section Does bind work with extern "C" functions?]
+
+Sometimes. On some platforms, pointers to extern "C" functions are equivalent
+to "ordinary" function pointers, so they work fine. Other platforms treat them
+as different types. A platform-specific implementation of `bind` is expected
+to handle the problem transparently; this implementation does not. As usual,
+the workaround is to treat the function as a [link
+bind.purpose.with_function_objects generic function object] and use the
+`bind<R>(f, ...)` syntax.
+
+[endsect]
+
+[section Why doesn't bind automatically recognize nonstandard functions?]
+
+Non-portable extensions, in general, should default to off to prevent vendor
+lock-in. Had the [link bind.implementation.stdcall appropriate macros] been
+defined automatically, you could have accidentally taken advantage of them
+without realizing that your code is, perhaps, no longer portable. In addition,
+some compilers have the option to make `__stdcall` (`__fastcall`) their
+default calling convention, in which case no separate support would be
+necessary.
+
+[endsect]
+
+[endsect]
diff --git a/doc/bind/implementation.qbk b/doc/bind/implementation.qbk
new file mode 100644
index 0000000..f19023c
--- /dev/null
+++ b/doc/bind/implementation.qbk
@@ -0,0 +1,98 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2008 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)
+ /]
+
+[section:implementation Implementation]
+
+[section Files]
+
+* [@../../../../boost/bind.hpp boost/bind.hpp] (main header)
+* [@../../../../boost/bind/bind_cc.hpp boost/bind/bind_cc.hpp] (used by `bind.hpp`, do not include directly)
+* [@../../../../boost/bind/bind_mf_cc.hpp boost/bind/bind_mf_cc.hpp] (used by `bind.hpp`, do not include directly)
+* [@../../../../boost/bind/bind_template.hpp boost/bind/bind_template.hpp] (used by `bind.hpp`, do not include directly)
+* [@../../../../boost/bind/arg.hpp boost/bind/arg.hpp] (defines the type of the placeholder arguments)
+* [@../../../../boost/bind/placeholders.hpp boost/bind/placeholders.hpp] (defines the `_1`, `_2`, ... `_9` placeholders)
+* [@../../../../boost/bind/apply.hpp boost/bind/apply.hpp] (`apply` helper function object)
+* [@../../../../boost/bind/protect.hpp boost/bind/protect.hpp] (`protect` helper function)
+* [@../../../../boost/bind/make_adaptable.hpp boost/bind/make_adaptable.hpp] (`make_adaptable` helper function)
+* [@../../test/bind_test.cpp libs/bind/test/bind_test.cpp] (test)
+* [@../../bind_as_compose.cpp libs/bind/bind_as_compose.cpp] (function composition example)
+* [@../../bind_visitor.cpp libs/bind/bind_visitor.cpp] (visitor example)
+* [@../../test/bind_stdcall_test.cpp libs/bind/test/bind_stdcall_test.cpp] (test with `__stdcall` functions)
+* [@../../test/bind_stdcall_mf_test.cpp libs/bind/test/bind_stdcall_mf_test.cpp] (test with `__stdcall` member functions)
+* [@../../test/bind_fastcall_test.cpp libs/bind/test/bind_fastcall_test.] (test with `__fastcall` functions)
+* [@../../test/bind_fastcall_mf_test.cpp libs/bind/test/bind_fastcall_mf_test.cpp] (test with `__fastcall` member functions)
+
+[endsect]
+
+[section Dependencies]
+
+* [@boost:/libs/config/config.htm Boost.Config]
+* [@boost:/libs/core/doc/html/core/ref.html boost/ref.hpp]
+* [@boost:/libs/bind/mem_fn.html boost/mem_fn.hpp]
+* [@boost:/boost/type.hpp boost/type.hpp]
+
+[endsect]
+
+[section Number of Arguments]
+
+This implementation supports function objects with up to nine arguments. This
+is an implementation detail, not an inherent limitation of the design.
+
+[endsect]
+
+[section:stdcall `__stdcall`, `__cdecl`, `__fastcall`, and `pascal` Support]
+
+Some platforms allow several types of (member) functions that differ by their
+calling convention (the rules by which the function is invoked: how are
+arguments passed, how is the return value handled, and who cleans up the stack
+ - if any.)
+
+For example, Windows API functions and COM interface member functions use a
+calling convention known as `__stdcall`. Borland VCL components use
+`__fastcall`. Mac toolbox functions use a `pascal` calling convention.
+
+To use `bind` with `__stdcall` functions, `#define` the macro
+`BOOST_BIND_ENABLE_STDCALL` before including `<boost/bind.hpp>`.
+
+To use `bind` with `__stdcall` member functions, `#define` the macro
+`BOOST_MEM_FN_ENABLE_STDCALL` before including `<boost/bind.hpp>`.
+
+To use `bind` with `__fastcall` functions, `#define` the macro
+`BOOST_BIND_ENABLE_FASTCALL` before including `<boost/bind.hpp>`.
+
+To use `bind` with `__fastcall` member functions, `#define` the macro
+`BOOST_MEM_FN_ENABLE_FASTCALL` before including `<boost/bind.hpp>`.
+
+To use `bind` with `pascal` functions, `#define` the macro
+`BOOST_BIND_ENABLE_PASCAL` before including `<boost/bind.hpp>`.
+
+To use `bind` with `__cdecl` member functions, `#define` the macro
+`BOOST_MEM_FN_ENABLE_CDECL` before including `<boost/bind.hpp>`.
+
+[*It is best to define these macros in the project options, via `-D` on the
+command line, or as the first line in the translation unit (.cpp file) where
+`bind` is used.] Not following this rule can lead to obscure errors when a
+header includes `bind.hpp` before the macro has been defined.
+
+/[Note:/ this is a non-portable extension. It is not part of the interface./]/
+
+/[Note:/ Some compilers provide only minimal support for the `__stdcall` keyword./]/
+
+[endsect]
+
+[section `visit_each` support]
+
+Function objects returned by `bind` support the experimental and undocumented,
+as of yet, `visit_each` enumeration interface.
+
+See [@../../bind_visitor.cpp bind_visitor.cpp] for an example.
+
+[endsect]
+
+[endsect]
diff --git a/doc/bind/interface.qbk b/doc/bind/interface.qbk
new file mode 100644
index 0000000..cd83f9c
--- /dev/null
+++ b/doc/bind/interface.qbk
@@ -0,0 +1,216 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2008 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)
+ /]
+
+[section:interface Interface]
+
+[section:synopsys Synopsis]
+
+ namespace boost
+ {
+ // no arguments
+
+ template<class R, class F> ``/unspecified-1/`` ``[link bind_1 `bind`]``(F f);
+
+ template<class F> ``/unspecified-1-1/`` ``[link bind_1_1 `bind`]``(F f);
+
+ template<class R> ``/unspecified-2/`` ``[link bind_2 `bind`]``(R (*f) ());
+
+ // one argument
+
+ template<class R, class F, class A1> ``/unspecified-3/`` ``[link bind_3 `bind`]``(F f, A1 a1);
+
+ template<class F, class A1> ``/unspecified-3-1/`` ``[link bind_3_1 `bind`]``(F f, A1 a1);
+
+ template<class R, class B1, class A1> ``/unspecified-4/`` ``[link bind_4 `bind`]``(R (*f) (B1), A1 a1);
+
+ template<class R, class T, class A1> ``/unspecified-5/`` ``[link bind_5 `bind`]``(R (T::*f) (), A1 a1);
+
+ template<class R, class T, class A1> ``/unspecified-6/`` ``[link bind_6 `bind`]``(R (T::*f) () const, A1 a1);
+
+ template<class R, class T, class A1> ``/unspecified-6-1/`` ``[link bind_6_1 `bind`]``(R T::*f, A1 a1);
+
+ // two arguments
+
+ template<class R, class F, class A1, class A2> ``/unspecified-7/`` ``[link bind_7 `bind`]``(F f, A1 a1, A2 a2);
+
+ template<class F, class A1, class A2> ``/unspecified-7-1/`` ``[link bind_7_1 `bind`]``(F f, A1 a1, A2 a2);
+
+ template<class R, class B1, class B2, class A1, class A2> ``/unspecified-8/`` ``[link bind_8 `bind`]``(R (*f) (B1, B2), A1 a1, A2 a2);
+
+ template<class R, class T, class B1, class A1, class A2> ``/unspecified-9/`` ``[link bind_9 `bind`]``(R (T::*f) (B1), A1 a1, A2 a2);
+
+ template<class R, class T, class B1, class A1, class A2> ``/unspecified-10/`` ``[link bind_10 `bind`]``(R (T::*f) (B1) const, A1 a1, A2 a2);
+
+ // implementation defined number of additional overloads for more arguments
+ }
+
+ namespace
+ {
+ ``/unspecified-placeholder-type-1/`` _1;
+
+ ``/unspecified-placeholder-type-2/`` _2;
+
+ ``/unspecified-placeholder-type-3/`` _3;
+
+ // implementation defined number of additional placeholder definitions
+ }
+
+[endsect]
+
+[section Common requirements]
+
+All /unspecified-N/ types returned by `bind` are /CopyConstructible/. /unspecified-N/`::result_type` is defined as the return type of /unspecified-N/`::operator()`.
+
+All /unspecified-placeholder-N/ types are /CopyConstructible/. Their copy constructors do not throw exceptions.
+
+[endsect]
+
+[section Common definitions]
+
+The function \u03BC`(x, v1, v2, ..., vm)`, where `m` is a nonnegative integer, is
+defined as:
+
+* `x.get()`, when `x` is of type [@boost:/libs/core/doc/html/core/ref.html `boost::reference_wrapper`]`<T>` for some type
+ `T`;
+
+* `vk`, when `x` is (a copy of) the placeholder /_k/ for some positive integer
+ /k/;
+
+* `x(v1, v2, ..., vm)` when `x` is (a copy of) a function object returned by
+ `bind`;
+
+* `x` otherwise.
+
+[endsect]
+
+[section `bind`]
+
+[#bind_1]
+
+ template<class R, class F> ``/unspecified-1/`` bind(F f)
+
+* /Returns:/ A function object \u03BB such that the expression \u03BB`(v1, v2, ..., vm)`
+is equivalent to `f()`, implicitly converted to `R`.
+
+* /Throws:/ Nothing unless the copy constructor of `F` throws an exception.
+
+[#bind_1_1]
+
+ template<class F> ``/unspecified-1-1/`` bind(F f)
+
+* /Effects:/ Equivalent to `bind<typename F::result_type, F>(f)`.
+
+* /Notes:/ Implementations are allowed to infer the return type of `f` via other
+means as an extension, without relying on the `result_type` member.
+
+[#bind_2]
+
+ template<class R> ``/unspecified-2/`` bind(R (*f) ())
+
+* /Returns:/ A function object \u03BB such that the expression \u03BB`(v1, v2, ..., vm)`
+is equivalent to `f()`.
+
+* /Throws:/ Nothing.
+
+[#bind_3]
+
+ template<class R, class F, class A1> ``/unspecified-3/`` bind(F f, A1 a1)
+
+* /Returns:/ A function object \u03BB such that the expression \u03BB`(v1, v2, ..., vm)`
+is equivalent to `f(`\u03BC`(a1, v1, v2, ..., vm))`, implicitly converted to `R`.
+
+* /Throws:/ Nothing unless the copy constructors of `F` or `A1` throw an exception.
+
+[#bind_3_1]
+
+ template<class F, class A1> ``/unspecified-3-1/`` bind(F f, A1 a1)
+
+* /Effects:/ Equivalent to `bind<typename F::result_type, F, A1>(f, a1)`.
+
+* /Notes:/ Implementations are allowed to infer the return type of `f` via other
+means as an extension, without relying on the `result_type` member.
+
+[#bind_4]
+
+ template<class R, class B1, class A1> ``/unspecified-4/`` bind(R (*f) (B1), A1 a1)
+
+* /Returns:/ A function object \u03BB such that the expression \u03BB`(v1, v2, ..., vm)`
+is equivalent to `f(`\u03BC`(a1, v1, v2, ..., vm))`.
+
+* /Throws:/ Nothing unless the copy constructor of `A1` throws an exception.
+
+[#bind_5]
+
+ template<class R, class T, class A1> ``/unspecified-5/`` bind(R (T::*f) (), A1 a1)
+
+* /Effects:/ Equivalent to `bind<R>(`[@boost:/libs/bind/mem_fn.html `boost::mem_fn`]`(f), a1)`.
+
+[#bind_6]
+
+ template<class R, class T, class A1> ``/unspecified-6/`` bind(R (T::*f) () const, A1 a1)
+
+* /Effects:/ Equivalent to `bind<R>(`[@boost:/libs/bind/mem_fn.html `boost::mem_fn`]`(f), a1)`.
+
+[#bind_6_1]
+
+ template<class R, class T, class A1> ``/unspecified-6-1/`` bind(R T::*f, A1 a1)
+
+* /Effects:/ Equivalent to `bind<R>(`[@boost:/libs/bind/mem_fn.html `boost::mem_fn`]`(f), a1)`.
+
+[#bind_7]
+
+ template<class R, class F, class A1, class A2> ``/unspecified-7/`` bind(F f, A1 a1, A2 a2)
+
+* /Returns:/ A function object \u03BB such that the expression \u03BB`(v1, v2, ..., vm)`
+is equivalent to `f(`\u03BC`(a1, v1, v2, ..., vm), `\u03BC`(a2, v1, v2, ..., vm))`,
+implicitly converted to `R`.
+
+* /Throws:/ Nothing unless the copy constructors of `F`, `A1` or `A2` throw an
+exception.
+
+[#bind_7_1]
+
+ template<class F, class A1, class A2> ``/unspecified-7-1/`` bind(F f, A1 a1, A2 a2)
+
+* /Effects:/ Equivalent to `bind<typename F::result_type, F, A1, A2>(f, a1, a2)`.
+
+* /Notes:/ Implementations are allowed to infer the return type of `f` via other
+means as an extension, without relying on the `result_type` member.
+
+[#bind_8]
+
+ template<class R, class B1, class B2, class A1, class A2> ``/unspecified-8/`` bind(R (*f) (B1, B2), A1 a1, A2 a2)
+
+* /Returns:/ A function object \u03BB such that the expression \u03BB`(v1, v2, ..., vm)`
+is equivalent to `f(`\u03BC`(a1, v1, v2, ..., vm), `\u03BC`(a2, v1, v2, ..., vm))`.
+
+* /Throws:/ Nothing unless the copy constructors of `A1` or `A2` throw an exception.
+
+[#bind_9]
+
+ template<class R, class T, class B1, class A1, class A2> ``/unspecified-9/`` bind(R (T::*f) (B1), A1 a1, A2 a2)
+
+* /Effects:/ Equivalent to `bind<R>(`[@boost:/libs/bind/mem_fn.html `boost::mem_fn`]`(f), a1, a2)`.
+
+[#bind_10]
+
+ template<class R, class T, class B1, class A1, class A2> ``/unspecified-10/`` bind(R (T::*f) (B1) const, A1 a1, A2 a2)
+
+* /Effects:/ Equivalent to `bind<R>(`[@boost:/libs/bind/mem_fn.html `boost::mem_fn`]`(f), a1, a2)`.
+
+[endsect]
+
+[section Additional overloads]
+
+Implementations are allowed to provide additional `bind` overloads in order to
+support more arguments or different function pointer variations.
+
+[endsect]
+
+[endsect]
diff --git a/doc/bind/limitations.qbk b/doc/bind/limitations.qbk
new file mode 100644
index 0000000..a3b2305
--- /dev/null
+++ b/doc/bind/limitations.qbk
@@ -0,0 +1,37 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2008 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)
+ /]
+
+[section:limitations Limitations]
+
+As a general rule, the function objects generated by `bind` take their
+arguments by reference and cannot, therefore, accept non-const temporaries or
+literal constants. This is an inherent limitation of the C++ language in its
+current (2003) incarnation, known as the [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm forwarding problem].
+(It will be fixed in the next standard, usually called C++0x.)
+
+The library uses signatures of the form
+
+ template<class T> void f(T & t);
+
+to accept arguments of arbitrary types and pass them on unmodified. As noted,
+this does not work with non-const r-values.
+
+On compilers that support partial ordering of function templates, a possible
+solution is to add an overload:
+
+ template<class T> void f(T & t);
+ template<class T> void f(T const & t);
+
+Unfortunately, this requires providing 512 overloads for nine arguments, which
+is impractical. The library chooses a small subset: for up to two arguments,
+it provides the const overloads in full, for arities of three and more it
+provides a single additional overload with all of the arguments taken by const
+reference. This covers a reasonable portion of the use cases.
+
+[endsect]
diff --git a/doc/bind/purpose.qbk b/doc/bind/purpose.qbk
new file mode 100644
index 0000000..06422a2
--- /dev/null
+++ b/doc/bind/purpose.qbk
@@ -0,0 +1,273 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2008 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)
+ /]
+
+[section:purpose Purpose]
+
+`boost::bind` is a generalization of the standard functions `std::bind1st` and
+`std::bind2nd`. It supports arbitrary function objects, functions, function
+pointers, and member function pointers, and is able to bind any argument to a
+specific value or route input arguments into arbitrary positions. `bind` does
+not place any requirements on the function object; in particular, it does not
+need the `result_type`, `first_argument_type` and `second_argument_type`
+standard typedefs.
+
+[section Using bind with functions and function pointers]
+
+Given these definitions:
+
+ int f(int a, int b)
+ {
+ return a + b;
+ }
+
+ int g(int a, int b, int c)
+ {
+ return a + b + c;
+ }
+
+`bind(f, 1, 2)` will produce a "nullary" function object that takes no
+arguments and returns `f(1, 2)`. Similarly, `bind(g, 1, 2, 3)()` is equivalent
+ `to g(1, 2, 3)`.
+
+It is possible to selectively bind only some of the arguments.
+`bind(f, _1, 5)(x)` is equivalent to `f(x, 5)`; here `_1` is a /placeholder/
+argument that means "substitute with the first input argument."
+
+For comparison, here is the same operation expressed with the standard library
+primitives:
+
+ std::bind2nd(std::ptr_fun(f), 5)(x);
+
+`bind` covers the functionality of `std::bind1st` as well:
+
+ std::bind1st(std::ptr_fun(f), 5)(x); // f(5, x)
+ bind(f, 5, _1)(x); // f(5, x)
+
+`bind` can handle functions with more than two arguments, and its argument
+substitution mechanism is more general:
+
+ bind(f, _2, _1)(x, y); // f(y, x)
+ bind(g, _1, 9, _1)(x); // g(x, 9, x)
+ bind(g, _3, _3, _3)(x, y, z); // g(z, z, z)
+ bind(g, _1, _1, _1)(x, y, z); // g(x, x, x)
+
+Note that, in the last example, the function object produced by
+`bind(g, _1, _1, _1)` does not contain references to any arguments beyond the
+first, but it can still be used with more than one argument. Any extra
+arguments are silently ignored, just like the first and the second argument
+are ignored in the third example.
+
+The arguments that `bind` takes are copied and held internally by the returned
+function object. For example, in the following code:
+
+ int i = 5;
+ bind(f, i, _1);
+
+a copy of the value of `i` is stored into the function object.
+[@boost:/libs/core/doc/html/core/ref.html `boost::ref`] and
+[@boost:/libs/core/doc/html/core/ref.html `boost::cref`] can be used to make the function
+object store a reference to an object, rather than a copy:
+
+ int i = 5;
+ bind(f, ref(i), _1);
+ bind(f, cref(i), _1);
+
+[endsect]
+
+[section:with_function_objects Using bind with function objects]
+
+`bind` is not limited to functions; it accepts arbitrary function objects. In
+the general case, the return type of the generated function object's
+`operator()` has to be specified explicitly (without a `typeof` operator the
+return type cannot be inferred):
+
+ struct F
+ {
+ int operator()(int a, int b) { return a - b; }
+ bool operator()(long a, long b) { return a == b; }
+ };
+
+ F f;
+ int x = 104;
+ bind<int>(f, _1, _1)(x); // f(x, x), i.e. zero
+
+Some compilers have trouble with the `bind<R>(f, ...)` syntax. For portability
+reasons, an alternative way to express the above is supported:
+
+ boost::bind(boost::type<int>(), f, _1, _1)(x);
+
+Note, however, that the alternative syntax is provided only as a workaround.
+It is not part of the interface.
+
+When the function object exposes a nested type named `result_type`, the explicit
+return type can be omitted:
+
+ int x = 8;
+ bind(std::less<int>(), _1, 9)(x); // x < 9
+
+/[Note:/ the ability to omit the return type is not available on all compilers./]/
+
+By default, `bind` makes a copy of the provided function object. `boost::ref`
+and `boost::cref` can be used to make it store a reference to the function
+object, rather than a copy. This can be useful when the function object is
+non-copyable, expensive to copy, or contains state; of course, in this case
+the programmer is expected to ensure that the function object is not destroyed
+while it's still being used.
+
+ struct F2
+ {
+ int s;
+
+ typedef void result_type;
+ void operator()(int x) { s += x; }
+ };
+
+ F2 f2 = { 0 };
+ int a[] = { 1, 2, 3 };
+
+ std::for_each(a, a+3, bind(ref(f2), _1));
+
+ assert(f2.s == 6);
+
+[endsect]
+
+[section Using bind with pointers to members]
+
+Pointers to member functions and pointers to data members are not function
+objects, because they do not support `operator()`. For convenience, `bind`
+accepts member pointers as its first argument, and the behavior is as if
+[@boost:/libs/bind/mem_fn.html `boost::mem_fn`] has been used to convert the
+member pointer into a function object. In other words, the expression
+
+ bind(&X::f, args)
+
+is equivalent to
+
+ bind<R>(``[@boost:/libs/bind/mem_fn.html `mem_fn`]``(&X::f), args)
+
+where `R` is the return type of `X::f` (for member functions) or the type of
+the member (for data members.)
+
+/[Note:/ `mem_fn` creates function objects that are able to accept a pointer,
+a reference, or a smart pointer to an object as its first argument; for
+additional information, see the `mem_fn`
+[@boost:/libs/bind/mem_fn.html documentation]./]/
+
+Example:
+
+ struct X
+ {
+ bool f(int a);
+ };
+
+ X x;
+ shared_ptr<X> p(new X);
+ int i = 5;
+
+ bind(&X::f, ref(x), _1)(i); // x.f(i)
+ bind(&X::f, &x, _1)(i); // (&x)->f(i)
+ bind(&X::f, x, _1)(i); // (internal copy of x).f(i)
+ bind(&X::f, p, _1)(i); // (internal copy of p)->f(i)
+
+The last two examples are interesting in that they produce "self-contained"
+function objects. `bind(&X::f, x, _1)` stores a copy of `x`.
+`bind(&X::f, p, _1)` stores a copy of `p`, and since `p` is a
+[@boost:/libs/smart_ptr/doc/html/smart_ptr.html#shared_ptr `boost::shared_ptr`], the function
+object retains a reference to its instance of `X` and will remain valid even
+when `p` goes out of scope or is `reset()`.
+
+[endsect]
+
+[section Using nested binds for function composition]
+
+Some of the arguments passed to `bind` may be nested /bind expressions/
+themselves:
+
+ bind(f, bind(g, _1))(x); // f(g(x))
+
+The inner /bind expressions/ are evaluated, in unspecified order, before the
+outer `bind` when the function object is called; the results of the evaluation
+are then substituted in their place when the outer `bind` is evaluated. In the
+example above, when the function object is called with the argument list `(x)`,
+`bind(g, _1)(x)` is evaluated first, yielding `g(x)`, and then
+`bind(f, g(x))(x)` is evaluated, yielding the final result `f(g(x))`.
+
+This feature of `bind` can be used to perform function composition. See
+[@../../bind_as_compose.cpp bind_as_compose.cpp] for an example that
+demonstrates how to use `bind` to achieve similar functionality to
+[@http://www.boost.org/doc/libs/1_31_0/libs/compose/index.htm Boost.Compose].
+
+Note that the first argument - the bound function object - is not evaluated,
+even when it's a function object that is produced by `bind` or a /placeholder/
+argument, so the example below does not work as expected:
+
+ typedef void (*pf)(int);
+
+ std::vector<pf> v;
+ std::for_each(v.begin(), v.end(), bind(_1, 5));
+
+The desired effect can be achieved via a helper function object `apply` that
+applies its first argument, as a function object, to the rest of its argument
+list. For convenience, an implementation of `apply` is provided in the
+[@../../../../boost/bind/apply.hpp apply.hpp] header file. Here is how the
+modified version of the previous example looks like:
+
+ typedef void (*pf)(int);
+
+ std::vector<pf> v;
+ std::for_each(v.begin(), v.end(), bind(apply<void>(), _1, 5));
+
+Although the first argument is, by default, not evaluated, all other arguments
+are. Sometimes it is necessary not to evaluate arguments subsequent to the
+first, even when they are nested /bind subexpressions/. This can be achieved
+with the help of another function object, `protect`, that masks the type so
+that `bind` does not recognize and evaluate it. When called, protect simply
+forwards the argument list to the other function object unmodified.
+
+The header [@../../../../boost/bind/protect.hpp protect.hpp] contains an
+implementation of `protect`. To `protect` a bind function object from
+evaluation, use `protect(bind(f, ...))`.
+
+[endsect]
+
+[section Overloaded operators (new in Boost 1.33)]
+
+For convenience, the function objects produced by `bind` overload the logical
+not operator `!` and the relational and logical operators `==, !=, <, <=, >,
+>=, &&, ||`.
+
+`!bind(f, ...)` is equivalent to `bind(logical_not(), bind(f, ...))`, where
+`logical_not` is a function object that takes one argument `x` and returns
+`!x`.
+
+`bind(f, ...) op x`, where _op_ is a relational or logical operator, is
+equivalent to `bind(relation(), bind(f, ...), x)`, where `relation` is a
+function object that takes two arguments `a` and `b` and returns `a op b`.
+
+What this means in practice is that you can conveniently negate the result of
+`bind`:
+
+ std::remove_if(first, last, !bind(&X::visible, _1)); // remove invisible objects
+
+and compare the result of `bind` against a value:
+
+ std::find_if(first, last, bind(&X::name, _1) == "Peter");
+ std::find_if(first, last, bind(&X::name, _1) == "Peter" || bind(&X::name, _1) == "Paul");
+
+against a /placeholder/:
+
+ bind(&X::name, _1) == _2
+
+or against another /bind expression/:
+
+ std::sort(first, last, bind(&X::name, _1) < bind(&X::name, _2)); // sort by name
+
+[endsect]
+
+[endsect]
diff --git a/doc/bind/troubleshooting.qbk b/doc/bind/troubleshooting.qbk
new file mode 100644
index 0000000..21a7b37
--- /dev/null
+++ b/doc/bind/troubleshooting.qbk
@@ -0,0 +1,268 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2008 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)
+ /]
+
+[section:troubleshooting Troubleshooting]
+
+[section Incorrect number of arguments]
+
+In a `bind(f, a1, a2, ..., aN)` expression, the function object `f` must be
+able to take exactly N arguments. This error is normally detected at "bind
+time"; in other words, the compilation error is reported on the line where
+`bind()` is invoked:
+
+ int f(int, int);
+
+ int main()
+ {
+ boost::bind(f, 1); // error, f takes two arguments
+ boost::bind(f, 1, 2); // OK
+ }
+
+A common variation of this error is to forget that member functions have an
+implicit "this" argument:
+
+ struct X
+ {
+ int f(int);
+ }
+
+ int main()
+ {
+ boost::bind(&X::f, 1); // error, X::f takes two arguments
+ boost::bind(&X::f, _1, 1); // OK
+ }
+
+[endsect]
+
+[section The function object cannot be called with the specified arguments]
+
+As in normal function calls, the function object that is bound must be
+compatible with the argument list. The incompatibility will usually be
+detected by the compiler at "call time" and the result is typically an error
+in `bind.hpp` on a line that looks like:
+
+ return f(a[a1_], a[a2_]);
+
+An example of this kind of error:
+
+ int f(int);
+
+ int main()
+ {
+ boost::bind(f, "incompatible"); // OK so far, no call
+ boost::bind(f, "incompatible")(); // error, "incompatible" is not an int
+ boost::bind(f, _1); // OK
+ boost::bind(f, _1)("incompatible"); // error, "incompatible" is not an int
+ }
+
+[endsect]
+
+[section Accessing an argument that does not exist]
+
+The placeholder `_N` selects the argument at position `N` from the argument
+list passed at "call time." Naturally, it is an error to attempt to access
+beyond the end of this list:
+
+ int f(int);
+
+ int main()
+ {
+ boost::bind(f, _1); // OK
+ boost::bind(f, _1)(); // error, there is no argument number 1
+ }
+
+The error is usually reported in `bind.hpp`, at a line similar to:
+
+ return f(a[a1_]);
+
+When emulating `std::bind1st(f, a)`, a common mistake of this category is to
+type `bind(f, a, _2)` instead of the correct `bind(f, a, _1)`.
+
+[endsect]
+
+[section Inappropriate use of `bind(f, ...)`]
+
+The `bind(f, a1, a2, ..., aN)` [link bind.faq.Q_forms form] causes automatic
+recognition of the type of `f`. It will not work with arbitrary function
+objects; `f` must be a function or a member function pointer.
+
+It is possible to use this form with function objects that define
+`result_type`, but only on compilers that support partial specialization and
+partial ordering. In particular, MSVC up to version 7.0 does not support this
+syntax for function objects.
+
+[endsect]
+
+[section Inappropriate use of `bind<R>(f, ...)`]
+
+The `bind<R>(f, a1, a2, ..., aN)` [link bind.faq.Q_forms form] supports
+arbitrary function objects.
+
+It is possible (but not recommended) to use this form with functions or member
+function pointers, but only on compilers that support partial ordering. In
+particular, MSVC up to version 7.0 does not fully support this syntax for
+functions and member function pointers.
+
+[endsect]
+
+[section Binding a nonstandard function]
+
+By default, the `bind(f, a1, a2, ..., aN)` [link bind.faq.Q_forms form]
+recognizes "ordinary" C++ functions and function pointers. [link
+bind.implementation.stdcall Functions that use a different calling convention],
+or variable-argument functions such as `std::printf`, do not work. The general
+`bind<R>(f, a1, a2, ..., aN)` [link bind.faq.Q_forms form] works with
+nonstandard functions.
+
+On some platforms, extern "C" functions, like `std::strcmp`, are not
+recognized by the short form of `bind`.
+
+See also [link bind.implementation.stdcall `__stdcall` and `pascal` Support].
+
+[endsect]
+
+[section Binding an overloaded function]
+
+An attempt to bind an overloaded function usually results in an error, as
+there is no way to tell which overload was meant to be bound. This is a common
+problem with member functions with two overloads, const and non-const, as in
+this simplified example:
+
+ struct X
+ {
+ int& get();
+ int const& get() const;
+ };
+
+ int main()
+ {
+ boost::bind(&X::get, _1);
+ }
+
+The ambiguity can be resolved manually by casting the (member) function
+pointer to the desired type:
+
+ int main()
+ {
+ boost::bind(static_cast< int const& (X::*) () const >(&X::get), _1);
+ }
+
+Another, arguably more readable, alternative is to introduce a temporary
+variable:
+
+ int main()
+ {
+ int const& (X::*get) () const = &X::get;
+ boost::bind(get, _1);
+ }
+
+[endsect]
+
+[section Modeling STL function object concepts]
+
+The function objects that are produced by `bind` do not model the STL
+[@http://www.sgi.com/tech/stl/UnaryFunction.html /Unary Function/] or
+[@http://www.sgi.com/tech/stl/BinaryFunction.html /Binary Function/] concepts,
+even when the function objects are unary or binary operations, because the
+function object types are missing public typedefs `result_type` and
+`argument_type` or `first_argument_type` and `second_argument_type`. In cases
+where these typedefs are desirable, however, the utility function
+`make_adaptable` can be used to adapt unary and binary function objects to
+these concepts. This allows unary and binary function objects resulting from
+`bind` to be combined with STL templates such as
+[@http://en.cppreference.com/w/cpp/utility/functional/unary_negate `std::unary_negate`]
+and [@http://en.cppreference.com/w/cpp/utility/functional/binary_negate `std::binary_negate`].
+
+The `make_adaptable` function is defined in [@../../../../boost/bind/make_adaptable.hpp
+`<boost/bind/make_adaptable.hpp>`], which must be included explicitly in
+addition to [@../../../../boost/bind.hpp `<boost/bind.hpp>`]:
+
+ #include <boost/bind/make_adaptable.hpp>
+
+ template <class R, class F> ``/unspecified-type/`` make_adaptable(F f);
+
+ template<class R, class A1, class F> ``/unspecified-unary-functional-type/`` make_adaptable(F f);
+
+ template<class R, class A1, class A2, class F> ``/unspecified-binary-functional-type/`` make_adaptable(F f);
+
+ template<class R, class A1, class A2, class A3, class F> ``/unspecified-ternary-functional-type/`` make_adaptable(F f);
+
+ template<class R, class A1, class A2, class A3, class A4, class F> ``/unspecified-4-ary-functional-type/`` make_adaptable(F f);
+
+This example shows how to use `make_adaptable` to make a predicate for "is not a space":
+
+ typedef char char_t;
+ std::locale loc("");
+ const std::ctype<char_t>& ct = std::use_facet<std::ctype<char_t> >(loc);
+
+ auto isntspace = std::not1(boost::make_adaptable<bool, char_t>(boost::bind(&std::ctype<char_t>::is, &ct, std::ctype_base::space, _1)));
+
+In this example, `bind` creates the "is a space" (unary) predicate. It is then
+passed to `make_adaptable` so that a function object modeling the /Unary
+Function/ concept can be created, serving as the argument to
+[@http://en.cppreference.com/w/cpp/utility/functional/not1 `std::not1`].
+
+[endsect]
+
+[section `const` in signatures]
+
+Some compilers, including MSVC 6.0 and Borland C++ 5.5.1, have problems with
+the top-level `const` in function signatures:
+
+ int f(int const);
+
+ int main()
+ {
+ boost::bind(f, 1); // error
+ }
+
+Workaround: remove the `const` qualifier from the argument.
+
+[endsect]
+
+[section MSVC specific: `using boost::bind;`]
+
+On MSVC (up to version 7.0), when `boostbind` is brought into scope with an
+using declaration:
+
+ using boost::bind;
+
+the syntax `bind<R>(f, ...)` does not work. Workaround: either use the
+qualified name, `boost::bind`, or use an using directive instead:
+
+ using namespace boost;
+
+[endsect]
+
+[section MSVC specific: class templates shadow function templates]
+
+On MSVC (up to version 7.0), a nested class template named `bind` will shadow
+the function template `boost::bind`, breaking the `bind<R>(f, ...)`syntax.
+Unfortunately, some libraries contain nested class templates named `bind`
+(ironically, such code is often an MSVC specific workaround.)
+
+The workaround is to use the alternative `bind(type<R>(), f, ...)` syntax.
+
+[endsect]
+
+[section MSVC specific: `...` in signatures treated as type]
+
+MSVC (up to version 7.0) treats the ellipsis in a variable argument function
+(such as `std::printf`) as a type. Therefore, it will accept the (incorrect in
+the current implementation) form:
+
+ bind(printf, "%s\n", _1);
+
+and will reject the correct version:
+
+ bind<int>(printf, "%s\n", _1);
+
+[endsect]
+
+[endsect]
diff --git a/doc/html/bind.html b/doc/html/bind.html
new file mode 100644
index 0000000..5f35c5d
--- /dev/null
+++ b/doc/html/bind.html
@@ -0,0 +1,1552 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Chapter 1. Boost.Bind</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="bind.html" title="Chapter 1. Boost.Bind">
+</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"></div>
+<div class="chapter">
+<div class="titlepage"><div>
+<div><h2 class="title">
+<a name="bind"></a>Chapter 1. Boost.Bind</h2></div>
+<div><p class="copyright">Copyright © 2001, 2002 Peter Dimov and Multi Media Ltd.</p></div>
+<div><p class="copyright">Copyright © 2003-2008 Peter Dimov</p></div>
+<div><div class="legalnotice">
+<a name="bind.legal"></a><p>
+ Distributed under the <a href="http://boost.org/LICENSE_1_0.txt" target="_top">Boost
+ Software License, Version 1.0</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="bind.html#bind.purpose">Purpose</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="bind.html#bind.purpose.using_bind_with_functions_and_fu">Using
+ bind with functions and function pointers</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.purpose.with_function_objects">Using bind with function
+ objects</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.purpose.using_bind_with_pointers_to_memb">Using
+ bind with pointers to members</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.purpose.using_nested_binds_for_function_">Using
+ nested binds for function composition</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.purpose.overloaded_operators_new_in_boos">Overloaded
+ operators (new in Boost 1.33)</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="bind.html#bind.examples">Examples</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="bind.html#bind.examples.using_bind_with_standard_algorit">Using
+ bind with standard algorithms</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.examples.using_bind_with_boost_function">Using bind
+ with Boost.Function</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="bind.html#bind.limitations">Limitations</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.faq">Frequently Asked Questions</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="bind.html#bind.faq.why_doesn_t_this_compile">Why doesn't this compile?</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.faq.why_does_this_compile_it_should_">Why does this
+ compile? It should not.</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.faq.Q_forms">What is the difference between <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code> and
+ <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code>?</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.faq.does_bind_work_with_windows_api_">Does bind
+ work with Windows API functions?</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.faq.does_bind_work_with_com_methods">Does bind work
+ with COM methods?</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.faq.does_bind_work_with_mac_toolbox_">Does bind
+ work with Mac toolbox functions?</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.faq.does_bind_work_with_extern_c_fun">Does bind
+ work with extern "C" functions?</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.faq.why_doesn_t_bind_automatically_r">Why doesn't
+ bind automatically recognize nonstandard functions?</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting">Troubleshooting</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting.incorrect_number_of_arguments">Incorrect
+ number of arguments</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting.the_function_object_cannot_be_ca">The
+ function object cannot be called with the specified arguments</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting.accessing_an_argument_that_does_">Accessing
+ an argument that does not exist</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting.inappropriate_use_of_bind_f">Inappropriate
+ use of <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code></a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting.inappropriate_use_of_bind_r_f">Inappropriate
+ use of <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code></a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting.binding_a_nonstandard_function">Binding
+ a nonstandard function</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting.binding_an_overloaded_function">Binding
+ an overloaded function</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting.modeling_stl_function_object_con">Modeling
+ STL function object concepts</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting.const_in_signatures"><code class="computeroutput"><span class="keyword">const</span></code> in signatures</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting.msvc_specific_using_boost_bind">MSVC
+ specific: <code class="computeroutput"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">;</span></code></a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting.msvc_specific_class_templates_sh">MSVC
+ specific: class templates shadow function templates</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.troubleshooting.msvc_specific_in_signatures_trea">MSVC
+ specific: <code class="computeroutput"><span class="special">...</span></code> in signatures treated
+ as type</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="bind.html#bind.interface">Interface</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="bind.html#bind.interface.synopsys">Synopsis</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.interface.common_requirements">Common requirements</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.interface.common_definitions">Common definitions</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.interface.bind"><code class="computeroutput"><span class="identifier">bind</span></code></a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.interface.additional_overloads">Additional overloads</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="bind.html#bind.implementation">Implementation</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="bind.html#bind.implementation.files">Files</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.implementation.dependencies">Dependencies</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.implementation.number_of_arguments">Number of Arguments</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.implementation.stdcall"><code class="computeroutput"><span class="identifier">__stdcall</span></code>,
+ <code class="computeroutput"><span class="identifier">__cdecl</span></code>, <code class="computeroutput"><span class="identifier">__fastcall</span></code>,
+ and <code class="computeroutput"><span class="identifier">pascal</span></code> Support</a></span></dt>
+<dt><span class="section"><a href="bind.html#bind.implementation.visit_each_support"><code class="computeroutput"><span class="identifier">visit_each</span></code> support</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="bind.html#bind.acknowledgements">Acknowledgements</a></span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="bind.purpose"></a><a class="link" href="bind.html#bind.purpose" title="Purpose">Purpose</a>
+</h2></div></div></div>
+<p>
+ <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span></code> is a generalization of the standard
+ functions <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bind1st</span></code> and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bind2nd</span></code>.
+ It supports arbitrary function objects, functions, function pointers, and member
+ function pointers, and is able to bind any argument to a specific value or
+ route input arguments into arbitrary positions. <code class="computeroutput"><span class="identifier">bind</span></code>
+ does not place any requirements on the function object; in particular, it does
+ not need the <code class="computeroutput"><span class="identifier">result_type</span></code>,
+ <code class="computeroutput"><span class="identifier">first_argument_type</span></code> and <code class="computeroutput"><span class="identifier">second_argument_type</span></code> standard typedefs.
+ </p>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.purpose.using_bind_with_functions_and_fu"></a><a class="link" href="bind.html#bind.purpose.using_bind_with_functions_and_fu" title="Using bind with functions and function pointers">Using
+ bind with functions and function pointers</a>
+</h3></div></div></div>
+<p>
+ Given these definitions:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">b</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">a</span> <span class="special">+</span> <span class="identifier">b</span><span class="special">;</span>
+<span class="special">}</span>
+
+<span class="keyword">int</span> <span class="identifier">g</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">b</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">c</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">a</span> <span class="special">+</span> <span class="identifier">b</span> <span class="special">+</span> <span class="identifier">c</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">)</span></code>
+ will produce a "nullary" function object that takes no arguments
+ and returns <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">)</span></code>. Similarly, <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">g</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="number">3</span><span class="special">)()</span></code> is equivalent <code class="computeroutput"><span class="identifier">to</span>
+ <span class="identifier">g</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="number">3</span><span class="special">)</span></code>.
+ </p>
+<p>
+ It is possible to selectively bind only some of the arguments. <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">,</span>
+ <span class="number">5</span><span class="special">)(</span><span class="identifier">x</span><span class="special">)</span></code> is equivalent
+ to <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span> <span class="number">5</span><span class="special">)</span></code>; here <code class="computeroutput"><span class="identifier">_1</span></code>
+ is a <span class="emphasis"><em>placeholder</em></span> argument that means "substitute
+ with the first input argument."
+ </p>
+<p>
+ For comparison, here is the same operation expressed with the standard library
+ primitives:
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bind2nd</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ptr_fun</span><span class="special">(</span><span class="identifier">f</span><span class="special">),</span> <span class="number">5</span><span class="special">)(</span><span class="identifier">x</span><span class="special">);</span>
+</pre>
+<p>
+ <code class="computeroutput"><span class="identifier">bind</span></code> covers the functionality
+ of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bind1st</span></code> as well:
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bind1st</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ptr_fun</span><span class="special">(</span><span class="identifier">f</span><span class="special">),</span> <span class="number">5</span><span class="special">)(</span><span class="identifier">x</span><span class="special">);</span> <span class="comment">// f(5, x)</span>
+<span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="number">5</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)(</span><span class="identifier">x</span><span class="special">);</span> <span class="comment">// f(5, x)</span>
+</pre>
+<p>
+ <code class="computeroutput"><span class="identifier">bind</span></code> can handle functions
+ with more than two arguments, and its argument substitution mechanism is
+ more general:
+ </p>
+<pre class="programlisting"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">_2</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)(</span><span class="identifier">x</span><span class="special">,</span> <span class="identifier">y</span><span class="special">);</span> <span class="comment">// f(y, x)</span>
+<span class="identifier">bind</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">,</span> <span class="number">9</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)(</span><span class="identifier">x</span><span class="special">);</span> <span class="comment">// g(x, 9, x)</span>
+<span class="identifier">bind</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">_3</span><span class="special">,</span> <span class="identifier">_3</span><span class="special">,</span> <span class="identifier">_3</span><span class="special">)(</span><span class="identifier">x</span><span class="special">,</span> <span class="identifier">y</span><span class="special">,</span> <span class="identifier">z</span><span class="special">);</span> <span class="comment">// g(z, z, z)</span>
+<span class="identifier">bind</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)(</span><span class="identifier">x</span><span class="special">,</span> <span class="identifier">y</span><span class="special">,</span> <span class="identifier">z</span><span class="special">);</span> <span class="comment">// g(x, x, x)</span>
+</pre>
+<p>
+ Note that, in the last example, the function object produced by <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">,</span>
+ <span class="identifier">_1</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)</span></code> does
+ not contain references to any arguments beyond the first, but it can still
+ be used with more than one argument. Any extra arguments are silently ignored,
+ just like the first and the second argument are ignored in the third example.
+ </p>
+<p>
+ The arguments that <code class="computeroutput"><span class="identifier">bind</span></code> takes
+ are copied and held internally by the returned function object. For example,
+ in the following code:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">5</span><span class="special">;</span>
+<span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">);</span>
+</pre>
+<p>
+ a copy of the value of <code class="computeroutput"><span class="identifier">i</span></code>
+ is stored into the function object. <a href="../../../../libs/core/doc/html/core/ref.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span></code></a> and <a href="../../../../libs/core/doc/html/core/ref.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">cref</span></code></a> can be used to make the function
+ object store a reference to an object, rather than a copy:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">5</span><span class="special">;</span>
+<span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">ref</span><span class="special">(</span><span class="identifier">i</span><span class="special">),</span> <span class="identifier">_1</span><span class="special">);</span>
+<span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">cref</span><span class="special">(</span><span class="identifier">i</span><span class="special">),</span> <span class="identifier">_1</span><span class="special">);</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.purpose.with_function_objects"></a><a class="link" href="bind.html#bind.purpose.with_function_objects" title="Using bind with function objects">Using bind with function
+ objects</a>
+</h3></div></div></div>
+<p>
+ <code class="computeroutput"><span class="identifier">bind</span></code> is not limited to functions;
+ it accepts arbitrary function objects. In the general case, the return type
+ of the generated function object's <code class="computeroutput"><span class="keyword">operator</span><span class="special">()</span></code> has to be specified explicitly (without
+ a <code class="computeroutput"><span class="identifier">typeof</span></code> operator the return
+ type cannot be inferred):
+ </p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">F</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">int</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">a</span> <span class="special">-</span> <span class="identifier">b</span><span class="special">;</span> <span class="special">}</span>
+ <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">long</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">long</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">a</span> <span class="special">==</span> <span class="identifier">b</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="identifier">F</span> <span class="identifier">f</span><span class="special">;</span>
+<span class="keyword">int</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">104</span><span class="special">;</span>
+<span class="identifier">bind</span><span class="special"><</span><span class="keyword">int</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)(</span><span class="identifier">x</span><span class="special">);</span> <span class="comment">// f(x, x), i.e. zero</span>
+</pre>
+<p>
+ Some compilers have trouble with the <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code>
+ syntax. For portability reasons, an alternative way to express the above
+ is supported:
+ </p>
+<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">type</span><span class="special"><</span><span class="keyword">int</span><span class="special">>(),</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)(</span><span class="identifier">x</span><span class="special">);</span>
+</pre>
+<p>
+ Note, however, that the alternative syntax is provided only as a workaround.
+ It is not part of the interface.
+ </p>
+<p>
+ When the function object exposes a nested type named <code class="computeroutput"><span class="identifier">result_type</span></code>,
+ the explicit return type can be omitted:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">8</span><span class="special">;</span>
+<span class="identifier">bind</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span><span class="special"><</span><span class="keyword">int</span><span class="special">>(),</span> <span class="identifier">_1</span><span class="special">,</span> <span class="number">9</span><span class="special">)(</span><span class="identifier">x</span><span class="special">);</span> <span class="comment">// x < 9</span>
+</pre>
+<p>
+ <span class="emphasis"><em>[Note:</em></span> the ability to omit the return type is not available
+ on all compilers.<span class="emphasis"><em>]</em></span>
+ </p>
+<p>
+ By default, <code class="computeroutput"><span class="identifier">bind</span></code> makes a
+ copy of the provided function object. <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span></code> and
+ <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">cref</span></code> can be used to make it store a reference
+ to the function object, rather than a copy. This can be useful when the function
+ object is non-copyable, expensive to copy, or contains state; of course,
+ in this case the programmer is expected to ensure that the function object
+ is not destroyed while it's still being used.
+ </p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">F2</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">s</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="keyword">void</span> <span class="keyword">operator</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="identifier">s</span> <span class="special">+=</span> <span class="identifier">x</span><span class="special">;</span> <span class="special">}</span>
+<span class="special">};</span>
+
+<span class="identifier">F2</span> <span class="identifier">f2</span> <span class="special">=</span> <span class="special">{</span> <span class="number">0</span> <span class="special">};</span>
+<span class="keyword">int</span> <span class="identifier">a</span><span class="special">[]</span> <span class="special">=</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="number">3</span> <span class="special">};</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">a</span><span class="special">+</span><span class="number">3</span><span class="special">,</span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">f2</span><span class="special">),</span> <span class="identifier">_1</span><span class="special">));</span>
+
+<span class="identifier">assert</span><span class="special">(</span><span class="identifier">f2</span><span class="special">.</span><span class="identifier">s</span> <span class="special">==</span> <span class="number">6</span><span class="special">);</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.purpose.using_bind_with_pointers_to_memb"></a><a class="link" href="bind.html#bind.purpose.using_bind_with_pointers_to_memb" title="Using bind with pointers to members">Using
+ bind with pointers to members</a>
+</h3></div></div></div>
+<p>
+ Pointers to member functions and pointers to data members are not function
+ objects, because they do not support <code class="computeroutput"><span class="keyword">operator</span><span class="special">()</span></code>. For convenience, <code class="computeroutput"><span class="identifier">bind</span></code>
+ accepts member pointers as its first argument, and the behavior is as if
+ <a href="../../../../libs/bind/mem_fn.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span></code></a>
+ has been used to convert the member pointer into a function object. In other
+ words, the expression
+ </p>
+<pre class="programlisting"><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">args</span><span class="special">)</span>
+</pre>
+<p>
+ is equivalent to
+ </p>
+<pre class="programlisting"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><a href="../../../../libs/bind/mem_fn.html" target="_top"><code class="computeroutput"><span class="identifier">mem_fn</span></code></a><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">),</span> <span class="identifier">args</span><span class="special">)</span>
+</pre>
+<p>
+ where <code class="computeroutput"><span class="identifier">R</span></code> is the return type
+ of <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span></code> (for member functions) or the type of
+ the member (for data members.)
+ </p>
+<p>
+ <span class="emphasis"><em>[Note:</em></span> <code class="computeroutput"><span class="identifier">mem_fn</span></code>
+ creates function objects that are able to accept a pointer, a reference,
+ or a smart pointer to an object as its first argument; for additional information,
+ see the <code class="computeroutput"><span class="identifier">mem_fn</span></code> <a href="../../../../libs/bind/mem_fn.html" target="_top">documentation</a>.<span class="emphasis"><em>]</em></span>
+ </p>
+<p>
+ Example:
+ </p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">X</span>
+<span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">a</span><span class="special">);</span>
+<span class="special">};</span>
+
+<span class="identifier">X</span> <span class="identifier">x</span><span class="special">;</span>
+<span class="identifier">shared_ptr</span><span class="special"><</span><span class="identifier">X</span><span class="special">></span> <span class="identifier">p</span><span class="special">(</span><span class="keyword">new</span> <span class="identifier">X</span><span class="special">);</span>
+<span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">5</span><span class="special">;</span>
+
+<span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">ref</span><span class="special">(</span><span class="identifier">x</span><span class="special">),</span> <span class="identifier">_1</span><span class="special">)(</span><span class="identifier">i</span><span class="special">);</span> <span class="comment">// x.f(i)</span>
+<span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">,</span> <span class="special">&</span><span class="identifier">x</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)(</span><span class="identifier">i</span><span class="special">);</span> <span class="comment">// (&x)->f(i)</span>
+<span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)(</span><span class="identifier">i</span><span class="special">);</span> <span class="comment">// (internal copy of x).f(i)</span>
+<span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)(</span><span class="identifier">i</span><span class="special">);</span> <span class="comment">// (internal copy of p)->f(i)</span>
+</pre>
+<p>
+ The last two examples are interesting in that they produce "self-contained"
+ function objects. <code class="computeroutput"><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">x</span><span class="special">,</span>
+ <span class="identifier">_1</span><span class="special">)</span></code>
+ stores a copy of <code class="computeroutput"><span class="identifier">x</span></code>. <code class="computeroutput"><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">p</span><span class="special">,</span>
+ <span class="identifier">_1</span><span class="special">)</span></code>
+ stores a copy of <code class="computeroutput"><span class="identifier">p</span></code>, and since
+ <code class="computeroutput"><span class="identifier">p</span></code> is a <a href="../../../../libs/smart_ptr/doc/html/smart_ptr.html#shared_ptr" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span></code></a>, the function object
+ retains a reference to its instance of <code class="computeroutput"><span class="identifier">X</span></code>
+ and will remain valid even when <code class="computeroutput"><span class="identifier">p</span></code>
+ goes out of scope or is <code class="computeroutput"><span class="identifier">reset</span><span class="special">()</span></code>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.purpose.using_nested_binds_for_function_"></a><a class="link" href="bind.html#bind.purpose.using_nested_binds_for_function_" title="Using nested binds for function composition">Using
+ nested binds for function composition</a>
+</h3></div></div></div>
+<p>
+ Some of the arguments passed to <code class="computeroutput"><span class="identifier">bind</span></code>
+ may be nested <span class="emphasis"><em>bind expressions</em></span> themselves:
+ </p>
+<pre class="programlisting"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">))(</span><span class="identifier">x</span><span class="special">);</span> <span class="comment">// f(g(x))</span>
+</pre>
+<p>
+ The inner <span class="emphasis"><em>bind expressions</em></span> are evaluated, in unspecified
+ order, before the outer <code class="computeroutput"><span class="identifier">bind</span></code>
+ when the function object is called; the results of the evaluation are then
+ substituted in their place when the outer <code class="computeroutput"><span class="identifier">bind</span></code>
+ is evaluated. In the example above, when the function object is called with
+ the argument list <code class="computeroutput"><span class="special">(</span><span class="identifier">x</span><span class="special">)</span></code>, <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span>
+ <span class="identifier">_1</span><span class="special">)(</span><span class="identifier">x</span><span class="special">)</span></code> is evaluated
+ first, yielding <code class="computeroutput"><span class="identifier">g</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span></code>, and
+ then <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">g</span><span class="special">(</span><span class="identifier">x</span><span class="special">))(</span><span class="identifier">x</span><span class="special">)</span></code> is evaluated,
+ yielding the final result <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="identifier">g</span><span class="special">(</span><span class="identifier">x</span><span class="special">))</span></code>.
+ </p>
+<p>
+ This feature of <code class="computeroutput"><span class="identifier">bind</span></code> can
+ be used to perform function composition. See <a href="../../bind_as_compose.cpp" target="_top">bind_as_compose.cpp</a>
+ for an example that demonstrates how to use <code class="computeroutput"><span class="identifier">bind</span></code>
+ to achieve similar functionality to <a href="http://www.boost.org/doc/libs/1_31_0/libs/compose/index.htm" target="_top">Boost.Compose</a>.
+ </p>
+<p>
+ Note that the first argument - the bound function object - is not evaluated,
+ even when it's a function object that is produced by <code class="computeroutput"><span class="identifier">bind</span></code>
+ or a <span class="emphasis"><em>placeholder</em></span> argument, so the example below does
+ not work as expected:
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="keyword">void</span> <span class="special">(*</span><span class="identifier">pf</span><span class="special">)(</span><span class="keyword">int</span><span class="special">);</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">pf</span><span class="special">></span> <span class="identifier">v</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">_1</span><span class="special">,</span> <span class="number">5</span><span class="special">));</span>
+</pre>
+<p>
+ The desired effect can be achieved via a helper function object <code class="computeroutput"><span class="identifier">apply</span></code> that applies its first argument,
+ as a function object, to the rest of its argument list. For convenience,
+ an implementation of <code class="computeroutput"><span class="identifier">apply</span></code>
+ is provided in the <a href="../../../../boost/bind/apply.hpp" target="_top">apply.hpp</a>
+ header file. Here is how the modified version of the previous example looks
+ like:
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="keyword">void</span> <span class="special">(*</span><span class="identifier">pf</span><span class="special">)(</span><span class="keyword">int</span><span class="special">);</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">pf</span><span class="special">></span> <span class="identifier">v</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">apply</span><span class="special"><</span><span class="keyword">void</span><span class="special">>(),</span> <span class="identifier">_1</span><span class="special">,</span> <span class="number">5</span><span class="special">));</span>
+</pre>
+<p>
+ Although the first argument is, by default, not evaluated, all other arguments
+ are. Sometimes it is necessary not to evaluate arguments subsequent to the
+ first, even when they are nested <span class="emphasis"><em>bind subexpressions</em></span>.
+ This can be achieved with the help of another function object, <code class="computeroutput"><span class="identifier">protect</span></code>, that masks the type so that <code class="computeroutput"><span class="identifier">bind</span></code> does not recognize and evaluate it.
+ When called, protect simply forwards the argument list to the other function
+ object unmodified.
+ </p>
+<p>
+ The header <a href="../../../../boost/bind/protect.hpp" target="_top">protect.hpp</a>
+ contains an implementation of <code class="computeroutput"><span class="identifier">protect</span></code>.
+ To <code class="computeroutput"><span class="identifier">protect</span></code> a bind function
+ object from evaluation, use <code class="computeroutput"><span class="identifier">protect</span><span class="special">(</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...))</span></code>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.purpose.overloaded_operators_new_in_boos"></a><a class="link" href="bind.html#bind.purpose.overloaded_operators_new_in_boos" title="Overloaded operators (new in Boost 1.33)">Overloaded
+ operators (new in Boost 1.33)</a>
+</h3></div></div></div>
+<p>
+ For convenience, the function objects produced by <code class="computeroutput"><span class="identifier">bind</span></code>
+ overload the logical not operator <code class="computeroutput"><span class="special">!</span></code>
+ and the relational and logical operators <code class="computeroutput"><span class="special">==,</span>
+ <span class="special">!=,</span> <span class="special"><,</span>
+ <span class="special"><=,</span> <span class="special">>,</span>
+ <span class="special">>=,</span> <span class="special">&&,</span>
+ <span class="special">||</span></code>.
+ </p>
+<p>
+ <code class="computeroutput"><span class="special">!</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span>
+ <span class="special">...)</span></code> is equivalent to <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">logical_not</span><span class="special">(),</span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span>
+ <span class="special">...))</span></code>, where <code class="computeroutput"><span class="identifier">logical_not</span></code>
+ is a function object that takes one argument <code class="computeroutput"><span class="identifier">x</span></code>
+ and returns <code class="computeroutput"><span class="special">!</span><span class="identifier">x</span></code>.
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span>
+ <span class="identifier">op</span> <span class="identifier">x</span></code>,
+ where <span class="underline">op</span> is a relational or logical
+ operator, is equivalent to <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">relation</span><span class="special">(),</span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span>
+ <span class="special">...),</span> <span class="identifier">x</span><span class="special">)</span></code>, where <code class="computeroutput"><span class="identifier">relation</span></code>
+ is a function object that takes two arguments <code class="computeroutput"><span class="identifier">a</span></code>
+ and <code class="computeroutput"><span class="identifier">b</span></code> and returns <code class="computeroutput"><span class="identifier">a</span> <span class="identifier">op</span> <span class="identifier">b</span></code>.
+ </p>
+<p>
+ What this means in practice is that you can conveniently negate the result
+ of <code class="computeroutput"><span class="identifier">bind</span></code>:
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">remove_if</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="special">!</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">visible</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">));</span> <span class="comment">// remove invisible objects</span>
+</pre>
+<p>
+ and compare the result of <code class="computeroutput"><span class="identifier">bind</span></code>
+ against a value:
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">find_if</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">name</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)</span> <span class="special">==</span> <span class="string">"Peter"</span><span class="special">);</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">find_if</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">name</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)</span> <span class="special">==</span> <span class="string">"Peter"</span> <span class="special">||</span> <span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">name</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)</span> <span class="special">==</span> <span class="string">"Paul"</span><span class="special">);</span>
+</pre>
+<p>
+ against a <span class="emphasis"><em>placeholder</em></span>:
+ </p>
+<pre class="programlisting"><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">name</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)</span> <span class="special">==</span> <span class="identifier">_2</span>
+</pre>
+<p>
+ or against another <span class="emphasis"><em>bind expression</em></span>:
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">sort</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">name</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)</span> <span class="special"><</span> <span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">name</span><span class="special">,</span> <span class="identifier">_2</span><span class="special">));</span> <span class="comment">// sort by name</span>
+</pre>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="bind.examples"></a><a class="link" href="bind.html#bind.examples" title="Examples">Examples</a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.examples.using_bind_with_standard_algorit"></a><a class="link" href="bind.html#bind.examples.using_bind_with_standard_algorit" title="Using bind with standard algorithms">Using
+ bind with standard algorithms</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">image</span><span class="special">;</span>
+
+<span class="keyword">class</span> <span class="identifier">animation</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">advance</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">ms</span><span class="special">);</span>
+ <span class="keyword">bool</span> <span class="identifier">inactive</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+ <span class="keyword">void</span> <span class="identifier">render</span><span class="special">(</span><span class="identifier">image</span> <span class="special">&</span> <span class="identifier">target</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">animation</span><span class="special">></span> <span class="identifier">anims</span><span class="special">;</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">C</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">P</span><span class="special">></span> <span class="keyword">void</span> <span class="identifier">erase_if</span><span class="special">(</span><span class="identifier">C</span> <span class="special">&</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">P</span> <span class="identifier">pred</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">c</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">remove_if</span><span class="special">(</span><span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">pred</span><span class="special">),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
+<span class="special">}</span>
+
+<span class="keyword">void</span> <span class="identifier">update</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">ms</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">anims</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">anims</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">animation</span><span class="special">::</span><span class="identifier">advance</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">,</span> <span class="identifier">ms</span><span class="special">));</span>
+ <span class="identifier">erase_if</span><span class="special">(</span><span class="identifier">anims</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span><span class="special">(&</span><span class="identifier">animation</span><span class="special">::</span><span class="identifier">inactive</span><span class="special">));</span>
+<span class="special">}</span>
+
+<span class="keyword">void</span> <span class="identifier">render</span><span class="special">(</span><span class="identifier">image</span> <span class="special">&</span> <span class="identifier">target</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">anims</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">anims</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">animation</span><span class="special">::</span><span class="identifier">render</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">target</span><span class="special">)));</span>
+<span class="special">}</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.examples.using_bind_with_boost_function"></a><a class="link" href="bind.html#bind.examples.using_bind_with_boost_function" title="Using bind with Boost.Function">Using bind
+ with Boost.Function</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">button</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <a href="../../../../libs/function/index.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code></a><span class="special"><</span><span class="keyword">void</span><span class="special">()></span> <span class="identifier">onClick</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="keyword">class</span> <span class="identifier">player</span>
+<span class="special">{</span>
+<span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="identifier">play</span><span class="special">();</span>
+ <span class="keyword">void</span> <span class="identifier">stop</span><span class="special">();</span>
+<span class="special">};</span>
+
+<span class="identifier">button</span> <span class="identifier">playButton</span><span class="special">,</span> <span class="identifier">stopButton</span><span class="special">;</span>
+<span class="identifier">player</span> <span class="identifier">thePlayer</span><span class="special">;</span>
+
+<span class="keyword">void</span> <span class="identifier">connect</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">playButton</span><span class="special">.</span><span class="identifier">onClick</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">player</span><span class="special">::</span><span class="identifier">play</span><span class="special">,</span> <span class="special">&</span><span class="identifier">thePlayer</span><span class="special">);</span>
+ <span class="identifier">stopButton</span><span class="special">.</span><span class="identifier">onClick</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">player</span><span class="special">::</span><span class="identifier">stop</span><span class="special">,</span> <span class="special">&</span><span class="identifier">thePlayer</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="bind.limitations"></a><a class="link" href="bind.html#bind.limitations" title="Limitations">Limitations</a>
+</h2></div></div></div>
+<p>
+ As a general rule, the function objects generated by <code class="computeroutput"><span class="identifier">bind</span></code>
+ take their arguments by reference and cannot, therefore, accept non-const temporaries
+ or literal constants. This is an inherent limitation of the C++ language in
+ its current (2003) incarnation, known as the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm" target="_top">forwarding
+ problem</a>. (It will be fixed in the next standard, usually called C++0x.)
+ </p>
+<p>
+ The library uses signatures of the form
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">T</span> <span class="special">&</span> <span class="identifier">t</span><span class="special">);</span>
+</pre>
+<p>
+ to accept arguments of arbitrary types and pass them on unmodified. As noted,
+ this does not work with non-const r-values.
+ </p>
+<p>
+ On compilers that support partial ordering of function templates, a possible
+ solution is to add an overload:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">T</span> <span class="special">&</span> <span class="identifier">t</span><span class="special">);</span>
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">t</span><span class="special">);</span>
+</pre>
+<p>
+ Unfortunately, this requires providing 512 overloads for nine arguments, which
+ is impractical. The library chooses a small subset: for up to two arguments,
+ it provides the const overloads in full, for arities of three and more it provides
+ a single additional overload with all of the arguments taken by const reference.
+ This covers a reasonable portion of the use cases.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="bind.faq"></a><a class="link" href="bind.html#bind.faq" title="Frequently Asked Questions">Frequently Asked Questions</a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.faq.why_doesn_t_this_compile"></a><a class="link" href="bind.html#bind.faq.why_doesn_t_this_compile" title="Why doesn't this compile?">Why doesn't this compile?</a>
+</h3></div></div></div>
+<p>
+ See the dedicated <a class="link" href="bind.html#bind.troubleshooting" title="Troubleshooting">Troubleshooting section</a>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.faq.why_does_this_compile_it_should_"></a><a class="link" href="bind.html#bind.faq.why_does_this_compile_it_should_" title="Why does this compile? It should not.">Why does this
+ compile? It should not.</a>
+</h3></div></div></div>
+<p>
+ Probably because you used the general <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code>
+ syntax, thereby instructing <code class="computeroutput"><span class="identifier">bind</span></code>
+ to not "inspect" f to detect arity and return type errors.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.faq.Q_forms"></a><a class="link" href="bind.html#bind.faq.Q_forms" title="What is the difference between bind(f, ...) and bind<R>(f, ...)?">What is the difference between <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code> and
+ <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code>?</a>
+</h3></div></div></div>
+<p>
+ The first form instructs <code class="computeroutput"><span class="identifier">bind</span></code>
+ to inspect the type of <code class="computeroutput"><span class="identifier">f</span></code>
+ in order to determine its arity (number of arguments) and return type. Arity
+ errors will be detected at "bind time". This syntax, of course,
+ places some requirements on <code class="computeroutput"><span class="identifier">f</span></code>.
+ It must be a function, function pointer, member function pointer, or a function
+ object that defines a nested type named <code class="computeroutput"><span class="identifier">result_type</span></code>;
+ in short, it must be something that <code class="computeroutput"><span class="identifier">bind</span></code>
+ can recognize.
+ </p>
+<p>
+ The second form instructs <code class="computeroutput"><span class="identifier">bind</span></code>
+ to not attempt to recognize the type of <code class="computeroutput"><span class="identifier">f</span></code>.
+ It is generally used with function objects that do not, or cannot, expose
+ <code class="computeroutput"><span class="identifier">result_type</span></code>, but it can also
+ be used with nonstandard functions. For example, the current implementation
+ does not automatically recognize variable-argument functions like <code class="computeroutput"><span class="identifier">printf</span></code>, so you will have to use <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="keyword">int</span><span class="special">>(</span><span class="identifier">printf</span><span class="special">,</span> <span class="special">...)</span></code>. Note
+ that an alternative <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">type</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(),</span> <span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code>
+ syntax is supported for portability reasons.
+ </p>
+<p>
+ Another important factor to consider is that compilers without partial template
+ specialization or function template partial ordering support cannot handle
+ the first form when <code class="computeroutput"><span class="identifier">f</span></code> is
+ a function object, and in most cases will not handle the second form when
+ <code class="computeroutput"><span class="identifier">f</span></code> is a function (pointer)
+ or a member function pointer.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.faq.does_bind_work_with_windows_api_"></a><a class="link" href="bind.html#bind.faq.does_bind_work_with_windows_api_" title="Does bind work with Windows API functions?">Does bind
+ work with Windows API functions?</a>
+</h3></div></div></div>
+<p>
+ Yes, if you <a class="link" href="bind.html#bind.implementation.stdcall" title="__stdcall, __cdecl, __fastcall, and pascal Support"><code class="computeroutput"><span class="preprocessor">#define</span>
+ <span class="identifier">BOOST_BIND_ENABLE_STDCALL</span></code></a>.
+ An alternative is to treat the function as a <a class="link" href="bind.html#bind.purpose.with_function_objects" title="Using bind with function objects">generic
+ function object</a> and use the <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code>
+ syntax.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.faq.does_bind_work_with_com_methods"></a><a class="link" href="bind.html#bind.faq.does_bind_work_with_com_methods" title="Does bind work with COM methods?">Does bind work
+ with COM methods?</a>
+</h3></div></div></div>
+<p>
+ Yes, if you <a class="link" href="bind.html#bind.implementation.stdcall" title="__stdcall, __cdecl, __fastcall, and pascal Support"><code class="computeroutput"><span class="preprocessor">#define</span>
+ <span class="identifier">BOOST_MEM_FN_ENABLE_STDCALL</span></code></a>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.faq.does_bind_work_with_mac_toolbox_"></a><a class="link" href="bind.html#bind.faq.does_bind_work_with_mac_toolbox_" title="Does bind work with Mac toolbox functions?">Does bind
+ work with Mac toolbox functions?</a>
+</h3></div></div></div>
+<p>
+ Yes, if you <a class="link" href="bind.html#bind.implementation.stdcall" title="__stdcall, __cdecl, __fastcall, and pascal Support"><code class="computeroutput"><span class="preprocessor">#define</span>
+ <span class="identifier">BOOST_BIND_ENABLE_PASCAL</span></code></a>.
+ An alternative is to treat the function as a <a class="link" href="bind.html#bind.purpose.with_function_objects" title="Using bind with function objects">generic
+ function object</a> and use the <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code>
+ syntax.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.faq.does_bind_work_with_extern_c_fun"></a><a class="link" href="bind.html#bind.faq.does_bind_work_with_extern_c_fun" title='Does bind work with extern "C" functions?'>Does bind
+ work with extern "C" functions?</a>
+</h3></div></div></div>
+<p>
+ Sometimes. On some platforms, pointers to extern "C" functions
+ are equivalent to "ordinary" function pointers, so they work fine.
+ Other platforms treat them as different types. A platform-specific implementation
+ of <code class="computeroutput"><span class="identifier">bind</span></code> is expected to handle
+ the problem transparently; this implementation does not. As usual, the workaround
+ is to treat the function as a <a class="link" href="bind.html#bind.purpose.with_function_objects" title="Using bind with function objects">generic
+ function object</a> and use the <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code>
+ syntax.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.faq.why_doesn_t_bind_automatically_r"></a><a class="link" href="bind.html#bind.faq.why_doesn_t_bind_automatically_r" title="Why doesn't bind automatically recognize nonstandard functions?">Why doesn't
+ bind automatically recognize nonstandard functions?</a>
+</h3></div></div></div>
+<p>
+ Non-portable extensions, in general, should default to off to prevent vendor
+ lock-in. Had the <a class="link" href="bind.html#bind.implementation.stdcall" title="__stdcall, __cdecl, __fastcall, and pascal Support">appropriate
+ macros</a> been defined automatically, you could have accidentally taken
+ advantage of them without realizing that your code is, perhaps, no longer
+ portable. In addition, some compilers have the option to make <code class="computeroutput"><span class="identifier">__stdcall</span></code> (<code class="computeroutput"><span class="identifier">__fastcall</span></code>)
+ their default calling convention, in which case no separate support would
+ be necessary.
+ </p>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="bind.troubleshooting"></a><a class="link" href="bind.html#bind.troubleshooting" title="Troubleshooting">Troubleshooting</a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.troubleshooting.incorrect_number_of_arguments"></a><a class="link" href="bind.html#bind.troubleshooting.incorrect_number_of_arguments" title="Incorrect number of arguments">Incorrect
+ number of arguments</a>
+</h3></div></div></div>
+<p>
+ In a <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">,</span>
+ <span class="special">...,</span> <span class="identifier">aN</span><span class="special">)</span></code> expression, the function object <code class="computeroutput"><span class="identifier">f</span></code> must be able to take exactly N arguments.
+ This error is normally detected at "bind time"; in other words,
+ the compilation error is reported on the line where <code class="computeroutput"><span class="identifier">bind</span><span class="special">()</span></code> is invoked:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">f</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="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="number">1</span><span class="special">);</span> <span class="comment">// error, f takes two arguments</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</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">// OK</span>
+<span class="special">}</span>
+</pre>
+<p>
+ A common variation of this error is to forget that member functions have
+ an implicit "this" argument:
+ </p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">X</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">int</span><span class="special">);</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="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">,</span> <span class="number">1</span><span class="special">);</span> <span class="comment">// error, X::f takes two arguments</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">,</span> <span class="number">1</span><span class="special">);</span> <span class="comment">// OK</span>
+<span class="special">}</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.troubleshooting.the_function_object_cannot_be_ca"></a><a class="link" href="bind.html#bind.troubleshooting.the_function_object_cannot_be_ca" title="The function object cannot be called with the specified arguments">The
+ function object cannot be called with the specified arguments</a>
+</h3></div></div></div>
+<p>
+ As in normal function calls, the function object that is bound must be compatible
+ with the argument list. The incompatibility will usually be detected by the
+ compiler at "call time" and the result is typically an error in
+ <code class="computeroutput"><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span></code> on a line that looks like:
+ </p>
+<pre class="programlisting"><span class="keyword">return</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">a</span><span class="special">[</span><span class="identifier">a1_</span><span class="special">],</span> <span class="identifier">a</span><span class="special">[</span><span class="identifier">a2_</span><span class="special">]);</span>
+</pre>
+<p>
+ An example of this kind of error:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">int</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="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="string">"incompatible"</span><span class="special">);</span> <span class="comment">// OK so far, no call</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="string">"incompatible"</span><span class="special">)();</span> <span class="comment">// error, "incompatible" is not an int</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">);</span> <span class="comment">// OK</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)(</span><span class="string">"incompatible"</span><span class="special">);</span> <span class="comment">// error, "incompatible" is not an int</span>
+<span class="special">}</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.troubleshooting.accessing_an_argument_that_does_"></a><a class="link" href="bind.html#bind.troubleshooting.accessing_an_argument_that_does_" title="Accessing an argument that does not exist">Accessing
+ an argument that does not exist</a>
+</h3></div></div></div>
+<p>
+ The placeholder <code class="computeroutput"><span class="identifier">_N</span></code> selects
+ the argument at position <code class="computeroutput"><span class="identifier">N</span></code>
+ from the argument list passed at "call time." Naturally, it is
+ an error to attempt to access beyond the end of this list:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">int</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="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">);</span> <span class="comment">// OK</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)();</span> <span class="comment">// error, there is no argument number 1</span>
+<span class="special">}</span>
+</pre>
+<p>
+ The error is usually reported in <code class="computeroutput"><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span></code>, at
+ a line similar to:
+ </p>
+<pre class="programlisting"><span class="keyword">return</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">a</span><span class="special">[</span><span class="identifier">a1_</span><span class="special">]);</span>
+</pre>
+<p>
+ When emulating <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bind1st</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">a</span><span class="special">)</span></code>, a common mistake of this category is to
+ type <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">_2</span><span class="special">)</span></code>
+ instead of the correct <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span>
+ <span class="identifier">a</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)</span></code>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.troubleshooting.inappropriate_use_of_bind_f"></a><a class="link" href="bind.html#bind.troubleshooting.inappropriate_use_of_bind_f" title="Inappropriate use of bind(f, ...)">Inappropriate
+ use of <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code></a>
+</h3></div></div></div>
+<p>
+ The <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">,</span>
+ <span class="special">...,</span> <span class="identifier">aN</span><span class="special">)</span></code> <a class="link" href="bind.html#bind.faq.Q_forms" title="What is the difference between bind(f, ...) and bind<R>(f, ...)?">form</a>
+ causes automatic recognition of the type of <code class="computeroutput"><span class="identifier">f</span></code>.
+ It will not work with arbitrary function objects; <code class="computeroutput"><span class="identifier">f</span></code>
+ must be a function or a member function pointer.
+ </p>
+<p>
+ It is possible to use this form with function objects that define <code class="computeroutput"><span class="identifier">result_type</span></code>, but only on compilers that
+ support partial specialization and partial ordering. In particular, MSVC
+ up to version 7.0 does not support this syntax for function objects.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.troubleshooting.inappropriate_use_of_bind_r_f"></a><a class="link" href="bind.html#bind.troubleshooting.inappropriate_use_of_bind_r_f" title="Inappropriate use of bind<R>(f, ...)">Inappropriate
+ use of <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code></a>
+</h3></div></div></div>
+<p>
+ The <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">,</span>
+ <span class="special">...,</span> <span class="identifier">aN</span><span class="special">)</span></code> <a class="link" href="bind.html#bind.faq.Q_forms" title="What is the difference between bind(f, ...) and bind<R>(f, ...)?">form</a>
+ supports arbitrary function objects.
+ </p>
+<p>
+ It is possible (but not recommended) to use this form with functions or member
+ function pointers, but only on compilers that support partial ordering. In
+ particular, MSVC up to version 7.0 does not fully support this syntax for
+ functions and member function pointers.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.troubleshooting.binding_a_nonstandard_function"></a><a class="link" href="bind.html#bind.troubleshooting.binding_a_nonstandard_function" title="Binding a nonstandard function">Binding
+ a nonstandard function</a>
+</h3></div></div></div>
+<p>
+ By default, the <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">,</span>
+ <span class="special">...,</span> <span class="identifier">aN</span><span class="special">)</span></code> <a class="link" href="bind.html#bind.faq.Q_forms" title="What is the difference between bind(f, ...) and bind<R>(f, ...)?">form</a>
+ recognizes "ordinary" C++ functions and function pointers. <a class="link" href="bind.html#bind.implementation.stdcall" title="__stdcall, __cdecl, __fastcall, and pascal Support">Functions that use a different calling
+ convention</a>, or variable-argument functions such as <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">printf</span></code>,
+ do not work. The general <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">,</span>
+ <span class="special">...,</span> <span class="identifier">aN</span><span class="special">)</span></code> <a class="link" href="bind.html#bind.faq.Q_forms" title="What is the difference between bind(f, ...) and bind<R>(f, ...)?">form</a>
+ works with nonstandard functions.
+ </p>
+<p>
+ On some platforms, extern "C" functions, like <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">strcmp</span></code>,
+ are not recognized by the short form of <code class="computeroutput"><span class="identifier">bind</span></code>.
+ </p>
+<p>
+ See also <a class="link" href="bind.html#bind.implementation.stdcall" title="__stdcall, __cdecl, __fastcall, and pascal Support"><code class="computeroutput"><span class="identifier">__stdcall</span></code>
+ and <code class="computeroutput"><span class="identifier">pascal</span></code> Support</a>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.troubleshooting.binding_an_overloaded_function"></a><a class="link" href="bind.html#bind.troubleshooting.binding_an_overloaded_function" title="Binding an overloaded function">Binding
+ an overloaded function</a>
+</h3></div></div></div>
+<p>
+ An attempt to bind an overloaded function usually results in an error, as
+ there is no way to tell which overload was meant to be bound. This is a common
+ problem with member functions with two overloads, const and non-const, as
+ in this simplified example:
+ </p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">X</span>
+<span class="special">{</span>
+ <span class="keyword">int</span><span class="special">&</span> <span class="identifier">get</span><span class="special">();</span>
+ <span class="keyword">int</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">get</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</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="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">get</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+ The ambiguity can be resolved manually by casting the (member) function pointer
+ to the desired type:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special"><</span> <span class="keyword">int</span> <span class="keyword">const</span><span class="special">&</span> <span class="special">(</span><span class="identifier">X</span><span class="special">::*)</span> <span class="special">()</span> <span class="keyword">const</span> <span class="special">>(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">get</span><span class="special">),</span> <span class="identifier">_1</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Another, arguably more readable, alternative is to introduce a temporary
+ variable:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="keyword">int</span> <span class="keyword">const</span><span class="special">&</span> <span class="special">(</span><span class="identifier">X</span><span class="special">::*</span><span class="identifier">get</span><span class="special">)</span> <span class="special">()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="special">&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">get</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">get</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.troubleshooting.modeling_stl_function_object_con"></a><a class="link" href="bind.html#bind.troubleshooting.modeling_stl_function_object_con" title="Modeling STL function object concepts">Modeling
+ STL function object concepts</a>
+</h3></div></div></div>
+<p>
+ The function objects that are produced by <code class="computeroutput"><span class="identifier">bind</span></code>
+ do not model the STL <a href="http://www.sgi.com/tech/stl/UnaryFunction.html" target="_top"><span class="emphasis"><em>Unary
+ Function</em></span></a> or <a href="http://www.sgi.com/tech/stl/BinaryFunction.html" target="_top"><span class="emphasis"><em>Binary
+ Function</em></span></a> concepts, even when the function objects are
+ unary or binary operations, because the function object types are missing
+ public typedefs <code class="computeroutput"><span class="identifier">result_type</span></code>
+ and <code class="computeroutput"><span class="identifier">argument_type</span></code> or <code class="computeroutput"><span class="identifier">first_argument_type</span></code> and <code class="computeroutput"><span class="identifier">second_argument_type</span></code>.
+ In cases where these typedefs are desirable, however, the utility function
+ <code class="computeroutput"><span class="identifier">make_adaptable</span></code> can be used
+ to adapt unary and binary function objects to these concepts. This allows
+ unary and binary function objects resulting from <code class="computeroutput"><span class="identifier">bind</span></code>
+ to be combined with STL templates such as <a href="http://en.cppreference.com/w/cpp/utility/functional/unary_negate" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">unary_negate</span></code></a>
+ and <a href="http://en.cppreference.com/w/cpp/utility/functional/binary_negate" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">binary_negate</span></code></a>.
+ </p>
+<p>
+ The <code class="computeroutput"><span class="identifier">make_adaptable</span></code> function
+ is defined in <a href="../../../../boost/bind/make_adaptable.hpp" target="_top"><code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bind</span><span class="special">/</span><span class="identifier">make_adaptable</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code></a>,
+ which must be included explicitly in addition to <a href="../../../../boost/bind.hpp" target="_top"><code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code></a>:
+ </p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bind</span><span class="special">/</span><span class="identifier">make_adaptable</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+
+<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">></span> <span class="emphasis"><em>unspecified-type</em></span> <span class="identifier">make_adaptable</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">></span> <span class="emphasis"><em>unspecified-unary-functional-type</em></span> <span class="identifier">make_adaptable</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">></span> <span class="emphasis"><em>unspecified-binary-functional-type</em></span> <span class="identifier">make_adaptable</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A3</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">></span> <span class="emphasis"><em>unspecified-ternary-functional-type</em></span> <span class="identifier">make_adaptable</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A3</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A4</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">></span> <span class="emphasis"><em>unspecified-4-ary-functional-type</em></span> <span class="identifier">make_adaptable</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">);</span>
+</pre>
+<p>
+ This example shows how to use <code class="computeroutput"><span class="identifier">make_adaptable</span></code>
+ to make a predicate for "is not a space":
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="keyword">char</span> <span class="identifier">char_t</span><span class="special">;</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="identifier">loc</span><span class="special">(</span><span class="string">""</span><span class="special">);</span>
+<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ctype</span><span class="special"><</span><span class="identifier">char_t</span><span class="special">>&</span> <span class="identifier">ct</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">use_facet</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ctype</span><span class="special"><</span><span class="identifier">char_t</span><span class="special">></span> <span class="special">>(</span><span class="identifier">loc</span><span class="special">);</span>
+
+<span class="keyword">auto</span> <span class="identifier">isntspace</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">not1</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_adaptable</span><span class="special"><</span><span class="keyword">bool</span><span class="special">,</span> <span class="identifier">char_t</span><span class="special">>(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(&</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ctype</span><span class="special"><</span><span class="identifier">char_t</span><span class="special">>::</span><span class="identifier">is</span><span class="special">,</span> <span class="special">&</span><span class="identifier">ct</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ctype_base</span><span class="special">::</span><span class="identifier">space</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">)));</span>
+</pre>
+<p>
+ In this example, <code class="computeroutput"><span class="identifier">bind</span></code> creates
+ the "is a space" (unary) predicate. It is then passed to <code class="computeroutput"><span class="identifier">make_adaptable</span></code> so that a function object
+ modeling the <span class="emphasis"><em>Unary Function</em></span> concept can be created,
+ serving as the argument to <a href="http://en.cppreference.com/w/cpp/utility/functional/not1" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">not1</span></code></a>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.troubleshooting.const_in_signatures"></a><a class="link" href="bind.html#bind.troubleshooting.const_in_signatures" title="const in signatures"><code class="computeroutput"><span class="keyword">const</span></code> in signatures</a>
+</h3></div></div></div>
+<p>
+ Some compilers, including MSVC 6.0 and Borland C++ 5.5.1, have problems with
+ the top-level <code class="computeroutput"><span class="keyword">const</span></code> in function
+ signatures:
+ </p>
+<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">int</span> <span class="keyword">const</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="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="number">1</span><span class="special">);</span> <span class="comment">// error</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Workaround: remove the <code class="computeroutput"><span class="keyword">const</span></code>
+ qualifier from the argument.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.troubleshooting.msvc_specific_using_boost_bind"></a><a class="link" href="bind.html#bind.troubleshooting.msvc_specific_using_boost_bind" title="MSVC specific: using boost::bind;">MSVC
+ specific: <code class="computeroutput"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">;</span></code></a>
+</h3></div></div></div>
+<p>
+ On MSVC (up to version 7.0), when <code class="computeroutput"><span class="identifier">boostbind</span></code>
+ is brought into scope with an using declaration:
+ </p>
+<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">;</span>
+</pre>
+<p>
+ the syntax <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code>
+ does not work. Workaround: either use the qualified name, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span></code>,
+ or use an using directive instead:
+ </p>
+<pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">;</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.troubleshooting.msvc_specific_class_templates_sh"></a><a class="link" href="bind.html#bind.troubleshooting.msvc_specific_class_templates_sh" title="MSVC specific: class templates shadow function templates">MSVC
+ specific: class templates shadow function templates</a>
+</h3></div></div></div>
+<p>
+ On MSVC (up to version 7.0), a nested class template named <code class="computeroutput"><span class="identifier">bind</span></code> will shadow the function template
+ <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span></code>, breaking the <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code>syntax.
+ Unfortunately, some libraries contain nested class templates named <code class="computeroutput"><span class="identifier">bind</span></code> (ironically, such code is often an
+ MSVC specific workaround.)
+ </p>
+<p>
+ The workaround is to use the alternative <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">type</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(),</span> <span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code>
+ syntax.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.troubleshooting.msvc_specific_in_signatures_trea"></a><a class="link" href="bind.html#bind.troubleshooting.msvc_specific_in_signatures_trea" title="MSVC specific: ... in signatures treated as type">MSVC
+ specific: <code class="computeroutput"><span class="special">...</span></code> in signatures treated
+ as type</a>
+</h3></div></div></div>
+<p>
+ MSVC (up to version 7.0) treats the ellipsis in a variable argument function
+ (such as <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">printf</span></code>) as a type. Therefore, it will accept
+ the (incorrect in the current implementation) form:
+ </p>
+<pre class="programlisting"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">printf</span><span class="special">,</span> <span class="string">"%s\n"</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">);</span>
+</pre>
+<p>
+ and will reject the correct version:
+ </p>
+<pre class="programlisting"><span class="identifier">bind</span><span class="special"><</span><span class="keyword">int</span><span class="special">>(</span><span class="identifier">printf</span><span class="special">,</span> <span class="string">"%s\n"</span><span class="special">,</span> <span class="identifier">_1</span><span class="special">);</span>
+</pre>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="bind.interface"></a><a class="link" href="bind.html#bind.interface" title="Interface">Interface</a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.interface.synopsys"></a><a class="link" href="bind.html#bind.interface.synopsys" title="Synopsis">Synopsis</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
+<span class="special">{</span>
+<span class="comment">// no arguments</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">></span> <span class="emphasis"><em>unspecified-1</em></span> <a class="link" href="bind.html#bind_1"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">></span> <span class="emphasis"><em>unspecified-1-1</em></span> <a class="link" href="bind.html#bind_1_1"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">></span> <span class="emphasis"><em>unspecified-2</em></span> <a class="link" href="bind.html#bind_2"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">());</span>
+
+<span class="comment">// one argument</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-3</em></span> <a class="link" href="bind.html#bind_3"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-3-1</em></span> <a class="link" href="bind.html#bind_3_1"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-4</em></span> <a class="link" href="bind.html#bind_4"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">(</span><span class="identifier">B1</span><span class="special">),</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-5</em></span> <a class="link" href="bind.html#bind_5"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">(),</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-6</em></span> <a class="link" href="bind.html#bind_6"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">()</span> <span class="keyword">const</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-6-1</em></span> <a class="link" href="bind.html#bind_6_1"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="identifier">T</span><span class="special">::*</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">);</span>
+
+<span class="comment">// two arguments</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-7</em></span> <a class="link" href="bind.html#bind_7"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">A2</span> <span class="identifier">a2</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-7-1</em></span> <a class="link" href="bind.html#bind_7_1"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">A2</span> <span class="identifier">a2</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-8</em></span> <a class="link" href="bind.html#bind_8"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">(</span><span class="identifier">B1</span><span class="special">,</span> <span class="identifier">B2</span><span class="special">),</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">A2</span> <span class="identifier">a2</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-9</em></span> <a class="link" href="bind.html#bind_9"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">(</span><span class="identifier">B1</span><span class="special">),</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">A2</span> <span class="identifier">a2</span><span class="special">);</span>
+
+<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-10</em></span> <a class="link" href="bind.html#bind_10"><code class="computeroutput"><span class="identifier">bind</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">(</span><span class="identifier">B1</span><span class="special">)</span> <span class="keyword">const</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">A2</span> <span class="identifier">a2</span><span class="special">);</span>
+
+<span class="comment">// implementation defined number of additional overloads for more arguments</span>
+<span class="special">}</span>
+
+<span class="keyword">namespace</span>
+<span class="special">{</span>
+ <span class="emphasis"><em>unspecified-placeholder-type-1</em></span> <span class="identifier">_1</span><span class="special">;</span>
+
+ <span class="emphasis"><em>unspecified-placeholder-type-2</em></span> <span class="identifier">_2</span><span class="special">;</span>
+
+ <span class="emphasis"><em>unspecified-placeholder-type-3</em></span> <span class="identifier">_3</span><span class="special">;</span>
+
+<span class="comment">// implementation defined number of additional placeholder definitions</span>
+<span class="special">}</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.interface.common_requirements"></a><a class="link" href="bind.html#bind.interface.common_requirements" title="Common requirements">Common requirements</a>
+</h3></div></div></div>
+<p>
+ All <span class="emphasis"><em>unspecified-N</em></span> types returned by <code class="computeroutput"><span class="identifier">bind</span></code>
+ are <span class="emphasis"><em>CopyConstructible</em></span>. <span class="emphasis"><em>unspecified-N</em></span><code class="computeroutput"><span class="special">::</span><span class="identifier">result_type</span></code>
+ is defined as the return type of <span class="emphasis"><em>unspecified-N</em></span><code class="computeroutput"><span class="special">::</span><span class="keyword">operator</span><span class="special">()</span></code>.
+ </p>
+<p>
+ All <span class="emphasis"><em>unspecified-placeholder-N</em></span> types are <span class="emphasis"><em>CopyConstructible</em></span>.
+ Their copy constructors do not throw exceptions.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.interface.common_definitions"></a><a class="link" href="bind.html#bind.interface.common_definitions" title="Common definitions">Common definitions</a>
+</h3></div></div></div>
+<p>
+ The function μ<code class="computeroutput"><span class="special">(</span><span class="identifier">x</span><span class="special">,</span> <span class="identifier">v1</span><span class="special">,</span>
+ <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">)</span></code>, where <code class="computeroutput"><span class="identifier">m</span></code>
+ is a nonnegative integer, is defined as:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">x</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span></code>,
+ when <code class="computeroutput"><span class="identifier">x</span></code> is of type <a href="../../../../libs/core/doc/html/core/ref.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">reference_wrapper</span></code></a><code class="computeroutput"><span class="special"><</span><span class="identifier">T</span><span class="special">></span></code> for some type <code class="computeroutput"><span class="identifier">T</span></code>;
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">vk</span></code>, when <code class="computeroutput"><span class="identifier">x</span></code> is (a copy of) the placeholder <span class="emphasis"><em>_k</em></span>
+ for some positive integer <span class="emphasis"><em>k</em></span>;
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">x</span><span class="special">(</span><span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">)</span></code> when <code class="computeroutput"><span class="identifier">x</span></code>
+ is (a copy of) a function object returned by <code class="computeroutput"><span class="identifier">bind</span></code>;
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">x</span></code> otherwise.
+ </li>
+</ul></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.interface.bind"></a><a class="link" href="bind.html#bind.interface.bind" title="bind"><code class="computeroutput"><span class="identifier">bind</span></code></a>
+</h3></div></div></div>
+<a name="bind_1"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">></span> <span class="emphasis"><em>unspecified-1</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> A function object λ such that the
+ expression λ<code class="computeroutput"><span class="special">(</span><span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">)</span></code>
+ is equivalent to <code class="computeroutput"><span class="identifier">f</span><span class="special">()</span></code>,
+ implicitly converted to <code class="computeroutput"><span class="identifier">R</span></code>.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing unless the copy constructor of
+ <code class="computeroutput"><span class="identifier">F</span></code> throws an exception.
+ </li>
+</ul></div>
+<a name="bind_1_1"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">></span> <span class="emphasis"><em>unspecified-1-1</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Effects:</em></span> Equivalent to <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="keyword">typename</span>
+ <span class="identifier">F</span><span class="special">::</span><span class="identifier">result_type</span><span class="special">,</span>
+ <span class="identifier">F</span><span class="special">>(</span><span class="identifier">f</span><span class="special">)</span></code>.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Notes:</em></span> Implementations are allowed to infer the
+ return type of <code class="computeroutput"><span class="identifier">f</span></code> via
+ other means as an extension, without relying on the <code class="computeroutput"><span class="identifier">result_type</span></code>
+ member.
+ </li>
+</ul></div>
+<a name="bind_2"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">></span> <span class="emphasis"><em>unspecified-2</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">())</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> A function object λ such that the
+ expression λ<code class="computeroutput"><span class="special">(</span><span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">)</span></code>
+ is equivalent to <code class="computeroutput"><span class="identifier">f</span><span class="special">()</span></code>.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing.
+ </li>
+</ul></div>
+<a name="bind_3"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-3</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> A function object λ such that the
+ expression λ<code class="computeroutput"><span class="special">(</span><span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">)</span></code>
+ is equivalent to <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span></code>μ<code class="computeroutput"><span class="special">(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">))</span></code>,
+ implicitly converted to <code class="computeroutput"><span class="identifier">R</span></code>.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing unless the copy constructors of
+ <code class="computeroutput"><span class="identifier">F</span></code> or <code class="computeroutput"><span class="identifier">A1</span></code>
+ throw an exception.
+ </li>
+</ul></div>
+<a name="bind_3_1"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-3-1</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Effects:</em></span> Equivalent to <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="keyword">typename</span>
+ <span class="identifier">F</span><span class="special">::</span><span class="identifier">result_type</span><span class="special">,</span>
+ <span class="identifier">F</span><span class="special">,</span>
+ <span class="identifier">A1</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">)</span></code>.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Notes:</em></span> Implementations are allowed to infer the
+ return type of <code class="computeroutput"><span class="identifier">f</span></code> via
+ other means as an extension, without relying on the <code class="computeroutput"><span class="identifier">result_type</span></code>
+ member.
+ </li>
+</ul></div>
+<a name="bind_4"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-4</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">(</span><span class="identifier">B1</span><span class="special">),</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> A function object λ such that the
+ expression λ<code class="computeroutput"><span class="special">(</span><span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">)</span></code>
+ is equivalent to <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span></code>μ<code class="computeroutput"><span class="special">(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">))</span></code>.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing unless the copy constructor of
+ <code class="computeroutput"><span class="identifier">A1</span></code> throws an exception.
+ </li>
+</ul></div>
+<a name="bind_5"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-5</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">(),</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
+ <span class="emphasis"><em>Effects:</em></span> Equivalent to <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span></code><a href="../../../../libs/bind/mem_fn.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span></code></a><code class="computeroutput"><span class="special">(</span><span class="identifier">f</span><span class="special">),</span> <span class="identifier">a1</span><span class="special">)</span></code>.
+ </li></ul></div>
+<a name="bind_6"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-6</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">()</span> <span class="keyword">const</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
+ <span class="emphasis"><em>Effects:</em></span> Equivalent to <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span></code><a href="../../../../libs/bind/mem_fn.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span></code></a><code class="computeroutput"><span class="special">(</span><span class="identifier">f</span><span class="special">),</span> <span class="identifier">a1</span><span class="special">)</span></code>.
+ </li></ul></div>
+<a name="bind_6_1"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-6-1</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">R</span> <span class="identifier">T</span><span class="special">::*</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
+ <span class="emphasis"><em>Effects:</em></span> Equivalent to <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span></code><a href="../../../../libs/bind/mem_fn.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span></code></a><code class="computeroutput"><span class="special">(</span><span class="identifier">f</span><span class="special">),</span> <span class="identifier">a1</span><span class="special">)</span></code>.
+ </li></ul></div>
+<a name="bind_7"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-7</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">A2</span> <span class="identifier">a2</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> A function object λ such that the
+ expression λ<code class="computeroutput"><span class="special">(</span><span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">)</span></code>
+ is equivalent to <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span></code>μ<code class="computeroutput"><span class="special">(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">),</span> </code>μ<code class="computeroutput"><span class="special">(</span><span class="identifier">a2</span><span class="special">,</span> <span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">))</span></code>,
+ implicitly converted to <code class="computeroutput"><span class="identifier">R</span></code>.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing unless the copy constructors of
+ <code class="computeroutput"><span class="identifier">F</span></code>, <code class="computeroutput"><span class="identifier">A1</span></code>
+ or <code class="computeroutput"><span class="identifier">A2</span></code> throw an exception.
+ </li>
+</ul></div>
+<a name="bind_7_1"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-7-1</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">A2</span> <span class="identifier">a2</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Effects:</em></span> Equivalent to <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="keyword">typename</span>
+ <span class="identifier">F</span><span class="special">::</span><span class="identifier">result_type</span><span class="special">,</span>
+ <span class="identifier">F</span><span class="special">,</span>
+ <span class="identifier">A1</span><span class="special">,</span>
+ <span class="identifier">A2</span><span class="special">>(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">)</span></code>.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Notes:</em></span> Implementations are allowed to infer the
+ return type of <code class="computeroutput"><span class="identifier">f</span></code> via
+ other means as an extension, without relying on the <code class="computeroutput"><span class="identifier">result_type</span></code>
+ member.
+ </li>
+</ul></div>
+<a name="bind_8"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-8</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">(</span><span class="identifier">B1</span><span class="special">,</span> <span class="identifier">B2</span><span class="special">),</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">A2</span> <span class="identifier">a2</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> A function object λ such that the
+ expression λ<code class="computeroutput"><span class="special">(</span><span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">)</span></code>
+ is equivalent to <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span></code>μ<code class="computeroutput"><span class="special">(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">),</span> </code>μ<code class="computeroutput"><span class="special">(</span><span class="identifier">a2</span><span class="special">,</span> <span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">,</span> <span class="special">...,</span> <span class="identifier">vm</span><span class="special">))</span></code>.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing unless the copy constructors of
+ <code class="computeroutput"><span class="identifier">A1</span></code> or <code class="computeroutput"><span class="identifier">A2</span></code>
+ throw an exception.
+ </li>
+</ul></div>
+<a name="bind_9"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-9</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">(</span><span class="identifier">B1</span><span class="special">),</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">A2</span> <span class="identifier">a2</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
+ <span class="emphasis"><em>Effects:</em></span> Equivalent to <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span></code><a href="../../../../libs/bind/mem_fn.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span></code></a><code class="computeroutput"><span class="special">(</span><span class="identifier">f</span><span class="special">),</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">)</span></code>.
+ </li></ul></div>
+<a name="bind_10"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-10</em></span> <span class="identifier">bind</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">f</span><span class="special">)</span> <span class="special">(</span><span class="identifier">B1</span><span class="special">)</span> <span class="keyword">const</span><span class="special">,</span> <span class="identifier">A1</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">A2</span> <span class="identifier">a2</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
+ <span class="emphasis"><em>Effects:</em></span> Equivalent to <code class="computeroutput"><span class="identifier">bind</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span></code><a href="../../../../libs/bind/mem_fn.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span></code></a><code class="computeroutput"><span class="special">(</span><span class="identifier">f</span><span class="special">),</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">)</span></code>.
+ </li></ul></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.interface.additional_overloads"></a><a class="link" href="bind.html#bind.interface.additional_overloads" title="Additional overloads">Additional overloads</a>
+</h3></div></div></div>
+<p>
+ Implementations are allowed to provide additional <code class="computeroutput"><span class="identifier">bind</span></code>
+ overloads in order to support more arguments or different function pointer
+ variations.
+ </p>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="bind.implementation"></a><a class="link" href="bind.html#bind.implementation" title="Implementation">Implementation</a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.implementation.files"></a><a class="link" href="bind.html#bind.implementation.files" title="Files">Files</a>
+</h3></div></div></div>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <a href="../../../../boost/bind.hpp" target="_top">boost/bind.hpp</a> (main
+ header)
+ </li>
+<li class="listitem">
+ <a href="../../../../boost/bind/bind_cc.hpp" target="_top">boost/bind/bind_cc.hpp</a>
+ (used by <code class="computeroutput"><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span></code>, do not include directly)
+ </li>
+<li class="listitem">
+ <a href="../../../../boost/bind/bind_mf_cc.hpp" target="_top">boost/bind/bind_mf_cc.hpp</a>
+ (used by <code class="computeroutput"><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span></code>, do not include directly)
+ </li>
+<li class="listitem">
+ <a href="../../../../boost/bind/bind_template.hpp" target="_top">boost/bind/bind_template.hpp</a>
+ (used by <code class="computeroutput"><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span></code>, do not include directly)
+ </li>
+<li class="listitem">
+ <a href="../../../../boost/bind/arg.hpp" target="_top">boost/bind/arg.hpp</a>
+ (defines the type of the placeholder arguments)
+ </li>
+<li class="listitem">
+ <a href="../../../../boost/bind/placeholders.hpp" target="_top">boost/bind/placeholders.hpp</a>
+ (defines the <code class="computeroutput"><span class="identifier">_1</span></code>, <code class="computeroutput"><span class="identifier">_2</span></code>, ... <code class="computeroutput"><span class="identifier">_9</span></code>
+ placeholders)
+ </li>
+<li class="listitem">
+ <a href="../../../../boost/bind/apply.hpp" target="_top">boost/bind/apply.hpp</a>
+ (<code class="computeroutput"><span class="identifier">apply</span></code> helper function
+ object)
+ </li>
+<li class="listitem">
+ <a href="../../../../boost/bind/protect.hpp" target="_top">boost/bind/protect.hpp</a>
+ (<code class="computeroutput"><span class="identifier">protect</span></code> helper function)
+ </li>
+<li class="listitem">
+ <a href="../../../../boost/bind/make_adaptable.hpp" target="_top">boost/bind/make_adaptable.hpp</a>
+ (<code class="computeroutput"><span class="identifier">make_adaptable</span></code> helper
+ function)
+ </li>
+<li class="listitem">
+ <a href="../../test/bind_test.cpp" target="_top">libs/bind/test/bind_test.cpp</a>
+ (test)
+ </li>
+<li class="listitem">
+ <a href="../../bind_as_compose.cpp" target="_top">libs/bind/bind_as_compose.cpp</a>
+ (function composition example)
+ </li>
+<li class="listitem">
+ <a href="../../bind_visitor.cpp" target="_top">libs/bind/bind_visitor.cpp</a>
+ (visitor example)
+ </li>
+<li class="listitem">
+ <a href="../../test/bind_stdcall_test.cpp" target="_top">libs/bind/test/bind_stdcall_test.cpp</a>
+ (test with <code class="computeroutput"><span class="identifier">__stdcall</span></code>
+ functions)
+ </li>
+<li class="listitem">
+ <a href="../../test/bind_stdcall_mf_test.cpp" target="_top">libs/bind/test/bind_stdcall_mf_test.cpp</a>
+ (test with <code class="computeroutput"><span class="identifier">__stdcall</span></code>
+ member functions)
+ </li>
+<li class="listitem">
+ <a href="../../test/bind_fastcall_test.cpp" target="_top">libs/bind/test/bind_fastcall_test.</a>
+ (test with <code class="computeroutput"><span class="identifier">__fastcall</span></code>
+ functions)
+ </li>
+<li class="listitem">
+ <a href="../../test/bind_fastcall_mf_test.cpp" target="_top">libs/bind/test/bind_fastcall_mf_test.cpp</a>
+ (test with <code class="computeroutput"><span class="identifier">__fastcall</span></code>
+ member functions)
+ </li>
+</ul></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.implementation.dependencies"></a><a class="link" href="bind.html#bind.implementation.dependencies" title="Dependencies">Dependencies</a>
+</h3></div></div></div>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <a href="../../../../libs/config/config.htm" target="_top">Boost.Config</a>
+ </li>
+<li class="listitem">
+ <a href="../../../../libs/core/doc/html/core/ref.html" target="_top">boost/ref.hpp</a>
+ </li>
+<li class="listitem">
+ <a href="../../../../libs/bind/mem_fn.html" target="_top">boost/mem_fn.hpp</a>
+ </li>
+<li class="listitem">
+ <a href="../../../../boost/type.hpp" target="_top">boost/type.hpp</a>
+ </li>
+</ul></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.implementation.number_of_arguments"></a><a class="link" href="bind.html#bind.implementation.number_of_arguments" title="Number of Arguments">Number of Arguments</a>
+</h3></div></div></div>
+<p>
+ This implementation supports function objects with up to nine arguments.
+ This is an implementation detail, not an inherent limitation of the design.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.implementation.stdcall"></a><a class="link" href="bind.html#bind.implementation.stdcall" title="__stdcall, __cdecl, __fastcall, and pascal Support"><code class="computeroutput"><span class="identifier">__stdcall</span></code>,
+ <code class="computeroutput"><span class="identifier">__cdecl</span></code>, <code class="computeroutput"><span class="identifier">__fastcall</span></code>,
+ and <code class="computeroutput"><span class="identifier">pascal</span></code> Support</a>
+</h3></div></div></div>
+<p>
+ Some platforms allow several types of (member) functions that differ by their
+ calling convention (the rules by which the function is invoked: how are arguments
+ passed, how is the return value handled, and who cleans up the stack - if
+ any.)
+ </p>
+<p>
+ For example, Windows API functions and COM interface member functions use
+ a calling convention known as <code class="computeroutput"><span class="identifier">__stdcall</span></code>.
+ Borland VCL components use <code class="computeroutput"><span class="identifier">__fastcall</span></code>.
+ Mac toolbox functions use a <code class="computeroutput"><span class="identifier">pascal</span></code>
+ calling convention.
+ </p>
+<p>
+ To use <code class="computeroutput"><span class="identifier">bind</span></code> with <code class="computeroutput"><span class="identifier">__stdcall</span></code> functions, <code class="computeroutput"><span class="preprocessor">#define</span></code>
+ the macro <code class="computeroutput"><span class="identifier">BOOST_BIND_ENABLE_STDCALL</span></code>
+ before including <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>.
+ </p>
+<p>
+ To use <code class="computeroutput"><span class="identifier">bind</span></code> with <code class="computeroutput"><span class="identifier">__stdcall</span></code> member functions, <code class="computeroutput"><span class="preprocessor">#define</span></code> the macro <code class="computeroutput"><span class="identifier">BOOST_MEM_FN_ENABLE_STDCALL</span></code>
+ before including <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>.
+ </p>
+<p>
+ To use <code class="computeroutput"><span class="identifier">bind</span></code> with <code class="computeroutput"><span class="identifier">__fastcall</span></code> functions, <code class="computeroutput"><span class="preprocessor">#define</span></code>
+ the macro <code class="computeroutput"><span class="identifier">BOOST_BIND_ENABLE_FASTCALL</span></code>
+ before including <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>.
+ </p>
+<p>
+ To use <code class="computeroutput"><span class="identifier">bind</span></code> with <code class="computeroutput"><span class="identifier">__fastcall</span></code> member functions, <code class="computeroutput"><span class="preprocessor">#define</span></code> the macro <code class="computeroutput"><span class="identifier">BOOST_MEM_FN_ENABLE_FASTCALL</span></code>
+ before including <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>.
+ </p>
+<p>
+ To use <code class="computeroutput"><span class="identifier">bind</span></code> with <code class="computeroutput"><span class="identifier">pascal</span></code> functions, <code class="computeroutput"><span class="preprocessor">#define</span></code>
+ the macro <code class="computeroutput"><span class="identifier">BOOST_BIND_ENABLE_PASCAL</span></code>
+ before including <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>.
+ </p>
+<p>
+ To use <code class="computeroutput"><span class="identifier">bind</span></code> with <code class="computeroutput"><span class="identifier">__cdecl</span></code> member functions, <code class="computeroutput"><span class="preprocessor">#define</span></code> the macro <code class="computeroutput"><span class="identifier">BOOST_MEM_FN_ENABLE_CDECL</span></code>
+ before including <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>It is best to define these macros in the project options,
+ via <code class="computeroutput"><span class="special">-</span><span class="identifier">D</span></code>
+ on the command line, or as the first line in the translation unit (.cpp file)
+ where <code class="computeroutput"><span class="identifier">bind</span></code> is used.</strong></span>
+ Not following this rule can lead to obscure errors when a header includes
+ <code class="computeroutput"><span class="identifier">bind</span><span class="special">.</span><span class="identifier">hpp</span></code> before the macro has been defined.
+ </p>
+<p>
+ <span class="emphasis"><em>[Note:</em></span> this is a non-portable extension. It is not part
+ of the interface.<span class="emphasis"><em>]</em></span>
+ </p>
+<p>
+ <span class="emphasis"><em>[Note:</em></span> Some compilers provide only minimal support for
+ the <code class="computeroutput"><span class="identifier">__stdcall</span></code> keyword.<span class="emphasis"><em>]</em></span>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="bind.implementation.visit_each_support"></a><a class="link" href="bind.html#bind.implementation.visit_each_support" title="visit_each support"><code class="computeroutput"><span class="identifier">visit_each</span></code> support</a>
+</h3></div></div></div>
+<p>
+ Function objects returned by <code class="computeroutput"><span class="identifier">bind</span></code>
+ support the experimental and undocumented, as of yet, <code class="computeroutput"><span class="identifier">visit_each</span></code>
+ enumeration interface.
+ </p>
+<p>
+ See <a href="../../bind_visitor.cpp" target="_top">bind_visitor.cpp</a> for an example.
+ </p>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="bind.acknowledgements"></a><a class="link" href="bind.html#bind.acknowledgements" title="Acknowledgements">Acknowledgements</a>
+</h2></div></div></div>
+<p>
+ Earlier efforts that have influenced the library design:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ The <a href="http://staff.cs.utu.fi/BL/" target="_top">Binder Library</a> by Jaakko
+ Järvi;
+ </li>
+<li class="listitem">
+ The <a href="../../../../libs/lambda/index.html" target="_top">Lambda Library</a> (now
+ part of Boost) by Jaakko Järvi and Gary Powell (the successor to the
+ Binder Library);
+ </li>
+<li class="listitem">
+ <a href="http://more.sourceforge.net/" target="_top">Extensions to the STL</a>
+ by Petter Urkedal.
+ </li>
+</ul></div>
+<p>
+ Doug Gregor suggested that a visitor mechanism would allow <code class="computeroutput"><span class="identifier">bind</span></code>
+ to interoperate with a signal/slot library.
+ </p>
+<p>
+ John Maddock fixed a MSVC-specific conflict between <code class="computeroutput"><span class="identifier">bind</span></code>
+ and the <a href="../../../../libs/type_traits/index.html" target="_top">type traits library</a>.
+ </p>
+<p>
+ Numerous improvements were suggested during the formal review period by Ross
+ Smith, Richard Crossley, Jens Maurer, Ed Brey, and others. Review manager was
+ Darin Adler.
+ </p>
+<p>
+ The precise semantics of <code class="computeroutput"><span class="identifier">bind</span></code>
+ were refined in discussions with Jaakko Järvi.
+ </p>
+<p>
+ Dave Abrahams fixed a MSVC-specific conflict between <code class="computeroutput"><span class="identifier">bind</span></code>
+ and the <a href="../../../../libs/utility/iterator_adaptors.htm" target="_top">iterator adaptors
+ library</a>.
+ </p>
+<p>
+ Dave Abrahams modified <code class="computeroutput"><span class="identifier">bind</span></code>
+ and <code class="computeroutput"><span class="identifier">mem_fn</span></code> to support <code class="computeroutput"><span class="keyword">void</span></code> returns on deficient compilers.
+ </p>
+<p>
+ Mac Murrett contributed the "pascal" support enabled by <code class="computeroutput"><span class="identifier">BOOST_BIND_ENABLE_PASCAL</span></code>.
+ </p>
+<p>
+ The alternative <code class="computeroutput"><span class="identifier">bind</span><span class="special">(</span><span class="identifier">type</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(),</span> <span class="identifier">f</span><span class="special">,</span> <span class="special">...)</span></code>
+ syntax was inspired by a discussion with Dave Abrahams and Joel de Guzman.
+ </p>
+<p>
+ This documentation was ported to Quickbook by Agustín Bergé.
+ </p>
+</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: July 07, 2017 at 11:19:28 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/doc/html/mem_fn.html b/doc/html/mem_fn.html
new file mode 100644
index 0000000..528bfcf
--- /dev/null
+++ b/doc/html/mem_fn.html
@@ -0,0 +1,552 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Chapter 1. Boost.Member Function</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="mem_fn.html" title="Chapter 1. Boost.Member 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"></div>
+<div class="chapter">
+<div class="titlepage"><div>
+<div><h2 class="title">
+<a name="mem_fn"></a>Chapter 1. Boost.Member Function</h2></div>
+<div><p class="copyright">Copyright © 2001, 2002 Peter Dimov and Multi Media Ltd.</p></div>
+<div><p class="copyright">Copyright © 2003-2005 Peter Dimov</p></div>
+<div><div class="legalnotice">
+<a name="mem_fn.legal"></a><p>
+ Distributed under the <a href="http://boost.org/LICENSE_1_0.txt" target="_top">Boost
+ Software License, Version 1.0</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="mem_fn.html#mem_fn.purpose">Purpose</a></span></dt>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.faq">Frequently Asked Questions</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.faq.can_mem_fn_be_used_instead_of_th">Can <code class="computeroutput"><span class="identifier">mem_fn</span></code> be used instead of the standard <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">mem_fun</span><span class="special">[</span><span class="identifier">_ref</span><span class="special">]</span></code>
+ adaptors?</a></span></dt>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.faq.should_i_replace_every_occurence">Should I
+ replace every occurence of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">mem_fun</span><span class="special">[</span><span class="identifier">_ref</span><span class="special">]</span></code>
+ with <code class="computeroutput"><span class="identifier">mem_fn</span></code> in my existing
+ code?</a></span></dt>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.faq.does_mem_fn_work_with_com_method">Does <code class="computeroutput"><span class="identifier">mem_fn</span></code> work with COM methods?</a></span></dt>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.faq.why_isn_t_boost_mem_fn_enable_st">Why isn't
+ <code class="computeroutput"><span class="identifier">BOOST_MEM_FN_ENABLE_STDCALL</span></code>
+ defined automatically?</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.interface">Interface</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.interface.synopsys">Synopsis</a></span></dt>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.interface.common_requirements">Common requirements</a></span></dt>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.interface.get_pointer"><code class="computeroutput"><span class="identifier">get_pointer</span></code></a></span></dt>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.interface.mem_fn"><code class="computeroutput"><span class="identifier">mem_fn</span></code></a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.implementation">Implementation</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.implementation.files">Files</a></span></dt>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.implementation.dependencies">Dependencies</a></span></dt>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.implementation.number_of_arguments">Number of
+ Arguments</a></span></dt>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.implementation.stdcall"><code class="computeroutput"><span class="identifier">__stdcall</span></code>,
+ <code class="computeroutput"><span class="identifier">__cdecl</span></code>, and <code class="computeroutput"><span class="identifier">__fastcall</span></code> Support</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="mem_fn.html#mem_fn.acknowledgements">Acknowledgements</a></span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mem_fn.purpose"></a><a class="link" href="mem_fn.html#mem_fn.purpose" title="Purpose">Purpose</a>
+</h2></div></div></div>
+<p>
+ <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span></code> is a generalization of the standard
+ functions <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">mem_fun</span></code> and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">mem_fun_ref</span></code>.
+ It supports member function pointers with more than one argument, and the returned
+ function object can take a pointer, a reference, or a smart pointer to an object
+ instance as its first argument. <code class="computeroutput"><span class="identifier">mem_fn</span></code>
+ also supports pointers to data members by treating them as functions taking
+ no arguments and returning a (const) reference to the member.
+ </p>
+<p>
+ The purpose of <code class="computeroutput"><span class="identifier">mem_fn</span></code> is twofold.
+ First, it allows users to invoke a member function on a container with the
+ familiar
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span><span class="special">(&</span><span class="identifier">Shape</span><span class="special">::</span><span class="identifier">draw</span><span class="special">));</span>
+</pre>
+<p>
+ syntax, even when the container stores smart pointers.
+ </p>
+<p>
+ Second, it can be used as a building block by library developers that want
+ to treat a pointer to member function as a function object. A library might
+ define an enhanced <code class="computeroutput"><span class="identifier">for_each</span></code>
+ algorithm with an overload of the form:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">It</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">void</span> <span class="identifier">for_each</span><span class="special">(</span><span class="identifier">It</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">It</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">())</span>
+<span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span><span class="special">(</span><span class="identifier">pmf</span><span class="special">));</span>
+<span class="special">}</span>
+</pre>
+<p>
+ that will allow the convenient syntax:
+ </p>
+<pre class="programlisting"><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="special">&</span><span class="identifier">Shape</span><span class="special">::</span><span class="identifier">draw</span><span class="special">);</span>
+</pre>
+<p>
+ When documenting the feature, the library author will simply state:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">It</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">void</span> <span class="identifier">for_each</span><span class="special">(</span><span class="identifier">It</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">It</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">());</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
+ <span class="emphasis"><em>Effects:</em></span> Equivalent to <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span><span class="special">(</span><span class="identifier">pmf</span><span class="special">))</span></code>.
+ </li></ul></div>
+<p>
+ where <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span></code> can be a link to this page. See the
+ <a href="../../../../libs/bind/bind.html" target="_top">documentation of <code class="computeroutput"><span class="identifier">bind</span></code></a>
+ for an example.
+ </p>
+<p>
+ <code class="computeroutput"><span class="identifier">mem_fn</span></code> takes one argument,
+ a pointer to a member, and returns a function object suitable for use with
+ standard or user-defined algorithms:
+ </p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">X</span>
+<span class="special">{</span>
+ <span class="keyword">void</span> <span class="identifier">f</span><span class="special">();</span>
+<span class="special">};</span>
+
+<span class="keyword">void</span> <span class="identifier">g</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">X</span><span class="special">></span> <span class="special">&</span> <span class="identifier">v</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">));</span>
+<span class="special">};</span>
+
+<span class="keyword">void</span> <span class="identifier">h</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">X</span> <span class="special">*></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">v</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">));</span>
+<span class="special">};</span>
+
+<span class="keyword">void</span> <span class="identifier">k</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span><span class="special"><</span><span class="identifier">X</span><span class="special">></span> <span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">v</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mem_fn</span><span class="special">(&</span><span class="identifier">X</span><span class="special">::</span><span class="identifier">f</span><span class="special">));</span>
+<span class="special">};</span>
+</pre>
+<p>
+ The returned function object takes the same arguments as the input member function
+ plus a "flexible" first argument that represents the object instance.
+ </p>
+<p>
+ When the function object is invoked with a first argument <code class="computeroutput"><span class="identifier">x</span></code>
+ that is neither a pointer nor a reference to the appropriate class (<code class="computeroutput"><span class="identifier">X</span></code> in the example above), it uses <code class="computeroutput"><span class="identifier">get_pointer</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span></code> to obtain
+ a pointer from <code class="computeroutput"><span class="identifier">x</span></code>. Library authors
+ can "register" their smart pointer classes by supplying an appropriate
+ <code class="computeroutput"><span class="identifier">get_pointer</span></code> overload, allowing
+ <code class="computeroutput"><span class="identifier">mem_fn</span></code> to recognize and support
+ them.
+ </p>
+<p>
+ <span class="emphasis"><em>[Note:</em></span> <code class="computeroutput"><span class="identifier">get_pointer</span></code>
+ is not restricted to return a pointer. Any object that can be used in a member
+ function call expression <code class="computeroutput"><span class="special">(</span><span class="identifier">x</span><span class="special">->*</span><span class="identifier">pmf</span><span class="special">)(...)</span></code> will work.<span class="emphasis"><em>]</em></span>
+ </p>
+<p>
+ <span class="emphasis"><em>[Note:</em></span> the library uses an unqualified call to <code class="computeroutput"><span class="identifier">get_pointer</span></code>. Therefore, it will find, through
+ argument-dependent lookup, <code class="computeroutput"><span class="identifier">get_pointer</span></code>
+ overloads that are defined in the same namespace as the corresponding smart
+ pointer class, in addition to any <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">get_pointer</span></code>
+ overloads.<span class="emphasis"><em>]</em></span>
+ </p>
+<p>
+ All function objects returned by <code class="computeroutput"><span class="identifier">mem_fn</span></code>
+ expose a <code class="computeroutput"><span class="identifier">result_type</span></code> typedef
+ that represents the return type of the member function. For data members,
+ <code class="computeroutput"><span class="identifier">result_type</span></code> is defined as the
+ type of the member.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mem_fn.faq"></a><a class="link" href="mem_fn.html#mem_fn.faq" title="Frequently Asked Questions">Frequently Asked Questions</a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mem_fn.faq.can_mem_fn_be_used_instead_of_th"></a><a class="link" href="mem_fn.html#mem_fn.faq.can_mem_fn_be_used_instead_of_th" title="Can mem_fn be used instead of the standard std::mem_fun[_ref] adaptors?">Can <code class="computeroutput"><span class="identifier">mem_fn</span></code> be used instead of the standard <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">mem_fun</span><span class="special">[</span><span class="identifier">_ref</span><span class="special">]</span></code>
+ adaptors?</a>
+</h3></div></div></div>
+<p>
+ Yes. For simple uses, <code class="computeroutput"><span class="identifier">mem_fn</span></code>
+ provides additional functionality that the standard adaptors do not. Complicated
+ expressions that use <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bind1st</span></code>,
+ <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">bind2nd</span></code> or <a href="http://www.boost.org/doc/libs/1_31_0/libs/compose/index.htm" target="_top">Boost.Compose</a>
+ along with the standard adaptors can be rewritten using <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span></code>
+ that automatically takes advantage of <code class="computeroutput"><span class="identifier">mem_fn</span></code>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mem_fn.faq.should_i_replace_every_occurence"></a><a class="link" href="mem_fn.html#mem_fn.faq.should_i_replace_every_occurence" title="Should I replace every occurence of std::mem_fun[_ref] with mem_fn in my existing code?">Should I
+ replace every occurence of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">mem_fun</span><span class="special">[</span><span class="identifier">_ref</span><span class="special">]</span></code>
+ with <code class="computeroutput"><span class="identifier">mem_fn</span></code> in my existing
+ code?</a>
+</h3></div></div></div>
+<p>
+ No, unless you have good reasons to do so. <code class="computeroutput"><span class="identifier">mem_fn</span></code>
+ is not 100% compatible with the standard adaptors, although it comes pretty
+ close. In particular, <code class="computeroutput"><span class="identifier">mem_fn</span></code>
+ does not return objects of type <code class="computeroutput"><span class="identifier">std</span><span class="special">::[</span><span class="identifier">const_</span><span class="special">]</span><span class="identifier">mem_fun</span><span class="special">[</span><span class="number">1</span><span class="special">][</span><span class="identifier">_ref</span><span class="special">]</span><span class="identifier">_t</span></code>,
+ as the standard adaptors do, and it is not possible to fully describe the
+ type of the first argument using the standard <code class="computeroutput"><span class="identifier">argument_type</span></code>
+ and <code class="computeroutput"><span class="identifier">first_argument_type</span></code> nested
+ typedefs. Libraries that need adaptable function objects in order to function
+ might not like <code class="computeroutput"><span class="identifier">mem_fn</span></code>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mem_fn.faq.does_mem_fn_work_with_com_method"></a><a class="link" href="mem_fn.html#mem_fn.faq.does_mem_fn_work_with_com_method" title="Does mem_fn work with COM methods?">Does <code class="computeroutput"><span class="identifier">mem_fn</span></code> work with COM methods?</a>
+</h3></div></div></div>
+<p>
+ Yes, if you <a class="link" href="mem_fn.html#mem_fn.implementation.stdcall" title="__stdcall, __cdecl, and __fastcall Support">`#define BOOST_MEM_FN_ENABLE_STDCALL</a>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mem_fn.faq.why_isn_t_boost_mem_fn_enable_st"></a><a class="link" href="mem_fn.html#mem_fn.faq.why_isn_t_boost_mem_fn_enable_st" title="Why isn't BOOST_MEM_FN_ENABLE_STDCALL defined automatically?">Why isn't
+ <code class="computeroutput"><span class="identifier">BOOST_MEM_FN_ENABLE_STDCALL</span></code>
+ defined automatically?</a>
+</h3></div></div></div>
+<p>
+ Non-portable extensions, in general, should default to off to prevent vendor
+ lock-in. Had <code class="computeroutput"><span class="identifier">BOOST_MEM_FN_ENABLE_STDCALL</span></code>
+ been defined automatically, you could have accidentally taken advantage of
+ it without realizing that your code is, perhaps, no longer portable. In addition,
+ it is possible for the default calling convention to be <code class="computeroutput"><span class="identifier">__stdcall</span></code>,
+ in which case enabling <code class="computeroutput"><span class="identifier">__stdcall</span></code>
+ support will result in duplicate definitions.
+ </p>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mem_fn.interface"></a><a class="link" href="mem_fn.html#mem_fn.interface" title="Interface">Interface</a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mem_fn.interface.synopsys"></a><a class="link" href="mem_fn.html#mem_fn.interface.synopsys" title="Synopsis">Synopsis</a>
+</h3></div></div></div>
+<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"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="identifier">T</span> <span class="special">*</span> <a class="link" href="mem_fn.html#get_pointer_1"><code class="computeroutput"><span class="identifier">get_pointer</span></code></a><span class="special">(</span><span class="identifier">T</span> <span class="special">*</span> <span class="identifier">p</span><span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="emphasis"><em>unspecified-1</em></span> <a class="link" href="mem_fn.html#mem_fn_1"><code class="computeroutput"><span class="identifier">mem_fn</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">());</span>
+
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="emphasis"><em>unspecified-2</em></span> <a class="link" href="mem_fn.html#mem_fn_2"><code class="computeroutput"><span class="identifier">mem_fn</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">()</span> <span class="keyword">const</span><span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="emphasis"><em>unspecified-2-1</em></span> <a class="link" href="mem_fn.html#mem_fn_2_1"><code class="computeroutput"><span class="identifier">mem_fn</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="identifier">T</span><span class="special">::*</span><span class="identifier">pm</span><span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-3</em></span> <a class="link" href="mem_fn.html#mem_fn_3"><code class="computeroutput"><span class="identifier">mem_fn</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">(</span><span class="identifier">A1</span><span class="special">));</span>
+
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-4</em></span> <a class="link" href="mem_fn.html#mem_fn_4"><code class="computeroutput"><span class="identifier">mem_fn</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">(</span><span class="identifier">A1</span><span class="special">)</span> <span class="keyword">const</span><span class="special">);</span>
+
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-5</em></span> <a class="link" href="mem_fn.html#mem_fn_5"><code class="computeroutput"><span class="identifier">mem_fn</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">(</span><span class="identifier">A1</span><span class="special">,</span> <span class="identifier">A2</span><span class="special">));</span>
+
+ <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-6</em></span> <a class="link" href="mem_fn.html#mem_fn_6"><code class="computeroutput"><span class="identifier">mem_fn</span></code></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">(</span><span class="identifier">A1</span><span class="special">,</span> <span class="identifier">A2</span><span class="special">)</span> <span class="keyword">const</span><span class="special">);</span>
+
+ <span class="comment">// implementation defined number of additional overloads for more arguments</span>
+<span class="special">}</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mem_fn.interface.common_requirements"></a><a class="link" href="mem_fn.html#mem_fn.interface.common_requirements" title="Common requirements">Common requirements</a>
+</h3></div></div></div>
+<p>
+ All <span class="emphasis"><em>unspecified-N</em></span> types mentioned in the Synopsis are
+ <span class="emphasis"><em>CopyConstructible</em></span> and <span class="emphasis"><em>Assignable</em></span>.
+ Their copy constructors and assignment operators do not throw exceptions.
+ <span class="emphasis"><em>unspecified-N</em></span><code class="computeroutput"><span class="special">::</span><span class="identifier">result_type</span></code> is defined as the return type
+ of the member function pointer passed as an argument to <code class="computeroutput"><span class="identifier">mem_fn</span></code>
+ (<code class="computeroutput"><span class="identifier">R</span></code> in the Synopsis.) <span class="emphasis"><em>unspecified-2-1</em></span><code class="computeroutput"><span class="special">::</span><span class="identifier">result_type</span></code>
+ is defined as <code class="computeroutput"><span class="identifier">R</span></code>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mem_fn.interface.get_pointer"></a><a class="link" href="mem_fn.html#mem_fn.interface.get_pointer" title="get_pointer"><code class="computeroutput"><span class="identifier">get_pointer</span></code></a>
+</h3></div></div></div>
+<a name="get_pointer_1"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="identifier">T</span> <span class="special">*</span> <span class="identifier">get_pointer</span><span class="special">(</span><span class="identifier">T</span> <span class="special">*</span> <span class="identifier">p</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> <code class="computeroutput"><span class="identifier">p</span></code>.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing.
+ </li>
+</ul></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mem_fn.interface.mem_fn"></a><a class="link" href="mem_fn.html#mem_fn.interface.mem_fn" title="mem_fn"><code class="computeroutput"><span class="identifier">mem_fn</span></code></a>
+</h3></div></div></div>
+<a name="mem_fn_1"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="emphasis"><em>unspecified-1</em></span> <span class="identifier">mem_fn</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">())</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> a function object ϝ such that the
+ expression ϝ<code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code> is equivalent to <code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">.*</span><span class="identifier">pmf</span><span class="special">)()</span></code>
+ when <code class="computeroutput"><span class="identifier">t</span></code> is an l-value
+ of type <code class="computeroutput"><span class="identifier">T</span></code> or derived,
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">get_pointer</span><span class="special">(</span><span class="identifier">t</span><span class="special">)->*</span><span class="identifier">pmf</span><span class="special">)()</span></code> otherwise.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing.
+ </li>
+</ul></div>
+<a name="mem_fn_2"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="emphasis"><em>unspecified-2</em></span> <span class="identifier">mem_fn</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">()</span> <span class="keyword">const</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> a function object ϝ such that the
+ expression ϝ<code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code> is equivalent to <code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">.*</span><span class="identifier">pmf</span><span class="special">)()</span></code>
+ when <code class="computeroutput"><span class="identifier">t</span></code> is of type <code class="computeroutput"><span class="identifier">T</span></code> <span class="emphasis"><em>[</em></span><code class="computeroutput"><span class="keyword">const</span></code><span class="emphasis"><em>]</em></span> or derived,
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">get_pointer</span><span class="special">(</span><span class="identifier">t</span><span class="special">)->*</span><span class="identifier">pmf</span><span class="special">)()</span></code> otherwise.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing.
+ </li>
+</ul></div>
+<a name="mem_fn_2_1"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="emphasis"><em>unspecified-2-1</em></span> <span class="identifier">mem_fn</span><span class="special">(</span><span class="identifier">R</span> <span class="identifier">T</span><span class="special">::*</span><span class="identifier">pm</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> a function object ϝ such that the
+ expression ϝ<code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code> is equivalent to <code class="computeroutput"><span class="identifier">t</span><span class="special">.*</span><span class="identifier">pm</span></code>
+ when <code class="computeroutput"><span class="identifier">t</span></code> is of type <code class="computeroutput"><span class="identifier">T</span></code> <span class="emphasis"><em>[</em></span><code class="computeroutput"><span class="keyword">const</span></code><span class="emphasis"><em>]</em></span> or derived,
+ <code class="computeroutput"><span class="identifier">get_pointer</span><span class="special">(</span><span class="identifier">t</span><span class="special">)->*</span><span class="identifier">pm</span></code> otherwise.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing.
+ </li>
+</ul></div>
+<a name="mem_fn_3"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-3</em></span> <span class="identifier">mem_fn</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">(</span><span class="identifier">A1</span><span class="special">))</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> a function object ϝ such that the
+ expression ϝ<code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">)</span></code> is equivalent to <code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">.*</span><span class="identifier">pmf</span><span class="special">)(</span><span class="identifier">a1</span><span class="special">)</span></code>
+ when <code class="computeroutput"><span class="identifier">t</span></code> is an l-value
+ of type <code class="computeroutput"><span class="identifier">T</span></code> or derived,
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">get_pointer</span><span class="special">(</span><span class="identifier">t</span><span class="special">)->*</span><span class="identifier">pmf</span><span class="special">)(</span><span class="identifier">a1</span><span class="special">)</span></code> otherwise.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing.
+ </li>
+</ul></div>
+<a name="mem_fn_4"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">></span> <span class="emphasis"><em>unspecified-4</em></span> <span class="identifier">mem_fn</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">(</span><span class="identifier">A1</span><span class="special">)</span> <span class="keyword">const</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> a function object ϝ such that the
+ expression ϝ<code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">)</span></code> is equivalent to <code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">.*</span><span class="identifier">pmf</span><span class="special">)(</span><span class="identifier">a1</span><span class="special">)</span></code>
+ when <code class="computeroutput"><span class="identifier">t</span></code> is of type <code class="computeroutput"><span class="identifier">T</span></code> <span class="emphasis"><em>[</em></span><code class="computeroutput"><span class="keyword">const</span></code><span class="emphasis"><em>]</em></span> or derived,
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">get_pointer</span><span class="special">(</span><span class="identifier">t</span><span class="special">)->*</span><span class="identifier">pmf</span><span class="special">)(</span><span class="identifier">a1</span><span class="special">)</span></code> otherwise.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing.
+ </li>
+</ul></div>
+<a name="mem_fn_5"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-5</em></span> <span class="identifier">mem_fn</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">(</span><span class="identifier">A1</span><span class="special">,</span> <span class="identifier">A2</span><span class="special">))</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> a function object ϝ such that the
+ expression ϝ<code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">)</span></code> is equivalent to <code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">.*</span><span class="identifier">pmf</span><span class="special">)(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">)</span></code>
+ when <code class="computeroutput"><span class="identifier">t</span></code> is an l-value
+ of type <code class="computeroutput"><span class="identifier">T</span></code> or derived,
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">get_pointer</span><span class="special">(</span><span class="identifier">t</span><span class="special">)->*</span><span class="identifier">pmf</span><span class="special">)(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">)</span></code> otherwise.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing.
+ </li>
+</ul></div>
+<a name="mem_fn_6"></a><pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A2</span><span class="special">></span> <span class="emphasis"><em>unspecified-6</em></span> <span class="identifier">mem_fn</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="identifier">T</span><span class="special">::*</span><span class="identifier">pmf</span><span class="special">)</span> <span class="special">(</span><span class="identifier">A1</span><span class="special">,</span> <span class="identifier">A2</span><span class="special">)</span> <span class="keyword">const</span><span class="special">)</span>
+</pre>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <span class="emphasis"><em>Returns:</em></span> a function object ϝ such that the
+ expression ϝ<code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">,</span> <span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">)</span></code> is equivalent to <code class="computeroutput"><span class="special">(</span><span class="identifier">t</span><span class="special">.*</span><span class="identifier">pmf</span><span class="special">)(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">)</span></code>
+ when <code class="computeroutput"><span class="identifier">t</span></code> is of type <code class="computeroutput"><span class="identifier">T</span></code> <span class="emphasis"><em>[</em></span><code class="computeroutput"><span class="keyword">const</span></code><span class="emphasis"><em>]</em></span> or derived,
+ <code class="computeroutput"><span class="special">(</span><span class="identifier">get_pointer</span><span class="special">(</span><span class="identifier">t</span><span class="special">)->*</span><span class="identifier">pmf</span><span class="special">)(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">)</span></code> otherwise.
+ </li>
+<li class="listitem">
+ <span class="emphasis"><em>Throws:</em></span> Nothing.
+ </li>
+</ul></div>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mem_fn.implementation"></a><a class="link" href="mem_fn.html#mem_fn.implementation" title="Implementation">Implementation</a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mem_fn.implementation.files"></a><a class="link" href="mem_fn.html#mem_fn.implementation.files" title="Files">Files</a>
+</h3></div></div></div>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ <a href="../../../../boost/mem_fn.hpp" target="_top">boost/mem_fn.hpp</a> (main
+ header)
+ </li>
+<li class="listitem">
+ <a href="../../../../boost/bind/mem_fn_cc.hpp" target="_top">boost/bind/mem_fn_cc.hpp</a>
+ (used by <code class="computeroutput"><span class="identifier">mem_fn</span><span class="special">.</span><span class="identifier">hpp</span></code>, do not include directly)
+ </li>
+<li class="listitem">
+ <a href="../../../../boost/bind/mem_fn_vw.hpp" target="_top">boost/bind/mem_fn_vw.hpp</a>
+ (used by <code class="computeroutput"><span class="identifier">mem_fn</span><span class="special">.</span><span class="identifier">hpp</span></code>, do not include directly)
+ </li>
+<li class="listitem">
+ <a href="../../../../boost/bind/mem_fn_template.hpp" target="_top">boost/bind/mem_fn_template.hpp</a>
+ (used by <code class="computeroutput"><span class="identifier">mem_fn</span><span class="special">.</span><span class="identifier">hpp</span></code>, do not include directly)
+ </li>
+<li class="listitem">
+ <a href="../../test/mem_fn_test.cpp" target="_top">libs/bind/test/mem_fn_test.cpp</a>
+ (test)
+ </li>
+<li class="listitem">
+ <a href="../../test/mem_fn_derived_test.cpp" target="_top">libs/bind/test/mem_fn_derived_test.cpp</a>
+ (test with derived objects)
+ </li>
+<li class="listitem">
+ <a href="../../test/mem_fn_fastcall_test.cpp" target="_top">libs/bind/test/mem_fn_fastcall_test.cpp</a>
+ (test for <code class="computeroutput"><span class="identifier">__fastcall</span></code>)
+ </li>
+<li class="listitem">
+ <a href="../../test/mem_fn_stdcall_test.cpp" target="_top">libs/bind/test/mem_fn_stdcall_test.cpp</a>
+ (test for <code class="computeroutput"><span class="identifier">__stdcall</span></code>)
+ </li>
+<li class="listitem">
+ <a href="../../test/mem_fn_void_test.cpp" target="_top">libs/bind/test/mem_fn_void_test.cpp</a>
+ (test for <code class="computeroutput"><span class="keyword">void</span></code> returns)
+ </li>
+</ul></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mem_fn.implementation.dependencies"></a><a class="link" href="mem_fn.html#mem_fn.implementation.dependencies" title="Dependencies">Dependencies</a>
+</h3></div></div></div>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
+ <a href="../../../../libs/config/config.htm" target="_top">Boost.Config</a>
+ </li></ul></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mem_fn.implementation.number_of_arguments"></a><a class="link" href="mem_fn.html#mem_fn.implementation.number_of_arguments" title="Number of Arguments">Number of
+ Arguments</a>
+</h3></div></div></div>
+<p>
+ This implementation supports member functions with up to eight arguments.
+ This is not an inherent limitation of the design, but an implementation detail.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="mem_fn.implementation.stdcall"></a><a class="link" href="mem_fn.html#mem_fn.implementation.stdcall" title="__stdcall, __cdecl, and __fastcall Support"><code class="computeroutput"><span class="identifier">__stdcall</span></code>,
+ <code class="computeroutput"><span class="identifier">__cdecl</span></code>, and <code class="computeroutput"><span class="identifier">__fastcall</span></code> Support</a>
+</h3></div></div></div>
+<p>
+ Some platforms allow several types of member functions that differ by their
+ calling convention (the rules by which the function is invoked: how are arguments
+ passed, how is the return value handled, and who cleans up the stack - if
+ any.)
+ </p>
+<p>
+ For example, Windows API functions and COM interface member functions use
+ a calling convention known as <code class="computeroutput"><span class="identifier">__stdcall</span></code>.
+ Borland VCL components use <code class="computeroutput"><span class="identifier">__fastcall</span></code>.
+ UDK, the component model of OpenOffice.org, uses <code class="computeroutput"><span class="identifier">__cdecl</span></code>.
+ </p>
+<p>
+ To use <code class="computeroutput"><span class="identifier">mem_fn</span></code> with <code class="computeroutput"><span class="identifier">__stdcall</span></code> member functions, <code class="computeroutput"><span class="preprocessor">#define</span></code> the macro <code class="computeroutput"><span class="identifier">BOOST_MEM_FN_ENABLE_STDCALL</span></code>
+ before including <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mem_fn</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>.
+ </p>
+<p>
+ To use <code class="computeroutput"><span class="identifier">mem_fn</span></code> with <code class="computeroutput"><span class="identifier">__fastcall</span></code> member functions, <code class="computeroutput"><span class="preprocessor">#define</span></code> the macro <code class="computeroutput"><span class="identifier">BOOST_MEM_FN_ENABLE_FASTCALL</span></code>
+ before including <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mem_fn</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>.
+ </p>
+<p>
+ To use <code class="computeroutput"><span class="identifier">mem_fn</span></code> with <code class="computeroutput"><span class="identifier">__cdecl</span></code> member functions, <code class="computeroutput"><span class="preprocessor">#define</span></code> the macro <code class="computeroutput"><span class="identifier">BOOST_MEM_FN_ENABLE_CDECL</span></code>
+ before including <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">mem_fn</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>.
+ </p>
+<p>
+ <span class="bold"><strong>It is best to define these macros in the project options,
+ via <code class="computeroutput"><span class="special">-</span><span class="identifier">D</span></code>
+ on the command line, or as the first line in the translation unit (.cpp file)
+ where <code class="computeroutput"><span class="identifier">mem_fn</span></code> is used.</strong></span>
+ Not following this rule can lead to obscure errors when a header includes
+ <code class="computeroutput"><span class="identifier">mem_fn</span><span class="special">.</span><span class="identifier">hpp</span></code> before the macro has been defined.
+ </p>
+<p>
+ <span class="emphasis"><em>[Note:</em></span> this is a non-portable extension. It is not part
+ of the interface.<span class="emphasis"><em>]</em></span>
+ </p>
+<p>
+ <span class="emphasis"><em>[Note:</em></span> Some compilers provide only minimal support for
+ the <code class="computeroutput"><span class="identifier">__stdcall</span></code> keyword.<span class="emphasis"><em>]</em></span>
+ </p>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="mem_fn.acknowledgements"></a><a class="link" href="mem_fn.html#mem_fn.acknowledgements" title="Acknowledgements">Acknowledgements</a>
+</h2></div></div></div>
+<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
+<li class="listitem">
+ Rene Jager's initial suggestion of using traits classes to make <code class="computeroutput"><span class="identifier">mem_fn</span></code> adapt to user-defined smart pointers
+ inspired the <code class="computeroutput"><span class="identifier">get_pointer</span></code>-based
+ design.
+ </li>
+<li class="listitem">
+ Numerous improvements were suggested during the formal review period by
+ Richard Crossley, Jens Maurer, Ed Brey, and others. Review manager was
+ Darin Adler.
+ </li>
+<li class="listitem">
+ Steve Anichini pointed out that COM interfaces use <code class="computeroutput"><span class="identifier">__stdcall</span></code>.
+ </li>
+<li class="listitem">
+ Dave Abrahams modified <code class="computeroutput"><span class="identifier">bind</span></code>
+ and <code class="computeroutput"><span class="identifier">mem_fn</span></code> to support
+ <code class="computeroutput"><span class="keyword">void</span></code> returns on deficient
+ compilers.
+ </li>
+<li class="listitem">
+ Daniel Boelzle pointed out that UDK uses <code class="computeroutput"><span class="identifier">__cdecl</span></code>.
+ </li>
+</ul></div>
+<p>
+ This documentation was ported to Quickbook by Agustín Bergé.
+ </p>
+</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: July 07, 2017 at 11:19:31 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/doc/mem_fn.qbk b/doc/mem_fn.qbk
new file mode 100644
index 0000000..9fe88d3
--- /dev/null
+++ b/doc/mem_fn.qbk
@@ -0,0 +1,32 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2005 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)
+ /]
+
+[library Boost.Member Function
+ [quickbook 1.6]
+ [id mem_fn]
+ [copyright 2001, 2002 Peter Dimov and Multi Media Ltd.]
+ [copyright 2003-2005 Peter Dimov]
+ [dirname bind]
+ [license Distributed under the
+ [@http://boost.org/LICENSE_1_0.txt Boost Software License,
+ Version 1.0].
+ ]
+]
+
+[template simplesect[title]
+[block '''<simplesect><title>'''[title]'''</title>''']]
+
+[template endsimplesect[]
+[block '''</simplesect>''']]
+
+[include mem_fn/purpose.qbk]
+[include mem_fn/faq.qbk]
+[include mem_fn/interface.qbk]
+[include mem_fn/implementation.qbk]
+[include mem_fn/acknowledgements.qbk]
diff --git a/doc/mem_fn/acknowledgements.qbk b/doc/mem_fn/acknowledgements.qbk
new file mode 100644
index 0000000..46d2b82
--- /dev/null
+++ b/doc/mem_fn/acknowledgements.qbk
@@ -0,0 +1,28 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2005 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)
+ /]
+
+[section:acknowledgements Acknowledgements]
+
+* Rene Jager's initial suggestion of using traits classes to make `mem_fn`
+adapt to user-defined smart pointers inspired the `get_pointer`-based design.
+
+* Numerous improvements were suggested during the formal review period by
+Richard Crossley, Jens Maurer, Ed Brey, and others. Review manager was Darin
+Adler.
+
+* Steve Anichini pointed out that COM interfaces use `__stdcall`.
+
+* Dave Abrahams modified `bind` and `mem_fn` to support `void` returns on
+deficient compilers.
+
+* Daniel Boelzle pointed out that UDK uses `__cdecl`.
+
+This documentation was ported to Quickbook by Agustín Bergé.
+
+[endsect]
diff --git a/doc/mem_fn/faq.qbk b/doc/mem_fn/faq.qbk
new file mode 100644
index 0000000..169c8f1
--- /dev/null
+++ b/doc/mem_fn/faq.qbk
@@ -0,0 +1,53 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2005 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)
+ /]
+
+[section:faq Frequently Asked Questions]
+
+[section Can `mem_fn` be used instead of the standard `std::mem_fun[_ref]`
+adaptors?]
+
+Yes. For simple uses, `mem_fn` provides additional functionality that the
+standard adaptors do not. Complicated expressions that use `std::bind1st`,
+`std::bind2nd` or [@http://www.boost.org/doc/libs/1_31_0/libs/compose/index.htm Boost.Compose]
+along with the standard adaptors can be rewritten using `boost::bind` that
+automatically takes advantage of `mem_fn`.
+
+[endsect]
+
+[section Should I replace every occurence of `std::mem_fun[_ref]` with
+`mem_fn` in my existing code?]
+
+No, unless you have good reasons to do so. `mem_fn` is not 100% compatible
+with the standard adaptors, although it comes pretty close. In particular,
+`mem_fn` does not return objects of type `std::[const_]mem_fun[1][_ref]_t`, as
+the standard adaptors do, and it is not possible to fully describe the type of
+the first argument using the standard `argument_type` and `first_argument_type`
+nested typedefs. Libraries that need adaptable function objects in order to
+function might not like `mem_fn`.
+
+[endsect]
+
+[section Does `mem_fn` work with COM methods?]
+
+Yes, if you [link mem_fn.implementation.stdcall `#define BOOST_MEM_FN_ENABLE_STDCALL].
+
+[endsect]
+
+[section Why isn't `BOOST_MEM_FN_ENABLE_STDCALL` defined automatically?]
+
+Non-portable extensions, in general, should default to off to prevent vendor
+lock-in. Had `BOOST_MEM_FN_ENABLE_STDCALL` been defined automatically, you
+could have accidentally taken advantage of it without realizing that your code
+is, perhaps, no longer portable. In addition, it is possible for the default
+calling convention to be `__stdcall`, in which case enabling `__stdcall`
+support will result in duplicate definitions.
+
+[endsect]
+
+[endsect]
diff --git a/doc/mem_fn/implementation.qbk b/doc/mem_fn/implementation.qbk
new file mode 100644
index 0000000..b648c13
--- /dev/null
+++ b/doc/mem_fn/implementation.qbk
@@ -0,0 +1,70 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2005 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)
+ /]
+
+[section:implementation Implementation]
+
+[section Files]
+
+* [@../../../../boost/mem_fn.hpp boost/mem_fn.hpp] (main header)
+* [@../../../../boost/bind/mem_fn_cc.hpp boost/bind/mem_fn_cc.hpp] (used by `mem_fn.hpp`, do not include directly)
+* [@../../../../boost/bind/mem_fn_vw.hpp boost/bind/mem_fn_vw.hpp] (used by `mem_fn.hpp`, do not include directly)
+* [@../../../../boost/bind/mem_fn_template.hpp boost/bind/mem_fn_template.hpp] (used by `mem_fn.hpp`, do not include directly)
+* [@../../test/mem_fn_test.cpp libs/bind/test/mem_fn_test.cpp] (test)
+* [@../../test/mem_fn_derived_test.cpp libs/bind/test/mem_fn_derived_test.cpp] (test with derived objects)
+* [@../../test/mem_fn_fastcall_test.cpp libs/bind/test/mem_fn_fastcall_test.cpp] (test for `__fastcall`)
+* [@../../test/mem_fn_stdcall_test.cpp libs/bind/test/mem_fn_stdcall_test.cpp] (test for `__stdcall`)
+* [@../../test/mem_fn_void_test.cpp libs/bind/test/mem_fn_void_test.cpp] (test for `void` returns)
+
+[endsect]
+
+[section Dependencies]
+
+* [@boost:/libs/config/config.htm Boost.Config]
+
+[endsect]
+
+[section Number of Arguments]
+
+This implementation supports member functions with up to eight arguments. This
+is not an inherent limitation of the design, but an implementation detail.
+
+[endsect]
+
+[section:stdcall `__stdcall`, `__cdecl`, and `__fastcall` Support]
+
+Some platforms allow several types of member functions that differ by their
+calling convention (the rules by which the function is invoked: how are
+arguments passed, how is the return value handled, and who cleans up the stack
+ - if any.)
+
+For example, Windows API functions and COM interface member functions use a
+calling convention known as `__stdcall`. Borland VCL components use
+`__fastcall`. UDK, the component model of OpenOffice.org, uses `__cdecl`.
+
+To use `mem_fn` with `__stdcall` member functions, `#define` the macro
+`BOOST_MEM_FN_ENABLE_STDCALL` before including `<boost/mem_fn.hpp>`.
+
+To use `mem_fn` with `__fastcall` member functions, `#define` the macro
+`BOOST_MEM_FN_ENABLE_FASTCALL` before including `<boost/mem_fn.hpp>`.
+
+To use `mem_fn` with `__cdecl` member functions, `#define` the macro
+`BOOST_MEM_FN_ENABLE_CDECL` before including `<boost/mem_fn.hpp>`.
+
+[*It is best to define these macros in the project options, via `-D` on the
+command line, or as the first line in the translation unit (.cpp file) where
+`mem_fn` is used.] Not following this rule can lead to obscure errors when a
+header includes `mem_fn.hpp` before the macro has been defined.
+
+/[Note:/ this is a non-portable extension. It is not part of the interface./]/
+
+/[Note:/ Some compilers provide only minimal support for the `__stdcall` keyword./]/
+
+[endsect]
+
+[endsect]
diff --git a/doc/mem_fn/interface.qbk b/doc/mem_fn/interface.qbk
new file mode 100644
index 0000000..c0528a5
--- /dev/null
+++ b/doc/mem_fn/interface.qbk
@@ -0,0 +1,133 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2005 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)
+ /]
+
+[section:interface Interface]
+
+[section:synopsys Synopsis]
+
+ namespace boost
+ {
+ template<class T> T * ``[link get_pointer_1 `get_pointer`]``(T * p);
+
+ template<class R, class T> ``/unspecified-1/`` ``[link mem_fn_1 `mem_fn`]``(R (T::*pmf) ());
+
+ template<class R, class T> ``/unspecified-2/`` ``[link mem_fn_2 `mem_fn`]``(R (T::*pmf) () const);
+
+ template<class R, class T> ``/unspecified-2-1/`` ``[link mem_fn_2_1 `mem_fn`]``(R T::*pm);
+
+ template<class R, class T, class A1> ``/unspecified-3/`` ``[link mem_fn_3 `mem_fn`]``(R (T::*pmf) (A1));
+
+ template<class R, class T, class A1> ``/unspecified-4/`` ``[link mem_fn_4 `mem_fn`]``(R (T::*pmf) (A1) const);
+
+ template<class R, class T, class A1, class A2> ``/unspecified-5/`` ``[link mem_fn_5 `mem_fn`]``(R (T::*pmf) (A1, A2));
+
+ template<class R, class T, class A1, class A2> ``/unspecified-6/`` ``[link mem_fn_6 `mem_fn`]``(R (T::*pmf) (A1, A2) const);
+
+ // implementation defined number of additional overloads for more arguments
+ }
+
+[endsect]
+
+[section Common requirements]
+
+All /unspecified-N/ types mentioned in the Synopsis are /CopyConstructible/
+and /Assignable/. Their copy constructors and assignment operators do not
+throw exceptions. /unspecified-N/`::result_type` is defined as the return type
+of the member function pointer passed as an argument to `mem_fn` (`R` in the
+Synopsis.) /unspecified-2-1/`::result_type` is defined as `R`.
+
+[endsect]
+
+[section `get_pointer`]
+
+[#get_pointer_1]
+
+ template<class T> T * get_pointer(T * p)
+
+* /Returns:/ `p`.
+
+* /Throws:/ Nothing.
+
+[endsect]
+
+[section `mem_fn`]
+
+[#mem_fn_1]
+
+ template<class R, class T> ``/unspecified-1/`` mem_fn(R (T::*pmf) ())
+
+* /Returns:/ a function object \u03DD such that the expression \u03DD`(t)` is
+equivalent to `(t.*pmf)()` when `t` is an l-value of type `T` or derived,
+`(get_pointer(t)->*pmf)()` otherwise.
+
+* /Throws:/ Nothing.
+
+[#mem_fn_2]
+
+ template<class R, class T> ``/unspecified-2/`` mem_fn(R (T::*pmf) () const)
+
+* /Returns:/ a function object \u03DD such that the expression \u03DD`(t)` is
+equivalent to `(t.*pmf)()` when `t` is of type `T` /[/`const`/]/ or derived,
+`(get_pointer(t)->*pmf)()` otherwise.
+
+* /Throws:/ Nothing.
+
+[#mem_fn_2_1]
+
+ template<class R, class T> ``/unspecified-2-1/`` mem_fn(R T::*pm)
+
+* /Returns:/ a function object \u03DD such that the expression \u03DD`(t)` is
+equivalent to `t.*pm` when `t` is of type `T` /[/`const`/]/ or derived,
+`get_pointer(t)->*pm` otherwise.
+
+* /Throws:/ Nothing.
+
+[#mem_fn_3]
+
+ template<class R, class T, class A1> ``/unspecified-3/`` mem_fn(R (T::*pmf) (A1))
+
+* /Returns:/ a function object \u03DD such that the expression \u03DD`(t, a1)`
+is equivalent to `(t.*pmf)(a1)` when `t` is an l-value of type `T` or derived,
+`(get_pointer(t)->*pmf)(a1)` otherwise.
+
+* /Throws:/ Nothing.
+
+[#mem_fn_4]
+
+ template<class R, class T, class A1> ``/unspecified-4/`` mem_fn(R (T::*pmf) (A1) const)
+
+* /Returns:/ a function object \u03DD such that the expression \u03DD`(t, a1)`
+is equivalent to `(t.*pmf)(a1)` when `t` is of type `T` /[/`const`/]/ or derived,
+`(get_pointer(t)->*pmf)(a1)` otherwise.
+
+* /Throws:/ Nothing.
+
+[#mem_fn_5]
+
+ template<class R, class T, class A1, class A2> ``/unspecified-5/`` mem_fn(R (T::*pmf) (A1, A2))
+
+* /Returns:/ a function object \u03DD such that the expression \u03DD`(t, a1, a2)`
+is equivalent to `(t.*pmf)(a1, a2)` when `t` is an l-value of type `T` or derived,
+`(get_pointer(t)->*pmf)(a1, a2)` otherwise.
+
+* /Throws:/ Nothing.
+
+[#mem_fn_6]
+
+ template<class R, class T, class A1, class A2> ``/unspecified-6/`` mem_fn(R (T::*pmf) (A1, A2) const)
+
+* /Returns:/ a function object \u03DD such that the expression \u03DD`(t, a1, a2)`
+is equivalent to `(t.*pmf)(a1, a2)` when `t` is of type `T` /[/`const`/]/ or derived,
+`(get_pointer(t)->*pmf)(a1, a2)` otherwise.
+
+* /Throws:/ Nothing.
+
+[endsect]
+
+[endsect]
diff --git a/doc/mem_fn/purpose.qbk b/doc/mem_fn/purpose.qbk
new file mode 100644
index 0000000..5fc6499
--- /dev/null
+++ b/doc/mem_fn/purpose.qbk
@@ -0,0 +1,93 @@
+[/
+ / Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+ / Copyright (c) 2003-2005 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)
+ /]
+
+[section:purpose Purpose]
+
+`boost::mem_fn` is a generalization of the standard functions `std::mem_fun`
+and `std::mem_fun_ref`. It supports member function pointers with more than
+one argument, and the returned function object can take a pointer, a
+reference, or a smart pointer to an object instance as its first argument.
+`mem_fn` also supports pointers to data members by treating them as functions
+taking no arguments and returning a (const) reference to the member.
+
+The purpose of `mem_fn` is twofold. First, it allows users to invoke a member
+function on a container with the familiar
+
+ std::for_each(v.begin(), v.end(), boost::mem_fn(&Shape::draw));
+
+syntax, even when the container stores smart pointers.
+
+Second, it can be used as a building block by library developers that want to
+treat a pointer to member function as a function object. A library might
+define an enhanced `for_each` algorithm with an overload of the form:
+
+ template<class It, class R, class T> void for_each(It first, It last, R (T::*pmf) ())
+ {
+ std::for_each(first, last, boost::mem_fn(pmf));
+ }
+
+that will allow the convenient syntax:
+
+ for_each(v.begin(), v.end(), &Shape::draw);
+
+When documenting the feature, the library author will simply state:
+
+ template<class It, class R, class T> void for_each(It first, It last, R (T::*pmf) ());
+
+* /Effects:/ Equivalent to `std::for_each(first, last, boost::mem_fn(pmf))`.
+
+where `boost::mem_fn` can be a link to this page. See the
+[@boost:/libs/bind/bind.html documentation of `bind`] for an example.
+
+`mem_fn` takes one argument, a pointer to a member, and returns a function
+object suitable for use with standard or user-defined algorithms:
+
+ struct X
+ {
+ void f();
+ };
+
+ void g(std::vector<X> & v)
+ {
+ std::for_each(v.begin(), v.end(), boost::mem_fn(&X::f));
+ };
+
+ void h(std::vector<X *> const & v)
+ {
+ std::for_each(v.begin(), v.end(), boost::mem_fn(&X::f));
+ };
+
+ void k(std::vector<boost::shared_ptr<X> > const & v)
+ {
+ std::for_each(v.begin(), v.end(), boost::mem_fn(&X::f));
+ };
+
+The returned function object takes the same arguments as the input member
+function plus a "flexible" first argument that represents the object instance.
+
+When the function object is invoked with a first argument `x` that is neither
+a pointer nor a reference to the appropriate class (`X` in the example above),
+it uses `get_pointer(x)` to obtain a pointer from `x`. Library authors can
+"register" their smart pointer classes by supplying an appropriate
+`get_pointer` overload, allowing `mem_fn` to recognize and support them.
+
+
+/[Note:/ `get_pointer` is not restricted to return a pointer. Any object that
+can be used in a member function call expression `(x->*pmf)(...)` will work./]/
+
+/[Note:/ the library uses an unqualified call to `get_pointer`. Therefore, it
+will find, through argument-dependent lookup, `get_pointer` overloads that are
+defined in the same namespace as the corresponding smart pointer class, in
+addition to any `boost::get_pointer` overloads./]/
+
+All function objects returned by `mem_fn` expose a `result_type` typedef that
+represents the return type of the member function. For data members,
+`result_type` is defined as the type of the member.
+
+[endsect]
diff --git a/include/boost/bind.hpp b/include/boost/bind.hpp
new file mode 100644
index 0000000..450120c
--- /dev/null
+++ b/include/boost/bind.hpp
@@ -0,0 +1,41 @@
+#ifndef BOOST_BIND_HPP_INCLUDED
+#define BOOST_BIND_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// bind.hpp - binds function objects to arguments
+//
+// Copyright (c) 2009, 2015 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
+//
+// See http://www.boost.org/libs/bind/bind.html for documentation.
+//
+
+#include <boost/bind/bind.hpp>
+
+#ifndef BOOST_BIND_NO_PLACEHOLDERS
+
+#if defined(BOOST_CLANG)
+# pragma clang diagnostic push
+# if __has_warning("-Wheader-hygiene")
+# pragma clang diagnostic ignored "-Wheader-hygiene"
+# endif
+#endif
+
+using namespace boost::placeholders;
+
+#if defined(BOOST_CLANG)
+# pragma clang diagnostic pop
+#endif
+
+#endif // #ifndef BOOST_BIND_NO_PLACEHOLDERS
+
+#endif // #ifndef BOOST_BIND_HPP_INCLUDED
diff --git a/include/boost/bind/apply.hpp b/include/boost/bind/apply.hpp
new file mode 100644
index 0000000..6a43a89
--- /dev/null
+++ b/include/boost/bind/apply.hpp
@@ -0,0 +1,74 @@
+#ifndef BOOST_BIND_APPLY_HPP_INCLUDED
+#define BOOST_BIND_APPLY_HPP_INCLUDED
+
+//
+// apply.hpp
+//
+// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd.
+//
+// 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)
+//
+
+namespace boost
+{
+
+template<class R> struct apply
+{
+ typedef R result_type;
+
+ template<class F> result_type operator()(F & f) const
+ {
+ return f();
+ }
+
+ template<class F, class A1> result_type operator()(F & f, A1 & a1) const
+ {
+ return f(a1);
+ }
+
+ template<class F, class A1, class A2> result_type operator()(F & f, A1 & a1, A2 & a2) const
+ {
+ return f(a1, a2);
+ }
+
+ template<class F, class A1, class A2, class A3> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3) const
+ {
+ return f(a1, a2, a3);
+ }
+
+ template<class F, class A1, class A2, class A3, class A4> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4) const
+ {
+ return f(a1, a2, a3, a4);
+ }
+
+ template<class F, class A1, class A2, class A3, class A4, class A5> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const
+ {
+ return f(a1, a2, a3, a4, a5);
+ }
+
+ template<class F, class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const
+ {
+ return f(a1, a2, a3, a4, a5, a6);
+ }
+
+ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const
+ {
+ return f(a1, a2, a3, a4, a5, a6, a7);
+ }
+
+ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const
+ {
+ return f(a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const
+ {
+ return f(a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ }
+};
+
+} // namespace boost
+
+#endif // #ifndef BOOST_BIND_APPLY_HPP_INCLUDED
diff --git a/include/boost/bind/arg.hpp b/include/boost/bind/arg.hpp
new file mode 100644
index 0000000..cb52e66
--- /dev/null
+++ b/include/boost/bind/arg.hpp
@@ -0,0 +1,69 @@
+#ifndef BOOST_BIND_ARG_HPP_INCLUDED
+#define BOOST_BIND_ARG_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// bind/arg.hpp
+//
+// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+//
+// 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/bind/bind.html for documentation.
+//
+
+#include <boost/config.hpp>
+#include <boost/is_placeholder.hpp>
+
+namespace boost
+{
+
+template<bool Eq> struct _arg_eq
+{
+};
+
+template<> struct _arg_eq<true>
+{
+ typedef void type;
+};
+
+template< int I > struct arg
+{
+ BOOST_CONSTEXPR arg()
+ {
+ }
+
+ template< class T > BOOST_CONSTEXPR arg( T const & /* t */, typename _arg_eq< I == is_placeholder<T>::value >::type * = 0 )
+ {
+ }
+};
+
+template< int I > BOOST_CONSTEXPR bool operator==( arg<I> const &, arg<I> const & )
+{
+ return true;
+}
+
+#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+template< int I > struct is_placeholder< arg<I> >
+{
+ enum _vt { value = I };
+};
+
+template< int I > struct is_placeholder< arg<I> (*) () >
+{
+ enum _vt { value = I };
+};
+
+#endif
+
+} // namespace boost
+
+#endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED
diff --git a/include/boost/bind/bind.hpp b/include/boost/bind/bind.hpp
new file mode 100644
index 0000000..4cedc5e
--- /dev/null
+++ b/include/boost/bind/bind.hpp
@@ -0,0 +1,2365 @@
+#ifndef BOOST_BIND_BIND_HPP_INCLUDED
+#define BOOST_BIND_BIND_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// bind.hpp - binds function objects to arguments
+//
+// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2001 David Abrahams
+// Copyright (c) 2005 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)
+//
+// See http://www.boost.org/libs/bind/bind.html for documentation.
+//
+
+#include <boost/config.hpp>
+#include <boost/ref.hpp>
+#include <boost/mem_fn.hpp>
+#include <boost/type.hpp>
+#include <boost/is_placeholder.hpp>
+#include <boost/bind/arg.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/visit_each.hpp>
+#include <boost/core/enable_if.hpp>
+#include <boost/core/is_same.hpp>
+
+#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
+#include <utility> // std::forward
+#endif
+
+// Borland-specific bug, visit_each() silently fails to produce code
+
+#if defined(__BORLANDC__)
+# define BOOST_BIND_VISIT_EACH boost::visit_each
+#else
+# define BOOST_BIND_VISIT_EACH visit_each
+#endif
+
+#include <boost/bind/storage.hpp>
+
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable: 4512) // assignment operator could not be generated
+#endif
+
+namespace boost
+{
+
+template<class T> class weak_ptr;
+
+namespace _bi // implementation details
+{
+
+// result_traits
+
+template<class R, class F> struct result_traits
+{
+ typedef R type;
+};
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+
+struct unspecified {};
+
+template<class F> struct result_traits<unspecified, F>
+{
+ typedef typename F::result_type type;
+};
+
+template<class F> struct result_traits< unspecified, reference_wrapper<F> >
+{
+ typedef typename F::result_type type;
+};
+
+#endif
+
+// ref_compare
+
+template<class T> bool ref_compare( T const & a, T const & b, long )
+{
+ return a == b;
+}
+
+template<int I> bool ref_compare( arg<I> const &, arg<I> const &, int )
+{
+ return true;
+}
+
+template<int I> bool ref_compare( arg<I> (*) (), arg<I> (*) (), int )
+{
+ return true;
+}
+
+template<class T> bool ref_compare( reference_wrapper<T> const & a, reference_wrapper<T> const & b, int )
+{
+ return a.get_pointer() == b.get_pointer();
+}
+
+// bind_t forward declaration for listN
+
+template<class R, class F, class L> class bind_t;
+
+template<class R, class F, class L> bool ref_compare( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b, int )
+{
+ return a.compare( b );
+}
+
+// value
+
+template<class T> class value
+{
+public:
+
+ value(T const & t): t_(t) {}
+
+ T & get() { return t_; }
+ T const & get() const { return t_; }
+
+ bool operator==(value const & rhs) const
+ {
+ return t_ == rhs.t_;
+ }
+
+private:
+
+ T t_;
+};
+
+// ref_compare for weak_ptr
+
+template<class T> bool ref_compare( value< weak_ptr<T> > const & a, value< weak_ptr<T> > const & b, int )
+{
+ return !(a.get() < b.get()) && !(b.get() < a.get());
+}
+
+// type
+
+template<class T> class type {};
+
+// unwrap
+
+template<class F> struct unwrapper
+{
+ static inline F & unwrap( F & f, long )
+ {
+ return f;
+ }
+
+ template<class F2> static inline F2 & unwrap( reference_wrapper<F2> rf, int )
+ {
+ return rf.get();
+ }
+
+ template<class R, class T> static inline _mfi::dm<R, T> unwrap( R T::* pm, int )
+ {
+ return _mfi::dm<R, T>( pm );
+ }
+};
+
+// listN
+
+class list0
+{
+public:
+
+ list0() {}
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A &, long)
+ {
+ return unwrapper<F>::unwrap(f, 0)();
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A &, long) const
+ {
+ return unwrapper<F const>::unwrap(f, 0)();
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A &, int)
+ {
+ unwrapper<F>::unwrap(f, 0)();
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A &, int) const
+ {
+ unwrapper<F const>::unwrap(f, 0)();
+ }
+
+ template<class V> void accept(V &) const
+ {
+ }
+
+ bool operator==(list0 const &) const
+ {
+ return true;
+ }
+};
+
+#ifdef BOOST_MSVC
+// MSVC is bright enough to realise that the parameter rhs
+// in operator==may be unused for some template argument types:
+#pragma warning(push)
+#pragma warning(disable:4100)
+#endif
+
+template< class A1 > class list1: private storage1< A1 >
+{
+private:
+
+ typedef storage1< A1 > base_type;
+
+public:
+
+ explicit list1( A1 a1 ): base_type( a1 ) {}
+
+ A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
+
+ template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
+
+ template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ base_type::accept(v);
+ }
+
+ bool operator==(list1 const & rhs) const
+ {
+ return ref_compare(base_type::a1_, rhs.a1_, 0);
+ }
+};
+
+struct logical_and;
+struct logical_or;
+
+template< class A1, class A2 > class list2: private storage2< A1, A2 >
+{
+private:
+
+ typedef storage2< A1, A2 > base_type;
+
+public:
+
+ list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {}
+
+ A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
+ }
+
+ template<class A> bool operator()( type<bool>, logical_and & /*f*/, A & a, int )
+ {
+ return a[ base_type::a1_ ] && a[ base_type::a2_ ];
+ }
+
+ template<class A> bool operator()( type<bool>, logical_and const & /*f*/, A & a, int ) const
+ {
+ return a[ base_type::a1_ ] && a[ base_type::a2_ ];
+ }
+
+ template<class A> bool operator()( type<bool>, logical_or & /*f*/, A & a, int )
+ {
+ return a[ base_type::a1_ ] || a[ base_type::a2_ ];
+ }
+
+ template<class A> bool operator()( type<bool>, logical_or const & /*f*/, A & a, int ) const
+ {
+ return a[ base_type::a1_ ] || a[ base_type::a2_ ];
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ base_type::accept(v);
+ }
+
+ bool operator==(list2 const & rhs) const
+ {
+ return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0);
+ }
+};
+
+template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 >
+{
+private:
+
+ typedef storage3< A1, A2, A3 > base_type;
+
+public:
+
+ list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {}
+
+ A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ base_type::accept(v);
+ }
+
+ bool operator==(list3 const & rhs) const
+ {
+ return
+
+ ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
+ ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
+ ref_compare( base_type::a3_, rhs.a3_, 0 );
+ }
+};
+
+template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 >
+{
+private:
+
+ typedef storage4< A1, A2, A3, A4 > base_type;
+
+public:
+
+ list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {}
+
+ A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
+ A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
+ A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ base_type::accept(v);
+ }
+
+ bool operator==(list4 const & rhs) const
+ {
+ return
+
+ ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
+ ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
+ ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
+ ref_compare( base_type::a4_, rhs.a4_, 0 );
+ }
+};
+
+template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 >
+{
+private:
+
+ typedef storage5< A1, A2, A3, A4, A5 > base_type;
+
+public:
+
+ list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {}
+
+ A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
+ A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
+ A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
+ A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
+ A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ base_type::accept(v);
+ }
+
+ bool operator==(list5 const & rhs) const
+ {
+ return
+
+ ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
+ ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
+ ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
+ ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
+ ref_compare( base_type::a5_, rhs.a5_, 0 );
+ }
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6> class list6: private storage6< A1, A2, A3, A4, A5, A6 >
+{
+private:
+
+ typedef storage6< A1, A2, A3, A4, A5, A6 > base_type;
+
+public:
+
+ list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {}
+
+ A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
+ A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
+ A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
+ A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
+ A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
+ A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
+ A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ base_type::accept(v);
+ }
+
+ bool operator==(list6 const & rhs) const
+ {
+ return
+
+ ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
+ ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
+ ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
+ ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
+ ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
+ ref_compare( base_type::a6_, rhs.a6_, 0 );
+ }
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> class list7: private storage7< A1, A2, A3, A4, A5, A6, A7 >
+{
+private:
+
+ typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type;
+
+public:
+
+ list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {}
+
+ A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
+ A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
+ A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
+ A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
+ A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
+ A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
+ A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
+ A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
+ A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ base_type::accept(v);
+ }
+
+ bool operator==(list7 const & rhs) const
+ {
+ return
+
+ ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
+ ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
+ ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
+ ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
+ ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
+ ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
+ ref_compare( base_type::a7_, rhs.a7_, 0 );
+ }
+};
+
+template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class list8: private storage8< A1, A2, A3, A4, A5, A6, A7, A8 >
+{
+private:
+
+ typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type;
+
+public:
+
+ list8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8 ) {}
+
+ A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
+ A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
+ A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
+ A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
+ A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
+ A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
+ A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
+ A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
+ A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
+ A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
+ A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ base_type::accept(v);
+ }
+
+ bool operator==(list8 const & rhs) const
+ {
+ return
+
+ ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
+ ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
+ ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
+ ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
+ ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
+ ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
+ ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
+ ref_compare( base_type::a8_, rhs.a8_, 0 );
+ }
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> class list9: private storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 >
+{
+private:
+
+ typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type;
+
+public:
+
+ list9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) {}
+
+ A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
+ A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
+ A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
+ A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
+ A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
+ A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
+ A9 operator[] (boost::arg<9>) const { return base_type::a9_; }
+
+ A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
+ A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
+ A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
+ A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
+ A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
+ A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
+ A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
+ A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
+ A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; }
+
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
+
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
+
+ template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
+ {
+ return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]);
+ }
+
+ template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
+ {
+ return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F & f, A & a, int)
+ {
+ unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]);
+ }
+
+ template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
+ {
+ unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+ base_type::accept(v);
+ }
+
+ bool operator==(list9 const & rhs) const
+ {
+ return
+
+ ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
+ ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
+ ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
+ ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
+ ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
+ ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
+ ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
+ ref_compare( base_type::a8_, rhs.a8_, 0 ) &&
+ ref_compare( base_type::a9_, rhs.a9_, 0 );
+ }
+};
+
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+// bind_t
+
+#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
+
+template< class A1 > class rrlist1
+{
+private:
+
+ A1 & a1_; // not A1&& because of msvc-10.0
+
+public:
+
+ explicit rrlist1( A1 & a1 ): a1_( a1 ) {}
+
+ A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); } // not static_cast because of g++ 4.9
+
+ A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
+
+ template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
+
+ template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
+ {
+ rrlist1<A1&> a( a1_ );
+ return b.eval( a );
+ }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
+ {
+ rrlist1<A1&> a( a1_ );
+ return b.eval( a );
+ }
+};
+
+template< class A1, class A2 > class rrlist2
+{
+private:
+
+ A1 & a1_;
+ A2 & a2_;
+
+public:
+
+ rrlist2( A1 & a1, A2 & a2 ): a1_( a1 ), a2_( a2 ) {}
+
+ A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
+
+ A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
+
+ template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
+
+ template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
+ {
+ rrlist2<A1&, A2&> a( a1_, a2_ );
+ return b.eval( a );
+ }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
+ {
+ rrlist2<A1&, A2&> a( a1_, a2_ );
+ return b.eval( a );
+ }
+};
+
+template< class A1, class A2, class A3 > class rrlist3
+{
+private:
+
+ A1 & a1_;
+ A2 & a2_;
+ A3 & a3_;
+
+public:
+
+ rrlist3( A1 & a1, A2 & a2, A3 & a3 ): a1_( a1 ), a2_( a2 ), a3_( a3 ) {}
+
+ A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
+
+ A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
+
+ template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
+
+ template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
+ {
+ rrlist3<A1&, A2&, A3&> a( a1_, a2_, a3_ );
+ return b.eval( a );
+ }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
+ {
+ rrlist3<A1&, A2&, A3&> a( a1_, a2_, a3_ );
+ return b.eval( a );
+ }
+};
+
+template< class A1, class A2, class A3, class A4 > class rrlist4
+{
+private:
+
+ A1 & a1_;
+ A2 & a2_;
+ A3 & a3_;
+ A4 & a4_;
+
+public:
+
+ rrlist4( A1 & a1, A2 & a2, A3 & a3, A4 & a4 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ) {}
+
+ A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
+ A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
+
+ A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
+ A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
+
+ template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
+
+ template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
+ {
+ rrlist4<A1&, A2&, A3&, A4&> a( a1_, a2_, a3_, a4_ );
+ return b.eval( a );
+ }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
+ {
+ rrlist4<A1&, A2&, A3&, A4&> a( a1_, a2_, a3_, a4_ );
+ return b.eval( a );
+ }
+};
+
+template< class A1, class A2, class A3, class A4, class A5 > class rrlist5
+{
+private:
+
+ A1 & a1_;
+ A2 & a2_;
+ A3 & a3_;
+ A4 & a4_;
+ A5 & a5_;
+
+public:
+
+ rrlist5( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ) {}
+
+ A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
+ A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
+ A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
+
+ A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
+ A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
+ A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
+
+ template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
+
+ template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
+ {
+ rrlist5<A1&, A2&, A3&, A4&, A5&> a( a1_, a2_, a3_, a4_, a5_ );
+ return b.eval( a );
+ }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
+ {
+ rrlist5<A1&, A2&, A3&, A4&, A5&> a( a1_, a2_, a3_, a4_, a5_ );
+ return b.eval( a );
+ }
+};
+
+template< class A1, class A2, class A3, class A4, class A5, class A6 > class rrlist6
+{
+private:
+
+ A1 & a1_;
+ A2 & a2_;
+ A3 & a3_;
+ A4 & a4_;
+ A5 & a5_;
+ A6 & a6_;
+
+public:
+
+ rrlist6( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ) {}
+
+ A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
+ A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
+ A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
+ A6 && operator[] (boost::arg<6>) const { return std::forward<A6>( a6_ ); }
+
+ A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
+ A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
+ A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
+ A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward<A6>( a6_ ); }
+
+ template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
+
+ template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
+ {
+ rrlist6<A1&, A2&, A3&, A4&, A5&, A6&> a( a1_, a2_, a3_, a4_, a5_, a6_ );
+ return b.eval( a );
+ }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
+ {
+ rrlist6<A1&, A2&, A3&, A4&, A5&, A6&> a( a1_, a2_, a3_, a4_, a5_, a6_ );
+ return b.eval( a );
+ }
+};
+
+template< class A1, class A2, class A3, class A4, class A5, class A6, class A7 > class rrlist7
+{
+private:
+
+ A1 & a1_;
+ A2 & a2_;
+ A3 & a3_;
+ A4 & a4_;
+ A5 & a5_;
+ A6 & a6_;
+ A7 & a7_;
+
+public:
+
+ rrlist7( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ) {}
+
+ A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
+ A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
+ A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
+ A6 && operator[] (boost::arg<6>) const { return std::forward<A6>( a6_ ); }
+ A7 && operator[] (boost::arg<7>) const { return std::forward<A7>( a7_ ); }
+
+ A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
+ A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
+ A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
+ A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward<A6>( a6_ ); }
+ A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward<A7>( a7_ ); }
+
+ template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
+
+ template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
+ {
+ rrlist7<A1&, A2&, A3&, A4&, A5&, A6&, A7&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ );
+ return b.eval( a );
+ }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
+ {
+ rrlist7<A1&, A2&, A3&, A4&, A5&, A6&, A7&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ );
+ return b.eval( a );
+ }
+};
+
+template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class rrlist8
+{
+private:
+
+ A1 & a1_;
+ A2 & a2_;
+ A3 & a3_;
+ A4 & a4_;
+ A5 & a5_;
+ A6 & a6_;
+ A7 & a7_;
+ A8 & a8_;
+
+public:
+
+ rrlist8( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ) {}
+
+ A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
+ A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
+ A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
+ A6 && operator[] (boost::arg<6>) const { return std::forward<A6>( a6_ ); }
+ A7 && operator[] (boost::arg<7>) const { return std::forward<A7>( a7_ ); }
+ A8 && operator[] (boost::arg<8>) const { return std::forward<A8>( a8_ ); }
+
+ A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
+ A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
+ A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
+ A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward<A6>( a6_ ); }
+ A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward<A7>( a7_ ); }
+ A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward<A8>( a8_ ); }
+
+ template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
+
+ template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
+ {
+ rrlist8<A1&, A2&, A3&, A4&, A5&, A6&, A7&, A8&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ );
+ return b.eval( a );
+ }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
+ {
+ rrlist8<A1&, A2&, A3&, A4&, A5&, A6&, A7&, A8&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ );
+ return b.eval( a );
+ }
+};
+
+template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > class rrlist9
+{
+private:
+
+ A1 & a1_;
+ A2 & a2_;
+ A3 & a3_;
+ A4 & a4_;
+ A5 & a5_;
+ A6 & a6_;
+ A7 & a7_;
+ A8 & a8_;
+ A9 & a9_;
+
+public:
+
+ rrlist9( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ), a9_( a9 ) {}
+
+ A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
+ A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
+ A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
+ A6 && operator[] (boost::arg<6>) const { return std::forward<A6>( a6_ ); }
+ A7 && operator[] (boost::arg<7>) const { return std::forward<A7>( a7_ ); }
+ A8 && operator[] (boost::arg<8>) const { return std::forward<A8>( a8_ ); }
+ A9 && operator[] (boost::arg<9>) const { return std::forward<A9>( a9_ ); }
+
+ A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
+ A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
+ A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
+ A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
+ A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
+ A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward<A6>( a6_ ); }
+ A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward<A7>( a7_ ); }
+ A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward<A8>( a8_ ); }
+ A9 && operator[] (boost::arg<9> (*) ()) const { return std::forward<A9>( a9_ ); }
+
+ template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
+
+ template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
+
+ template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
+ {
+ rrlist9<A1&, A2&, A3&, A4&, A5&, A6&, A7&, A8&, A9&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ );
+ return b.eval( a );
+ }
+
+ template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
+ {
+ rrlist9<A1&, A2&, A3&, A4&, A5&, A6&, A7&, A8&, A9&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ );
+ return b.eval( a );
+ }
+};
+
+template<class R, class F, class L> class bind_t
+{
+private:
+
+ F f_;
+ L l_;
+
+public:
+
+ typedef typename result_traits<R, F>::type result_type;
+ typedef bind_t this_type;
+
+ bind_t( F f, L const & l ): f_( f ), l_( l ) {}
+
+ //
+
+ result_type operator()()
+ {
+ list0 a;
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ result_type operator()() const
+ {
+ list0 a;
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1> result_type operator()( A1 && a1 )
+ {
+ rrlist1< A1 > a( a1 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1> result_type operator()( A1 && a1 ) const
+ {
+ rrlist1< A1 > a( a1 );
+ return l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2> result_type operator()( A1 && a1, A2 && a2 )
+ {
+ rrlist2< A1, A2 > a( a1, a2 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2> result_type operator()( A1 && a1, A2 && a2 ) const
+ {
+ rrlist2< A1, A2 > a( a1, a2 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3> result_type operator()( A1 && a1, A2 && a2, A3 && a3 )
+ {
+ rrlist3< A1, A2, A3 > a( a1, a2, a3 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3> result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) const
+ {
+ rrlist3< A1, A2, A3 > a( a1, a2, a3 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3, class A4> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 )
+ {
+ rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3, class A4> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) const
+ {
+ rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 )
+ {
+ rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) const
+ {
+ rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 )
+ {
+ rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) const
+ {
+ rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 )
+ {
+ rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) const
+ {
+ rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 )
+ {
+ rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) const
+ {
+ rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 )
+ {
+ rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) const
+ {
+ rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 );
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ //
+
+ template<class A> result_type eval( A & a )
+ {
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class A> result_type eval( A & a ) const
+ {
+ return l_( type<result_type>(), f_, a, 0 );
+ }
+
+ template<class V> void accept( V & v ) const
+ {
+#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ )
+ using boost::visit_each;
+#endif
+
+ BOOST_BIND_VISIT_EACH( v, f_, 0 );
+ l_.accept( v );
+ }
+
+ bool compare( this_type const & rhs ) const
+ {
+ return ref_compare( f_, rhs.f_, 0 ) && l_ == rhs.l_;
+ }
+};
+
+#elif !defined( BOOST_NO_VOID_RETURNS )
+
+template<class R, class F, class L> class bind_t
+{
+public:
+
+ typedef bind_t this_type;
+
+ bind_t(F f, L const & l): f_(f), l_(l) {}
+
+#define BOOST_BIND_RETURN return
+#include <boost/bind/bind_template.hpp>
+#undef BOOST_BIND_RETURN
+
+};
+
+#else // no void returns
+
+template<class R> struct bind_t_generator
+{
+
+template<class F, class L> class implementation
+{
+public:
+
+ typedef implementation this_type;
+
+ implementation(F f, L const & l): f_(f), l_(l) {}
+
+#define BOOST_BIND_RETURN return
+#include <boost/bind/bind_template.hpp>
+#undef BOOST_BIND_RETURN
+
+};
+
+};
+
+template<> struct bind_t_generator<void>
+{
+
+template<class F, class L> class implementation
+{
+private:
+
+ typedef void R;
+
+public:
+
+ typedef implementation this_type;
+
+ implementation(F f, L const & l): f_(f), l_(l) {}
+
+#define BOOST_BIND_RETURN
+#include <boost/bind/bind_template.hpp>
+#undef BOOST_BIND_RETURN
+
+};
+
+};
+
+template<class R2, class F, class L> class bind_t: public bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>
+{
+public:
+
+ bind_t(F f, L const & l): bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>(f, l) {}
+
+};
+
+#endif
+
+// function_equal
+
+#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
+// put overloads in _bi, rely on ADL
+
+# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
+{
+ return a.compare(b);
+}
+
+# else
+
+template<class R, class F, class L> bool function_equal_impl( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b, int )
+{
+ return a.compare(b);
+}
+
+# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+#else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
+// put overloads in boost
+
+} // namespace _bi
+
+# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+template<class R, class F, class L> bool function_equal( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b )
+{
+ return a.compare(b);
+}
+
+# else
+
+template<class R, class F, class L> bool function_equal_impl( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b, int )
+{
+ return a.compare(b);
+}
+
+# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+namespace _bi
+{
+
+#endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
+// add_value
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530)
+
+#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x582) )
+
+template<class T> struct add_value
+{
+ typedef _bi::value<T> type;
+};
+
+#else
+
+template< class T, int I > struct add_value_2
+{
+ typedef boost::arg<I> type;
+};
+
+template< class T > struct add_value_2< T, 0 >
+{
+ typedef _bi::value< T > type;
+};
+
+template<class T> struct add_value
+{
+ typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type;
+};
+
+#endif
+
+template<class T> struct add_value< value<T> >
+{
+ typedef _bi::value<T> type;
+};
+
+template<class T> struct add_value< reference_wrapper<T> >
+{
+ typedef reference_wrapper<T> type;
+};
+
+template<int I> struct add_value< arg<I> >
+{
+ typedef boost::arg<I> type;
+};
+
+template<int I> struct add_value< arg<I> (*) () >
+{
+ typedef boost::arg<I> (*type) ();
+};
+
+template<class R, class F, class L> struct add_value< bind_t<R, F, L> >
+{
+ typedef bind_t<R, F, L> type;
+};
+
+#else
+
+template<int I> struct _avt_0;
+
+template<> struct _avt_0<1>
+{
+ template<class T> struct inner
+ {
+ typedef T type;
+ };
+};
+
+template<> struct _avt_0<2>
+{
+ template<class T> struct inner
+ {
+ typedef value<T> type;
+ };
+};
+
+typedef char (&_avt_r1) [1];
+typedef char (&_avt_r2) [2];
+
+template<class T> _avt_r1 _avt_f(value<T>);
+template<class T> _avt_r1 _avt_f(reference_wrapper<T>);
+template<int I> _avt_r1 _avt_f(arg<I>);
+template<int I> _avt_r1 _avt_f(arg<I> (*) ());
+template<class R, class F, class L> _avt_r1 _avt_f(bind_t<R, F, L>);
+
+_avt_r2 _avt_f(...);
+
+template<class T> struct add_value
+{
+ static T t();
+ typedef typename _avt_0<sizeof(_avt_f(t()))>::template inner<T>::type type;
+};
+
+#endif
+
+// list_av_N
+
+template<class A1> struct list_av_1
+{
+ typedef typename add_value<A1>::type B1;
+ typedef list1<B1> type;
+};
+
+template<class A1, class A2> struct list_av_2
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef list2<B1, B2> type;
+};
+
+template<class A1, class A2, class A3> struct list_av_3
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef list3<B1, B2, B3> type;
+};
+
+template<class A1, class A2, class A3, class A4> struct list_av_4
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef typename add_value<A4>::type B4;
+ typedef list4<B1, B2, B3, B4> type;
+};
+
+template<class A1, class A2, class A3, class A4, class A5> struct list_av_5
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef typename add_value<A4>::type B4;
+ typedef typename add_value<A5>::type B5;
+ typedef list5<B1, B2, B3, B4, B5> type;
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6> struct list_av_6
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef typename add_value<A4>::type B4;
+ typedef typename add_value<A5>::type B5;
+ typedef typename add_value<A6>::type B6;
+ typedef list6<B1, B2, B3, B4, B5, B6> type;
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct list_av_7
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef typename add_value<A4>::type B4;
+ typedef typename add_value<A5>::type B5;
+ typedef typename add_value<A6>::type B6;
+ typedef typename add_value<A7>::type B7;
+ typedef list7<B1, B2, B3, B4, B5, B6, B7> type;
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct list_av_8
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef typename add_value<A4>::type B4;
+ typedef typename add_value<A5>::type B5;
+ typedef typename add_value<A6>::type B6;
+ typedef typename add_value<A7>::type B7;
+ typedef typename add_value<A8>::type B8;
+ typedef list8<B1, B2, B3, B4, B5, B6, B7, B8> type;
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> struct list_av_9
+{
+ typedef typename add_value<A1>::type B1;
+ typedef typename add_value<A2>::type B2;
+ typedef typename add_value<A3>::type B3;
+ typedef typename add_value<A4>::type B4;
+ typedef typename add_value<A5>::type B5;
+ typedef typename add_value<A6>::type B6;
+ typedef typename add_value<A7>::type B7;
+ typedef typename add_value<A8>::type B8;
+ typedef typename add_value<A9>::type B9;
+ typedef list9<B1, B2, B3, B4, B5, B6, B7, B8, B9> type;
+};
+
+// operator!
+
+struct logical_not
+{
+ template<class V> bool operator()(V const & v) const { return !v; }
+};
+
+template<class R, class F, class L>
+ bind_t< bool, logical_not, list1< bind_t<R, F, L> > >
+ operator! (bind_t<R, F, L> const & f)
+{
+ typedef list1< bind_t<R, F, L> > list_type;
+ return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) );
+}
+
+// relational operators
+
+#define BOOST_BIND_OPERATOR( op, name ) \
+\
+struct name \
+{ \
+ template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \
+}; \
+ \
+template<class R, class F, class L, class A2> \
+ bind_t< bool, name, list2< bind_t<R, F, L>, typename add_value<A2>::type > > \
+ operator op (bind_t<R, F, L> const & f, A2 a2) \
+{ \
+ typedef typename add_value<A2>::type B2; \
+ typedef list2< bind_t<R, F, L>, B2> list_type; \
+ return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \
+}
+
+BOOST_BIND_OPERATOR( ==, equal )
+BOOST_BIND_OPERATOR( !=, not_equal )
+
+BOOST_BIND_OPERATOR( <, less )
+BOOST_BIND_OPERATOR( <=, less_equal )
+
+BOOST_BIND_OPERATOR( >, greater )
+BOOST_BIND_OPERATOR( >=, greater_equal )
+
+BOOST_BIND_OPERATOR( &&, logical_and )
+BOOST_BIND_OPERATOR( ||, logical_or )
+
+#undef BOOST_BIND_OPERATOR
+
+#if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3)
+
+// resolve ambiguity with rel_ops
+
+#define BOOST_BIND_OPERATOR( op, name ) \
+\
+template<class R, class F, class L> \
+ bind_t< bool, name, list2< bind_t<R, F, L>, bind_t<R, F, L> > > \
+ operator op (bind_t<R, F, L> const & f, bind_t<R, F, L> const & g) \
+{ \
+ typedef list2< bind_t<R, F, L>, bind_t<R, F, L> > list_type; \
+ return bind_t<bool, name, list_type> ( name(), list_type(f, g) ); \
+}
+
+BOOST_BIND_OPERATOR( !=, not_equal )
+BOOST_BIND_OPERATOR( <=, less_equal )
+BOOST_BIND_OPERATOR( >, greater )
+BOOST_BIND_OPERATOR( >=, greater_equal )
+
+#endif
+
+// visit_each, ADL
+
+#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) \
+ && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
+
+template<class V, class T> void visit_each( V & v, value<T> const & t, int )
+{
+ using boost::visit_each;
+ BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
+}
+
+template<class V, class R, class F, class L> void visit_each( V & v, bind_t<R, F, L> const & t, int )
+{
+ t.accept( v );
+}
+
+#endif
+
+} // namespace _bi
+
+// visit_each, no ADL
+
+#if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ ) \
+ || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
+
+template<class V, class T> void visit_each( V & v, _bi::value<T> const & t, int )
+{
+ BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
+}
+
+template<class V, class R, class F, class L> void visit_each( V & v, _bi::bind_t<R, F, L> const & t, int )
+{
+ t.accept( v );
+}
+
+#endif
+
+// is_bind_expression
+
+template< class T > struct is_bind_expression
+{
+ enum _vt { value = 0 };
+};
+
+#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > >
+{
+ enum _vt { value = 1 };
+};
+
+#endif
+
+// bind
+
+#ifndef BOOST_BIND
+#define BOOST_BIND bind
+#endif
+
+// generic function objects
+
+template<class R, class F>
+ _bi::bind_t<R, F, _bi::list0>
+ BOOST_BIND(F f)
+{
+ typedef _bi::list0 list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type());
+}
+
+template<class R, class F, class A1>
+ _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
+ BOOST_BIND(F f, A1 a1)
+{
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type(a1));
+}
+
+template<class R, class F, class A1, class A2>
+ _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2)
+{
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
+}
+
+template<class R, class F, class A1, class A2, class A3>
+ _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
+{
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4>
+ _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5>
+ _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
+ _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+ _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+ _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
+
+// generic function objects, alternative syntax
+
+template<class R, class F>
+ _bi::bind_t<R, F, _bi::list0>
+ BOOST_BIND(boost::type<R>, F f)
+{
+ typedef _bi::list0 list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type());
+}
+
+template<class R, class F, class A1>
+ _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1)
+{
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type(a1));
+}
+
+template<class R, class F, class A1, class A2>
+ _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2)
+{
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
+}
+
+template<class R, class F, class A1, class A2, class A3>
+ _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3)
+{
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4>
+ _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5>
+ _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
+ _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+ _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+ _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+
+// adaptable function objects
+
+template<class F>
+ _bi::bind_t<_bi::unspecified, F, _bi::list0>
+ BOOST_BIND(F f)
+{
+ typedef _bi::list0 list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type());
+}
+
+template<class F, class A1>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1<A1>::type>
+ BOOST_BIND(F f, A1 a1)
+{
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1));
+}
+
+template<class F, class A1, class A2>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2<A1, A2>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2)
+{
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2));
+}
+
+template<class F, class A1, class A2, class A3>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3<A1, A2, A3>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
+{
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3));
+}
+
+template<class F, class A1, class A2, class A3, class A4>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4));
+}
+
+template<class F, class A1, class A2, class A3, class A4, class A5>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
+}
+
+template<class F, class A1, class A2, class A3, class A4, class A5, class A6>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
+}
+
+template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
+}
+
+template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+ _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
+
+#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+
+// function pointers
+
+#define BOOST_BIND_CC
+#define BOOST_BIND_ST
+#define BOOST_BIND_NOEXCEPT
+
+#include <boost/bind/bind_cc.hpp>
+
+# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
+# undef BOOST_BIND_NOEXCEPT
+# define BOOST_BIND_NOEXCEPT noexcept
+# include <boost/bind/bind_cc.hpp>
+# endif
+
+#undef BOOST_BIND_CC
+#undef BOOST_BIND_ST
+#undef BOOST_BIND_NOEXCEPT
+
+#ifdef BOOST_BIND_ENABLE_STDCALL
+
+#define BOOST_BIND_CC __stdcall
+#define BOOST_BIND_ST
+#define BOOST_BIND_NOEXCEPT
+
+#include <boost/bind/bind_cc.hpp>
+
+#undef BOOST_BIND_CC
+#undef BOOST_BIND_ST
+#undef BOOST_BIND_NOEXCEPT
+
+#endif
+
+#ifdef BOOST_BIND_ENABLE_FASTCALL
+
+#define BOOST_BIND_CC __fastcall
+#define BOOST_BIND_ST
+#define BOOST_BIND_NOEXCEPT
+
+#include <boost/bind/bind_cc.hpp>
+
+#undef BOOST_BIND_CC
+#undef BOOST_BIND_ST
+#undef BOOST_BIND_NOEXCEPT
+
+#endif
+
+#ifdef BOOST_BIND_ENABLE_PASCAL
+
+#define BOOST_BIND_ST pascal
+#define BOOST_BIND_CC
+#define BOOST_BIND_NOEXCEPT
+
+#include <boost/bind/bind_cc.hpp>
+
+#undef BOOST_BIND_ST
+#undef BOOST_BIND_CC
+#undef BOOST_BIND_NOEXCEPT
+
+#endif
+
+// member function pointers
+
+#define BOOST_BIND_MF_NAME(X) X
+#define BOOST_BIND_MF_CC
+#define BOOST_BIND_MF_NOEXCEPT
+
+#include <boost/bind/bind_mf_cc.hpp>
+#include <boost/bind/bind_mf2_cc.hpp>
+
+# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
+# undef BOOST_BIND_MF_NOEXCEPT
+# define BOOST_BIND_MF_NOEXCEPT noexcept
+# include <boost/bind/bind_mf_cc.hpp>
+# endif
+
+#undef BOOST_BIND_MF_NAME
+#undef BOOST_BIND_MF_CC
+#undef BOOST_BIND_MF_NOEXCEPT
+
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_BIND_MF_NAME(X) X##_cdecl
+#define BOOST_BIND_MF_CC __cdecl
+#define BOOST_BIND_MF_NOEXCEPT
+
+#include <boost/bind/bind_mf_cc.hpp>
+#include <boost/bind/bind_mf2_cc.hpp>
+
+#undef BOOST_BIND_MF_NAME
+#undef BOOST_BIND_MF_CC
+#undef BOOST_BIND_MF_NOEXCEPT
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_STDCALL
+
+#define BOOST_BIND_MF_NAME(X) X##_stdcall
+#define BOOST_BIND_MF_CC __stdcall
+#define BOOST_BIND_MF_NOEXCEPT
+
+#include <boost/bind/bind_mf_cc.hpp>
+#include <boost/bind/bind_mf2_cc.hpp>
+
+#undef BOOST_BIND_MF_NAME
+#undef BOOST_BIND_MF_CC
+#undef BOOST_BIND_MF_NOEXCEPT
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
+
+#define BOOST_BIND_MF_NAME(X) X##_fastcall
+#define BOOST_BIND_MF_CC __fastcall
+#define BOOST_BIND_MF_NOEXCEPT
+
+#include <boost/bind/bind_mf_cc.hpp>
+#include <boost/bind/bind_mf2_cc.hpp>
+
+#undef BOOST_BIND_MF_NAME
+#undef BOOST_BIND_MF_CC
+#undef BOOST_BIND_MF_NOEXCEPT
+
+#endif
+
+// data member pointers
+
+#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ || ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x620 ) ) )
+
+template<class R, class T, class A1>
+_bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
+ BOOST_BIND(R T::*f, A1 a1)
+{
+ typedef _mfi::dm<R, T> F;
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<R, F, list_type>( F(f), list_type(a1) );
+}
+
+#else
+
+namespace _bi
+{
+
+template< class Pm, int I > struct add_cref;
+
+template< class M, class T > struct add_cref< M T::*, 0 >
+{
+ typedef M type;
+};
+
+template< class M, class T > struct add_cref< M T::*, 1 >
+{
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4180)
+#endif
+ typedef M const & type;
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+};
+
+template< class R, class T > struct add_cref< R (T::*) (), 1 >
+{
+ typedef void type;
+};
+
+#if !defined(__IBMCPP__) || __IBMCPP_FUNC_CV_TMPL_ARG_DEDUCTION
+
+template< class R, class T > struct add_cref< R (T::*) () const, 1 >
+{
+ typedef void type;
+};
+
+#if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
+
+template< class R, class T > struct add_cref< R (T::*) () const noexcept, 1 >
+{
+ typedef void type;
+};
+
+#endif // __cpp_noexcept_function_type
+
+#endif // __IBMCPP__
+
+template<class R> struct isref
+{
+ enum value_type { value = 0 };
+};
+
+template<class R> struct isref< R& >
+{
+ enum value_type { value = 1 };
+};
+
+template<class R> struct isref< R* >
+{
+ enum value_type { value = 1 };
+};
+
+template<class Pm, class A1> struct dm_result
+{
+ typedef typename add_cref< Pm, 1 >::type type;
+};
+
+template<class Pm, class R, class F, class L> struct dm_result< Pm, bind_t<R, F, L> >
+{
+ typedef typename bind_t<R, F, L>::result_type result_type;
+ typedef typename add_cref< Pm, isref< result_type >::value >::type type;
+};
+
+} // namespace _bi
+
+template< class A1, class M, class T >
+
+_bi::bind_t<
+ typename _bi::dm_result< M T::*, A1 >::type,
+ _mfi::dm<M, T>,
+ typename _bi::list_av_1<A1>::type
+>
+
+BOOST_BIND( M T::*f, A1 a1 )
+{
+ typedef typename _bi::dm_result< M T::*, A1 >::type result_type;
+ typedef _mfi::dm<M, T> F;
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) );
+}
+
+#endif
+
+} // namespace boost
+
+#ifndef BOOST_BIND_NO_PLACEHOLDERS
+
+# include <boost/bind/placeholders.hpp>
+
+#endif
+
+#ifdef BOOST_MSVC
+# pragma warning(default: 4512) // assignment operator could not be generated
+# pragma warning(pop)
+#endif
+
+#endif // #ifndef BOOST_BIND_BIND_HPP_INCLUDED
diff --git a/include/boost/bind/bind_cc.hpp b/include/boost/bind/bind_cc.hpp
new file mode 100644
index 0000000..278aa9a
--- /dev/null
+++ b/include/boost/bind/bind_cc.hpp
@@ -0,0 +1,117 @@
+//
+// bind/bind_cc.hpp - support for different calling conventions
+//
+// Do not include this header directly.
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+//
+// 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/bind/bind.html for documentation.
+//
+
+template<class R>
+ _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) () BOOST_BIND_NOEXCEPT, _bi::list0>
+ BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) () BOOST_BIND_NOEXCEPT)
+{
+ typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) () BOOST_BIND_NOEXCEPT;
+ typedef _bi::list0 list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type());
+}
+
+template<class R, class B1, class A1>
+ _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1) BOOST_BIND_NOEXCEPT, typename _bi::list_av_1<A1>::type>
+ BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1) BOOST_BIND_NOEXCEPT, A1 a1)
+{
+ typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1) BOOST_BIND_NOEXCEPT;
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type(a1));
+}
+
+template<class R, class B1, class B2, class A1, class A2>
+ _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2) BOOST_BIND_NOEXCEPT, typename _bi::list_av_2<A1, A2>::type>
+ BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2)
+{
+ typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2) BOOST_BIND_NOEXCEPT;
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
+}
+
+template<class R,
+ class B1, class B2, class B3,
+ class A1, class A2, class A3>
+ _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3) BOOST_BIND_NOEXCEPT, typename _bi::list_av_3<A1, A2, A3>::type>
+ BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3)
+{
+ typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3) BOOST_BIND_NOEXCEPT;
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
+}
+
+template<class R,
+ class B1, class B2, class B3, class B4,
+ class A1, class A2, class A3, class A4>
+ _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4) BOOST_BIND_NOEXCEPT, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4) BOOST_BIND_NOEXCEPT;
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
+}
+
+template<class R,
+ class B1, class B2, class B3, class B4, class B5,
+ class A1, class A2, class A3, class A4, class A5>
+ _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5) BOOST_BIND_NOEXCEPT, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5) BOOST_BIND_NOEXCEPT;
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
+}
+
+template<class R,
+ class B1, class B2, class B3, class B4, class B5, class B6,
+ class A1, class A2, class A3, class A4, class A5, class A6>
+ _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5, B6) BOOST_BIND_NOEXCEPT, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6) BOOST_BIND_NOEXCEPT;
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
+}
+
+template<class R,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_NOEXCEPT, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_NOEXCEPT;
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
+}
+
+template<class R,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+ _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_NOEXCEPT, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_NOEXCEPT;
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+template<class R,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8, class B9,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+ _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5, B6, B7, B8, B9) BOOST_BIND_NOEXCEPT, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8, B9) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8, B9) BOOST_BIND_NOEXCEPT;
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
diff --git a/include/boost/bind/bind_mf2_cc.hpp b/include/boost/bind/bind_mf2_cc.hpp
new file mode 100644
index 0000000..66476bc
--- /dev/null
+++ b/include/boost/bind/bind_mf2_cc.hpp
@@ -0,0 +1,228 @@
+//
+// bind/bind_mf2_cc.hpp - member functions, type<> syntax
+//
+// Do not include this header directly.
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2008 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
+//
+// See http://www.boost.org/libs/bind/bind.html for documentation.
+//
+
+// 0
+
+template<class Rt2, class R, class T,
+ class A1>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf0)<R, T>, typename _bi::list_av_1<A1>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (), A1 a1)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf0)<R, T> F;
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1));
+}
+
+template<class Rt2, class R, class T,
+ class A1>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf0)<R, T>, typename _bi::list_av_1<A1>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) () const, A1 a1)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf0)<R, T> F;
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1));
+}
+
+// 1
+
+template<class Rt2, class R, class T,
+ class B1,
+ class A1, class A2>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1), A1 a1, A2 a2)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1> F;
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2));
+}
+
+template<class Rt2, class R, class T,
+ class B1,
+ class A1, class A2>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1) const, A1 a1, A2 a2)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf1)<R, T, B1> F;
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2));
+}
+
+// 2
+
+template<class Rt2, class R, class T,
+ class B1, class B2,
+ class A1, class A2, class A3>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf2)<R, T, B1, B2>, typename _bi::list_av_3<A1, A2, A3>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2), A1 a1, A2 a2, A3 a3)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf2)<R, T, B1, B2> F;
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2,
+ class A1, class A2, class A3>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf2)<R, T, B1, B2>, typename _bi::list_av_3<A1, A2, A3>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2) const, A1 a1, A2 a2, A3 a3)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf2)<R, T, B1, B2> F;
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3));
+}
+
+// 3
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3,
+ class A1, class A2, class A3, class A4>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf3)<R, T, B1, B2, B3>, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3), A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf3)<R, T, B1, B2, B3> F;
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3,
+ class A1, class A2, class A3, class A4>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf3)<R, T, B1, B2, B3>, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const, A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf3)<R, T, B1, B2, B3> F;
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4));
+}
+
+// 4
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4,
+ class A1, class A2, class A3, class A4, class A5>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf4)<R, T, B1, B2, B3, B4>, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf4)<R, T, B1, B2, B3, B4> F;
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4,
+ class A1, class A2, class A3, class A4, class A5>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf4)<R, T, B1, B2, B3, B4>, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf4)<R, T, B1, B2, B3, B4> F;
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5));
+}
+
+// 5
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5,
+ class A1, class A2, class A3, class A4, class A5, class A6>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf5)<R, T, B1, B2, B3, B4, B5>, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf5)<R, T, B1, B2, B3, B4, B5> F;
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5,
+ class A1, class A2, class A3, class A4, class A5, class A6>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf5)<R, T, B1, B2, B3, B4, B5>, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf5)<R, T, B1, B2, B3, B4, B5> F;
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6));
+}
+
+// 6
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf6)<R, T, B1, B2, B3, B4, B5, B6>, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf6)<R, T, B1, B2, B3, B4, B5, B6> F;
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf6)<R, T, B1, B2, B3, B4, B5, B6>, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf6)<R, T, B1, B2, B3, B4, B5, B6> F;
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7));
+}
+
+// 7
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf7)<R, T, B1, B2, B3, B4, B5, B6, B7>, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf7)<R, T, B1, B2, B3, B4, B5, B6, B7> F;
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf7)<R, T, B1, B2, B3, B4, B5, B6, B7>, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf7)<R, T, B1, B2, B3, B4, B5, B6, B7> F;
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+// 8
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8>, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8> F;
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8>, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ BOOST_BIND(boost::type<Rt2>, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8> F;
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
diff --git a/include/boost/bind/bind_mf_cc.hpp b/include/boost/bind/bind_mf_cc.hpp
new file mode 100644
index 0000000..bbfd371
--- /dev/null
+++ b/include/boost/bind/bind_mf_cc.hpp
@@ -0,0 +1,441 @@
+//
+// bind/bind_mf_cc.hpp - support for different calling conventions
+//
+// Do not include this header directly.
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+//
+// 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/bind/bind.html for documentation.
+//
+
+// 0
+
+template<class R, class T,
+ class A1>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf0)<R, T>, typename _bi::list_av_1<A1>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf0)<R, T> F;
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1));
+}
+
+template<class R, class T,
+ class A1>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf0)<R, T>, typename _bi::list_av_1<A1>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf0)<R, T> F;
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1));
+}
+
+template<class Rt2, class R, class T,
+ class A1>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf0)<R, T>, typename _bi::list_av_1<A1>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf0)<R, T> F;
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1));
+}
+
+template<class Rt2, class R, class T,
+ class A1>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf0)<R, T>, typename _bi::list_av_1<A1>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf0)<R, T> F;
+ typedef typename _bi::list_av_1<A1>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1));
+}
+
+// 1
+
+template<class R, class T,
+ class B1,
+ class A1, class A2>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1> F;
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2));
+}
+
+template<class R, class T,
+ class B1,
+ class A1, class A2>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf1)<R, T, B1> F;
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2));
+}
+
+template<class Rt2, class R, class T,
+ class B1,
+ class A1, class A2>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1> F;
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2));
+}
+
+template<class Rt2, class R, class T,
+ class B1,
+ class A1, class A2>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf1)<R, T, B1> F;
+ typedef typename _bi::list_av_2<A1, A2>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2));
+}
+
+// 2
+
+template<class R, class T,
+ class B1, class B2,
+ class A1, class A2, class A3>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf2)<R, T, B1, B2>, typename _bi::list_av_3<A1, A2, A3>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf2)<R, T, B1, B2> F;
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3));
+}
+
+template<class R, class T,
+ class B1, class B2,
+ class A1, class A2, class A3>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf2)<R, T, B1, B2>, typename _bi::list_av_3<A1, A2, A3>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf2)<R, T, B1, B2> F;
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2,
+ class A1, class A2, class A3>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf2)<R, T, B1, B2>, typename _bi::list_av_3<A1, A2, A3>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf2)<R, T, B1, B2> F;
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2,
+ class A1, class A2, class A3>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf2)<R, T, B1, B2>, typename _bi::list_av_3<A1, A2, A3>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf2)<R, T, B1, B2> F;
+ typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3));
+}
+
+// 3
+
+template<class R, class T,
+ class B1, class B2, class B3,
+ class A1, class A2, class A3, class A4>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf3)<R, T, B1, B2, B3>, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf3)<R, T, B1, B2, B3> F;
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4));
+}
+
+template<class R, class T,
+ class B1, class B2, class B3,
+ class A1, class A2, class A3, class A4>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf3)<R, T, B1, B2, B3>, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf3)<R, T, B1, B2, B3> F;
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3,
+ class A1, class A2, class A3, class A4>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf3)<R, T, B1, B2, B3>, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf3)<R, T, B1, B2, B3> F;
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3,
+ class A1, class A2, class A3, class A4>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf3)<R, T, B1, B2, B3>, typename _bi::list_av_4<A1, A2, A3, A4>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf3)<R, T, B1, B2, B3> F;
+ typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4));
+}
+
+// 4
+
+template<class R, class T,
+ class B1, class B2, class B3, class B4,
+ class A1, class A2, class A3, class A4, class A5>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf4)<R, T, B1, B2, B3, B4>, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf4)<R, T, B1, B2, B3, B4> F;
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5));
+}
+
+template<class R, class T,
+ class B1, class B2, class B3, class B4,
+ class A1, class A2, class A3, class A4, class A5>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf4)<R, T, B1, B2, B3, B4>, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf4)<R, T, B1, B2, B3, B4> F;
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4,
+ class A1, class A2, class A3, class A4, class A5>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf4)<R, T, B1, B2, B3, B4>, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf4)<R, T, B1, B2, B3, B4> F;
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4,
+ class A1, class A2, class A3, class A4, class A5>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf4)<R, T, B1, B2, B3, B4>, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf4)<R, T, B1, B2, B3, B4> F;
+ typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5));
+}
+
+// 5
+
+template<class R, class T,
+ class B1, class B2, class B3, class B4, class B5,
+ class A1, class A2, class A3, class A4, class A5, class A6>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf5)<R, T, B1, B2, B3, B4, B5>, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf5)<R, T, B1, B2, B3, B4, B5> F;
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6));
+}
+
+template<class R, class T,
+ class B1, class B2, class B3, class B4, class B5,
+ class A1, class A2, class A3, class A4, class A5, class A6>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf5)<R, T, B1, B2, B3, B4, B5>, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf5)<R, T, B1, B2, B3, B4, B5> F;
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5,
+ class A1, class A2, class A3, class A4, class A5, class A6>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf5)<R, T, B1, B2, B3, B4, B5>, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf5)<R, T, B1, B2, B3, B4, B5> F;
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5,
+ class A1, class A2, class A3, class A4, class A5, class A6>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf5)<R, T, B1, B2, B3, B4, B5>, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf5)<R, T, B1, B2, B3, B4, B5> F;
+ typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6));
+}
+
+// 6
+
+template<class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf6)<R, T, B1, B2, B3, B4, B5, B6>, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf6)<R, T, B1, B2, B3, B4, B5, B6> F;
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7));
+}
+
+template<class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf6)<R, T, B1, B2, B3, B4, B5, B6>, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf6)<R, T, B1, B2, B3, B4, B5, B6> F;
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf6)<R, T, B1, B2, B3, B4, B5, B6>, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf6)<R, T, B1, B2, B3, B4, B5, B6> F;
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf6)<R, T, B1, B2, B3, B4, B5, B6>, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf6)<R, T, B1, B2, B3, B4, B5, B6> F;
+ typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7));
+}
+
+// 7
+
+template<class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf7)<R, T, B1, B2, B3, B4, B5, B6, B7>, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf7)<R, T, B1, B2, B3, B4, B5, B6, B7> F;
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+template<class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf7)<R, T, B1, B2, B3, B4, B5, B6, B7>, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf7)<R, T, B1, B2, B3, B4, B5, B6, B7> F;
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf7)<R, T, B1, B2, B3, B4, B5, B6, B7>, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf7)<R, T, B1, B2, B3, B4, B5, B6, B7> F;
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf7)<R, T, B1, B2, B3, B4, B5, B6, B7>, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf7)<R, T, B1, B2, B3, B4, B5, B6, B7> F;
+ typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+// 8
+
+template<class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8>, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8> F;
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
+
+template<class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+ _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8>, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8> F;
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(mf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8>, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(mf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8> F;
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
+
+template<class Rt2, class R, class T,
+ class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8,
+ class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+ typename boost::enable_if_c<!boost::core::is_same<Rt2, R>::value,
+ _bi::bind_t<Rt2, _mfi::BOOST_BIND_MF_NAME(cmf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8>, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
+ >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+{
+ typedef _mfi::BOOST_BIND_MF_NAME(cmf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8> F;
+ typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
+ return _bi::bind_t<Rt2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
diff --git a/include/boost/bind/bind_template.hpp b/include/boost/bind/bind_template.hpp
new file mode 100644
index 0000000..411d20c
--- /dev/null
+++ b/include/boost/bind/bind_template.hpp
@@ -0,0 +1,345 @@
+//
+// bind/bind_template.hpp
+//
+// Do not include this header directly.
+//
+// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
+//
+// 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/bind/bind.html for documentation.
+//
+
+ typedef typename result_traits<R, F>::type result_type;
+
+ result_type operator()()
+ {
+ list0 a;
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ result_type operator()() const
+ {
+ list0 a;
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1> result_type operator()(A1 & a1)
+ {
+ list1<A1 &> a(a1);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1> result_type operator()(A1 & a1) const
+ {
+ list1<A1 &> a(a1);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1> result_type operator()(A1 const & a1)
+ {
+ list1<A1 const &> a(a1);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1> result_type operator()(A1 const & a1) const
+ {
+ list1<A1 const &> a(a1);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#endif
+
+ template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2)
+ {
+ list2<A1 &, A2 &> a(a1, a2);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) const
+ {
+ list2<A1 &, A2 &> a(a1, a2);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2> result_type operator()(A1 const & a1, A2 & a2)
+ {
+ list2<A1 const &, A2 &> a(a1, a2);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 const & a1, A2 & a2) const
+ {
+ list2<A1 const &, A2 &> a(a1, a2);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+
+ template<class A1, class A2> result_type operator()(A1 & a1, A2 const & a2)
+ {
+ list2<A1 &, A2 const &> a(a1, a2);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 & a1, A2 const & a2) const
+ {
+ list2<A1 &, A2 const &> a(a1, a2);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+
+ template<class A1, class A2> result_type operator()(A1 const & a1, A2 const & a2)
+ {
+ list2<A1 const &, A2 const &> a(a1, a2);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 const & a1, A2 const & a2) const
+ {
+ list2<A1 const &, A2 const &> a(a1, a2);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3)
+ {
+ list3<A1 &, A2 &, A3 &> a(a1, a2, a3);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) const
+ {
+ list3<A1 &, A2 &, A3 &> a(a1, a2, a3);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3)
+ {
+ list3<A1 const &, A2 const &, A3 const &> a(a1, a2, a3);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) const
+ {
+ list3<A1 const &, A2 const &, A3 const &> a(a1, a2, a3);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4)
+ {
+ list4<A1 &, A2 &, A3 &, A4 &> a(a1, a2, a3, a4);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const
+ {
+ list4<A1 &, A2 &, A3 &, A4 &> a(a1, a2, a3, a4);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4)
+ {
+ list4<A1 const &, A2 const &, A3 const &, A4 const &> a(a1, a2, a3, a4);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3, class A4> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) const
+ {
+ list4<A1 const &, A2 const &, A3 const &, A4 const &> a(a1, a2, a3, a4);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5)
+ {
+ list5<A1 &, A2 &, A3 &, A4 &, A5 &> a(a1, a2, a3, a4, a5);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const
+ {
+ list5<A1 &, A2 &, A3 &, A4 &, A5 &> a(a1, a2, a3, a4, a5);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5)
+ {
+ list5<A1 const &, A2 const &, A3 const &, A4 const &, A5 const &> a(a1, a2, a3, a4, a5);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) const
+ {
+ list5<A1 const &, A2 const &, A3 const &, A4 const &, A5 const &> a(a1, a2, a3, a4, a5);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6)
+ {
+ list6<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &> a(a1, a2, a3, a4, a5, a6);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const
+ {
+ list6<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &> a(a1, a2, a3, a4, a5, a6);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6)
+ {
+ list6<A1 const &, A2 const &, A3 const &, A4 const &, A5 const &, A6 const &> a(a1, a2, a3, a4, a5, a6);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) const
+ {
+ list6<A1 const &, A2 const &, A3 const &, A4 const &, A5 const &, A6 const &> a(a1, a2, a3, a4, a5, a6);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7)
+ {
+ list7<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &> a(a1, a2, a3, a4, a5, a6, a7);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const
+ {
+ list7<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &> a(a1, a2, a3, a4, a5, a6, a7);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7)
+ {
+ list7<A1 const &, A2 const &, A3 const &, A4 const &, A5 const &, A6 const &, A7 const &> a(a1, a2, a3, a4, a5, a6, a7);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) const
+ {
+ list7<A1 const &, A2 const &, A3 const &, A4 const &, A5 const &, A6 const &, A7 const &> a(a1, a2, a3, a4, a5, a6, a7);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8)
+ {
+ list8<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &> a(a1, a2, a3, a4, a5, a6, a7, a8);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const
+ {
+ list8<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &> a(a1, a2, a3, a4, a5, a6, a7, a8);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8)
+ {
+ list8<A1 const &, A2 const &, A3 const &, A4 const &, A5 const &, A6 const &, A7 const &, A8 const &> a(a1, a2, a3, a4, a5, a6, a7, a8);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) const
+ {
+ list8<A1 const &, A2 const &, A3 const &, A4 const &, A5 const &, A6 const &, A7 const &, A8 const &> a(a1, a2, a3, a4, a5, a6, a7, a8);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9)
+ {
+ list9<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &, A9 &> a(a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const
+ {
+ list9<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &, A9 &> a(a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9)
+ {
+ list9<A1 const &, A2 const &, A3 const &, A4 const &, A5 const &, A6 const &, A7 const &, A8 const &, A9 const &> a(a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) const
+ {
+ list9<A1 const &, A2 const &, A3 const &, A4 const &, A5 const &, A6 const &, A7 const &, A8 const &, A9 const &> a(a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+#endif
+
+ template<class A> result_type eval(A & a)
+ {
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class A> result_type eval(A & a) const
+ {
+ BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
+ }
+
+ template<class V> void accept(V & v) const
+ {
+#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ )
+
+ using boost::visit_each;
+
+#endif
+ BOOST_BIND_VISIT_EACH(v, f_, 0);
+ l_.accept(v);
+ }
+
+ bool compare(this_type const & rhs) const
+ {
+ return ref_compare(f_, rhs.f_, 0) && l_ == rhs.l_;
+ }
+
+private:
+
+ F f_;
+ L l_;
diff --git a/include/boost/bind/make_adaptable.hpp b/include/boost/bind/make_adaptable.hpp
new file mode 100644
index 0000000..b9f083e
--- /dev/null
+++ b/include/boost/bind/make_adaptable.hpp
@@ -0,0 +1,187 @@
+#ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
+#define BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
+
+//
+// make_adaptable.hpp
+//
+// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+//
+// 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)
+//
+
+namespace boost
+{
+
+namespace _bi
+{
+
+template<class R, class F> class af0
+{
+public:
+
+ typedef R result_type;
+
+ explicit af0(F f): f_(f)
+ {
+ }
+
+ result_type operator()()
+ {
+ return f_();
+ }
+
+ result_type operator()() const
+ {
+ return f_();
+ }
+
+private:
+
+ F f_;
+};
+
+template<class R, class A1, class F> class af1
+{
+public:
+
+ typedef R result_type;
+ typedef A1 argument_type;
+ typedef A1 arg1_type;
+
+ explicit af1(F f): f_(f)
+ {
+ }
+
+ result_type operator()(A1 a1)
+ {
+ return f_(a1);
+ }
+
+ result_type operator()(A1 a1) const
+ {
+ return f_(a1);
+ }
+
+private:
+
+ F f_;
+};
+
+template<class R, class A1, class A2, class F> class af2
+{
+public:
+
+ typedef R result_type;
+ typedef A1 first_argument_type;
+ typedef A2 second_argument_type;
+ typedef A1 arg1_type;
+ typedef A2 arg2_type;
+
+ explicit af2(F f): f_(f)
+ {
+ }
+
+ result_type operator()(A1 a1, A2 a2)
+ {
+ return f_(a1, a2);
+ }
+
+ result_type operator()(A1 a1, A2 a2) const
+ {
+ return f_(a1, a2);
+ }
+
+private:
+
+ F f_;
+};
+
+template<class R, class A1, class A2, class A3, class F> class af3
+{
+public:
+
+ typedef R result_type;
+ typedef A1 arg1_type;
+ typedef A2 arg2_type;
+ typedef A3 arg3_type;
+
+ explicit af3(F f): f_(f)
+ {
+ }
+
+ result_type operator()(A1 a1, A2 a2, A3 a3)
+ {
+ return f_(a1, a2, a3);
+ }
+
+ result_type operator()(A1 a1, A2 a2, A3 a3) const
+ {
+ return f_(a1, a2, a3);
+ }
+
+private:
+
+ F f_;
+};
+
+template<class R, class A1, class A2, class A3, class A4, class F> class af4
+{
+public:
+
+ typedef R result_type;
+ typedef A1 arg1_type;
+ typedef A2 arg2_type;
+ typedef A3 arg3_type;
+ typedef A4 arg4_type;
+
+ explicit af4(F f): f_(f)
+ {
+ }
+
+ result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4)
+ {
+ return f_(a1, a2, a3, a4);
+ }
+
+ result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4) const
+ {
+ return f_(a1, a2, a3, a4);
+ }
+
+private:
+
+ F f_;
+};
+
+} // namespace _bi
+
+template<class R, class F> _bi::af0<R, F> make_adaptable(F f)
+{
+ return _bi::af0<R, F>(f);
+}
+
+template<class R, class A1, class F> _bi::af1<R, A1, F> make_adaptable(F f)
+{
+ return _bi::af1<R, A1, F>(f);
+}
+
+template<class R, class A1, class A2, class F> _bi::af2<R, A1, A2, F> make_adaptable(F f)
+{
+ return _bi::af2<R, A1, A2, F>(f);
+}
+
+template<class R, class A1, class A2, class A3, class F> _bi::af3<R, A1, A2, A3, F> make_adaptable(F f)
+{
+ return _bi::af3<R, A1, A2, A3, F>(f);
+}
+
+template<class R, class A1, class A2, class A3, class A4, class F> _bi::af4<R, A1, A2, A3, A4, F> make_adaptable(F f)
+{
+ return _bi::af4<R, A1, A2, A3, A4, F>(f);
+}
+
+} // namespace boost
+
+#endif // #ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
diff --git a/include/boost/bind/mem_fn.hpp b/include/boost/bind/mem_fn.hpp
new file mode 100644
index 0000000..956e7d8
--- /dev/null
+++ b/include/boost/bind/mem_fn.hpp
@@ -0,0 +1,389 @@
+#ifndef BOOST_BIND_MEM_FN_HPP_INCLUDED
+#define BOOST_BIND_MEM_FN_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// mem_fn.hpp - a generalization of std::mem_fun[_ref]
+//
+// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2001 David Abrahams
+// Copyright (c) 2003-2005 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)
+//
+// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
+//
+
+#include <boost/config.hpp>
+#include <boost/get_pointer.hpp>
+#include <boost/detail/workaround.hpp>
+
+namespace boost
+{
+
+#if defined(BOOST_NO_VOID_RETURNS)
+
+#define BOOST_MEM_FN_CLASS_F , class F
+#define BOOST_MEM_FN_TYPEDEF(X)
+
+namespace _mfi // mem_fun_impl
+{
+
+template<class V> struct mf
+{
+
+#define BOOST_MEM_FN_RETURN return
+
+#define BOOST_MEM_FN_NAME(X) inner_##X
+#define BOOST_MEM_FN_CC
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_STDCALL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
+#define BOOST_MEM_FN_CC __stdcall
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall
+#define BOOST_MEM_FN_CC __fastcall
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#undef BOOST_MEM_FN_RETURN
+
+}; // struct mf<V>
+
+template<> struct mf<void>
+{
+
+#define BOOST_MEM_FN_RETURN
+
+#define BOOST_MEM_FN_NAME(X) inner_##X
+#define BOOST_MEM_FN_CC
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_STDCALL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
+#define BOOST_MEM_FN_CC __stdcall
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall
+#define BOOST_MEM_FN_CC __fastcall
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#undef BOOST_MEM_FN_RETURN
+
+}; // struct mf<void>
+
+#undef BOOST_MEM_FN_CLASS_F
+#undef BOOST_MEM_FN_TYPEDEF_F
+
+#define BOOST_MEM_FN_NAME(X) X
+#define BOOST_MEM_FN_NAME2(X) inner_##X
+#define BOOST_MEM_FN_CC
+
+#include <boost/bind/mem_fn_vw.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_NAME2
+#undef BOOST_MEM_FN_CC
+
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) X##_cdecl
+#define BOOST_MEM_FN_NAME2(X) inner_##X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_vw.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_NAME2
+#undef BOOST_MEM_FN_CC
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_STDCALL
+
+#define BOOST_MEM_FN_NAME(X) X##_stdcall
+#define BOOST_MEM_FN_NAME2(X) inner_##X##_stdcall
+#define BOOST_MEM_FN_CC __stdcall
+
+#include <boost/bind/mem_fn_vw.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_NAME2
+#undef BOOST_MEM_FN_CC
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
+
+#define BOOST_MEM_FN_NAME(X) X##_fastcall
+#define BOOST_MEM_FN_NAME2(X) inner_##X##_fastcall
+#define BOOST_MEM_FN_CC __fastcall
+
+#include <boost/bind/mem_fn_vw.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_NAME2
+#undef BOOST_MEM_FN_CC
+
+#endif
+
+} // namespace _mfi
+
+#else // #ifdef BOOST_NO_VOID_RETURNS
+
+#define BOOST_MEM_FN_CLASS_F
+#define BOOST_MEM_FN_TYPEDEF(X) typedef X;
+
+namespace _mfi
+{
+
+#define BOOST_MEM_FN_RETURN return
+
+#define BOOST_MEM_FN_NAME(X) X
+#define BOOST_MEM_FN_CC
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_STDCALL
+
+#define BOOST_MEM_FN_NAME(X) X##_stdcall
+#define BOOST_MEM_FN_CC __stdcall
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
+
+#define BOOST_MEM_FN_NAME(X) X##_fastcall
+#define BOOST_MEM_FN_CC __fastcall
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
+#undef BOOST_MEM_FN_RETURN
+
+} // namespace _mfi
+
+#undef BOOST_MEM_FN_CLASS_F
+#undef BOOST_MEM_FN_TYPEDEF
+
+#endif // #ifdef BOOST_NO_VOID_RETURNS
+
+#define BOOST_MEM_FN_NAME(X) X
+#define BOOST_MEM_FN_CC
+
+#include <boost/bind/mem_fn_cc.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_CC
+
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_cc.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_CC
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_STDCALL
+
+#define BOOST_MEM_FN_NAME(X) X##_stdcall
+#define BOOST_MEM_FN_CC __stdcall
+
+#include <boost/bind/mem_fn_cc.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_CC
+
+#endif
+
+#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
+
+#define BOOST_MEM_FN_NAME(X) X##_fastcall
+#define BOOST_MEM_FN_CC __fastcall
+
+#include <boost/bind/mem_fn_cc.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_CC
+
+#endif
+
+// data member support
+
+namespace _mfi
+{
+
+template<class R, class T> class dm
+{
+public:
+
+ typedef R const & result_type;
+ typedef T const * argument_type;
+
+private:
+
+ typedef R (T::*F);
+ F f_;
+
+ template<class U> R const & call(U & u, T const *) const
+ {
+ return (u.*f_);
+ }
+
+ template<class U> R const & call(U & u, void const *) const
+ {
+ return (get_pointer(u)->*f_);
+ }
+
+public:
+
+ explicit dm(F f): f_(f) {}
+
+ R & operator()(T * p) const
+ {
+ return (p->*f_);
+ }
+
+ R const & operator()(T const * p) const
+ {
+ return (p->*f_);
+ }
+
+ template<class U> R const & operator()(U const & u) const
+ {
+ return call(u, &u);
+ }
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, < 0x3200)
+
+ R & operator()(T & t) const
+ {
+ return (t.*f_);
+ }
+
+ R const & operator()(T const & t) const
+ {
+ return (t.*f_);
+ }
+
+#endif
+
+ bool operator==(dm const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(dm const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+} // namespace _mfi
+
+template<class R, class T> _mfi::dm<R, T> mem_fn(R T::*f)
+{
+ return _mfi::dm<R, T>(f);
+}
+
+} // namespace boost
+
+#endif // #ifndef BOOST_BIND_MEM_FN_HPP_INCLUDED
diff --git a/include/boost/bind/mem_fn_cc.hpp b/include/boost/bind/mem_fn_cc.hpp
new file mode 100644
index 0000000..8b6ea0b
--- /dev/null
+++ b/include/boost/bind/mem_fn_cc.hpp
@@ -0,0 +1,103 @@
+//
+// bind/mem_fn_cc.hpp - support for different calling conventions
+//
+// Do not include this header directly.
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+//
+// 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/bind/mem_fn.html for documentation.
+//
+
+template<class R, class T> _mfi::BOOST_MEM_FN_NAME(mf0)<R, T> mem_fn(R (BOOST_MEM_FN_CC T::*f) ())
+{
+ return _mfi::BOOST_MEM_FN_NAME(mf0)<R, T>(f);
+}
+
+template<class R, class T> _mfi::BOOST_MEM_FN_NAME(cmf0)<R, T> mem_fn(R (BOOST_MEM_FN_CC T::*f) () const)
+{
+ return _mfi::BOOST_MEM_FN_NAME(cmf0)<R, T>(f);
+}
+
+template<class R, class T, class A1> _mfi::BOOST_MEM_FN_NAME(mf1)<R, T, A1> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1))
+{
+ return _mfi::BOOST_MEM_FN_NAME(mf1)<R, T, A1>(f);
+}
+
+template<class R, class T, class A1> _mfi::BOOST_MEM_FN_NAME(cmf1)<R, T, A1> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) const)
+{
+ return _mfi::BOOST_MEM_FN_NAME(cmf1)<R, T, A1>(f);
+}
+
+template<class R, class T, class A1, class A2> _mfi::BOOST_MEM_FN_NAME(mf2)<R, T, A1, A2> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2))
+{
+ return _mfi::BOOST_MEM_FN_NAME(mf2)<R, T, A1, A2>(f);
+}
+
+template<class R, class T, class A1, class A2> _mfi::BOOST_MEM_FN_NAME(cmf2)<R, T, A1, A2> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) const)
+{
+ return _mfi::BOOST_MEM_FN_NAME(cmf2)<R, T, A1, A2>(f);
+}
+
+template<class R, class T, class A1, class A2, class A3> _mfi::BOOST_MEM_FN_NAME(mf3)<R, T, A1, A2, A3> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3))
+{
+ return _mfi::BOOST_MEM_FN_NAME(mf3)<R, T, A1, A2, A3>(f);
+}
+
+template<class R, class T, class A1, class A2, class A3> _mfi::BOOST_MEM_FN_NAME(cmf3)<R, T, A1, A2, A3> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) const)
+{
+ return _mfi::BOOST_MEM_FN_NAME(cmf3)<R, T, A1, A2, A3>(f);
+}
+
+template<class R, class T, class A1, class A2, class A3, class A4> _mfi::BOOST_MEM_FN_NAME(mf4)<R, T, A1, A2, A3, A4> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4))
+{
+ return _mfi::BOOST_MEM_FN_NAME(mf4)<R, T, A1, A2, A3, A4>(f);
+}
+
+template<class R, class T, class A1, class A2, class A3, class A4> _mfi::BOOST_MEM_FN_NAME(cmf4)<R, T, A1, A2, A3, A4> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) const)
+{
+ return _mfi::BOOST_MEM_FN_NAME(cmf4)<R, T, A1, A2, A3, A4>(f);
+}
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::BOOST_MEM_FN_NAME(mf5)<R, T, A1, A2, A3, A4, A5> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5))
+{
+ return _mfi::BOOST_MEM_FN_NAME(mf5)<R, T, A1, A2, A3, A4, A5>(f);
+}
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::BOOST_MEM_FN_NAME(cmf5)<R, T, A1, A2, A3, A4, A5> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) const)
+{
+ return _mfi::BOOST_MEM_FN_NAME(cmf5)<R, T, A1, A2, A3, A4, A5>(f);
+}
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::BOOST_MEM_FN_NAME(mf6)<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6))
+{
+ return _mfi::BOOST_MEM_FN_NAME(mf6)<R, T, A1, A2, A3, A4, A5, A6>(f);
+}
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::BOOST_MEM_FN_NAME(cmf6)<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) const)
+{
+ return _mfi::BOOST_MEM_FN_NAME(cmf6)<R, T, A1, A2, A3, A4, A5, A6>(f);
+}
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::BOOST_MEM_FN_NAME(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7))
+{
+ return _mfi::BOOST_MEM_FN_NAME(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7>(f);
+}
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::BOOST_MEM_FN_NAME(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) const)
+{
+ return _mfi::BOOST_MEM_FN_NAME(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7>(f);
+}
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::BOOST_MEM_FN_NAME(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8))
+{
+ return _mfi::BOOST_MEM_FN_NAME(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8>(f);
+}
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::BOOST_MEM_FN_NAME(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) const)
+{
+ return _mfi::BOOST_MEM_FN_NAME(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8>(f);
+}
diff --git a/include/boost/bind/mem_fn_template.hpp b/include/boost/bind/mem_fn_template.hpp
new file mode 100644
index 0000000..b26d585
--- /dev/null
+++ b/include/boost/bind/mem_fn_template.hpp
@@ -0,0 +1,1047 @@
+//
+// bind/mem_fn_template.hpp
+//
+// Do not include this header directly
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+//
+// 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/bind/mem_fn.html for documentation.
+//
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+# define BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
+#endif
+
+// mf0
+
+template<class R, class T BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf0)
+{
+public:
+
+ typedef R result_type;
+ typedef T * argument_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) ())
+ F f_;
+
+ template<class U> R call(U & u, T const *) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)();
+ }
+
+ template<class U> R call(U & u, void const *) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)();
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(mf0)(F f): f_(f) {}
+
+ R operator()(T * p) const
+ {
+ BOOST_MEM_FN_RETURN (p->*f_)();
+ }
+
+ template<class U> R operator()(U & u) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p);
+ }
+
+#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
+
+ template<class U> R operator()(U const & u) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p);
+ }
+
+#endif
+
+ R operator()(T & t) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)();
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(mf0) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(mf0) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// cmf0
+
+template<class R, class T BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf0)
+{
+public:
+
+ typedef R result_type;
+ typedef T const * argument_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) () const)
+ F f_;
+
+ template<class U> R call(U & u, T const *) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)();
+ }
+
+ template<class U> R call(U & u, void const *) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)();
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(cmf0)(F f): f_(f) {}
+
+ template<class U> R operator()(U const & u) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p);
+ }
+
+ R operator()(T const & t) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)();
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(cmf0) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(cmf0) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// mf1
+
+template<class R, class T, class A1 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf1)
+{
+public:
+
+ typedef R result_type;
+ typedef T * first_argument_type;
+ typedef A1 second_argument_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1))
+ F f_;
+
+ template<class U, class B1> R call(U & u, T const *, B1 & b1) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1);
+ }
+
+ template<class U, class B1> R call(U & u, void const *, B1 & b1) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(mf1)(F f): f_(f) {}
+
+ R operator()(T * p, A1 a1) const
+ {
+ BOOST_MEM_FN_RETURN (p->*f_)(a1);
+ }
+
+ template<class U> R operator()(U & u, A1 a1) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1);
+ }
+
+#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
+
+ template<class U> R operator()(U const & u, A1 a1) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1);
+ }
+
+#endif
+
+ R operator()(T & t, A1 a1) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(mf1) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(mf1) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// cmf1
+
+template<class R, class T, class A1 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf1)
+{
+public:
+
+ typedef R result_type;
+ typedef T const * first_argument_type;
+ typedef A1 second_argument_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1) const)
+ F f_;
+
+ template<class U, class B1> R call(U & u, T const *, B1 & b1) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1);
+ }
+
+ template<class U, class B1> R call(U & u, void const *, B1 & b1) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(cmf1)(F f): f_(f) {}
+
+ template<class U> R operator()(U const & u, A1 a1) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1);
+ }
+
+ R operator()(T const & t, A1 a1) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(cmf1) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(cmf1) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// mf2
+
+template<class R, class T, class A1, class A2 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf2)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2))
+ F f_;
+
+ template<class U, class B1, class B2> R call(U & u, T const *, B1 & b1, B2 & b2) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2);
+ }
+
+ template<class U, class B1, class B2> R call(U & u, void const *, B1 & b1, B2 & b2) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(mf2)(F f): f_(f) {}
+
+ R operator()(T * p, A1 a1, A2 a2) const
+ {
+ BOOST_MEM_FN_RETURN (p->*f_)(a1, a2);
+ }
+
+ template<class U> R operator()(U & u, A1 a1, A2 a2) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2);
+ }
+
+#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2);
+ }
+
+#endif
+
+ R operator()(T & t, A1 a1, A2 a2) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(mf2) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(mf2) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// cmf2
+
+template<class R, class T, class A1, class A2 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf2)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2) const)
+ F f_;
+
+ template<class U, class B1, class B2> R call(U & u, T const *, B1 & b1, B2 & b2) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2);
+ }
+
+ template<class U, class B1, class B2> R call(U & u, void const *, B1 & b1, B2 & b2) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(cmf2)(F f): f_(f) {}
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2);
+ }
+
+ R operator()(T const & t, A1 a1, A2 a2) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(cmf2) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(cmf2) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// mf3
+
+template<class R, class T, class A1, class A2, class A3 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf3)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3))
+ F f_;
+
+ template<class U, class B1, class B2, class B3> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3);
+ }
+
+ template<class U, class B1, class B2, class B3> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(mf3)(F f): f_(f) {}
+
+ R operator()(T * p, A1 a1, A2 a2, A3 a3) const
+ {
+ BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3);
+ }
+
+ template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3);
+ }
+
+#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3);
+ }
+
+#endif
+
+ R operator()(T & t, A1 a1, A2 a2, A3 a3) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(mf3) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(mf3) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// cmf3
+
+template<class R, class T, class A1, class A2, class A3 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf3)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const)
+ F f_;
+
+ template<class U, class B1, class B2, class B3> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3);
+ }
+
+ template<class U, class B1, class B2, class B3> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(cmf3)(F f): f_(f) {}
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3);
+ }
+
+ R operator()(T const & t, A1 a1, A2 a2, A3 a3) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(cmf3) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(cmf3) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// mf4
+
+template<class R, class T, class A1, class A2, class A3, class A4 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf4)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4))
+ F f_;
+
+ template<class U, class B1, class B2, class B3, class B4> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4);
+ }
+
+ template<class U, class B1, class B2, class B3, class B4> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(mf4)(F f): f_(f) {}
+
+ R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4) const
+ {
+ BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4);
+ }
+
+ template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4);
+ }
+
+#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4);
+ }
+
+#endif
+
+ R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(mf4) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(mf4) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// cmf4
+
+template<class R, class T, class A1, class A2, class A3, class A4 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf4)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const)
+ F f_;
+
+ template<class U, class B1, class B2, class B3, class B4> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4);
+ }
+
+ template<class U, class B1, class B2, class B3, class B4> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(cmf4)(F f): f_(f) {}
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4);
+ }
+
+ R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(cmf4) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(cmf4) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// mf5
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf5)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5))
+ F f_;
+
+ template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5);
+ }
+
+ template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(mf5)(F f): f_(f) {}
+
+ R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
+ {
+ BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5);
+ }
+
+ template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5);
+ }
+
+#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5);
+ }
+
+#endif
+
+ R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(mf5) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(mf5) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// cmf5
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf5)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const)
+ F f_;
+
+ template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5);
+ }
+
+ template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(cmf5)(F f): f_(f) {}
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5);
+ }
+
+ R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(cmf5) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(cmf5) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// mf6
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf6)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6))
+ F f_;
+
+ template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6);
+ }
+
+ template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(mf6)(F f): f_(f) {}
+
+ R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
+ {
+ BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6);
+ }
+
+ template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6);
+ }
+
+#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6);
+ }
+
+#endif
+
+ R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(mf6) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(mf6) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// cmf6
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf6)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const)
+ F f_;
+
+ template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6);
+ }
+
+ template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(cmf6)(F f): f_(f) {}
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6);
+ }
+
+ R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(cmf6) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(cmf6) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// mf7
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf7)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7))
+ F f_;
+
+ template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7);
+ }
+
+ template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(mf7)(F f): f_(f) {}
+
+ R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
+ {
+ BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7);
+ }
+
+ template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7);
+ }
+
+#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7);
+ }
+
+#endif
+
+ R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(mf7) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(mf7) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// cmf7
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf7)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const)
+ F f_;
+
+ template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7);
+ }
+
+ template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(cmf7)(F f): f_(f) {}
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7);
+ }
+
+ R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(cmf7) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(cmf7) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// mf8
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf8)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8))
+ F f_;
+
+ template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8);
+ }
+
+ template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(mf8)(F f): f_(f) {}
+
+ R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
+ {
+ BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+ template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+#endif
+
+ R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(mf8) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(mf8) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+// cmf8
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf8)
+{
+public:
+
+ typedef R result_type;
+
+private:
+
+ BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const)
+ F f_;
+
+ template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const
+ {
+ BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8);
+ }
+
+ template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const
+ {
+ BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8);
+ }
+
+public:
+
+ explicit BOOST_MEM_FN_NAME(cmf8)(F f): f_(f) {}
+
+ R operator()(T const * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
+ {
+ BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+ template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
+ {
+ U const * p = 0;
+ BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+ R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
+ {
+ BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+ bool operator==(BOOST_MEM_FN_NAME(cmf8) const & rhs) const
+ {
+ return f_ == rhs.f_;
+ }
+
+ bool operator!=(BOOST_MEM_FN_NAME(cmf8) const & rhs) const
+ {
+ return f_ != rhs.f_;
+ }
+};
+
+#undef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
diff --git a/include/boost/bind/mem_fn_vw.hpp b/include/boost/bind/mem_fn_vw.hpp
new file mode 100644
index 0000000..f3fc58d
--- /dev/null
+++ b/include/boost/bind/mem_fn_vw.hpp
@@ -0,0 +1,130 @@
+//
+// bind/mem_fn_vw.hpp - void return helper wrappers
+//
+// Do not include this header directly
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+//
+// 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/bind/mem_fn.html for documentation.
+//
+
+template<class R, class T> struct BOOST_MEM_FN_NAME(mf0): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)<R, T, R (BOOST_MEM_FN_CC T::*) ()>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) ();
+ explicit BOOST_MEM_FN_NAME(mf0)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)<R, T, F>(f) {}
+};
+
+template<class R, class T> struct BOOST_MEM_FN_NAME(cmf0): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)<R, T, R (BOOST_MEM_FN_CC T::*) () const>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) () const;
+ explicit BOOST_MEM_FN_NAME(cmf0)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)<R, T, F>(f) {}
+};
+
+
+template<class R, class T, class A1> struct BOOST_MEM_FN_NAME(mf1): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)<R, T, A1, R (BOOST_MEM_FN_CC T::*) (A1)>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1);
+ explicit BOOST_MEM_FN_NAME(mf1)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)<R, T, A1, F>(f) {}
+};
+
+template<class R, class T, class A1> struct BOOST_MEM_FN_NAME(cmf1): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)<R, T, A1, R (BOOST_MEM_FN_CC T::*) (A1) const>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1) const;
+ explicit BOOST_MEM_FN_NAME(cmf1)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)<R, T, A1, F>(f) {}
+};
+
+
+template<class R, class T, class A1, class A2> struct BOOST_MEM_FN_NAME(mf2): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)<R, T, A1, A2, R (BOOST_MEM_FN_CC T::*) (A1, A2)>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2);
+ explicit BOOST_MEM_FN_NAME(mf2)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)<R, T, A1, A2, F>(f) {}
+};
+
+template<class R, class T, class A1, class A2> struct BOOST_MEM_FN_NAME(cmf2): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)<R, T, A1, A2, R (BOOST_MEM_FN_CC T::*) (A1, A2) const>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2) const;
+ explicit BOOST_MEM_FN_NAME(cmf2)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)<R, T, A1, A2, F>(f) {}
+};
+
+
+template<class R, class T, class A1, class A2, class A3> struct BOOST_MEM_FN_NAME(mf3): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)<R, T, A1, A2, A3, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3)>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3);
+ explicit BOOST_MEM_FN_NAME(mf3)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)<R, T, A1, A2, A3, F>(f) {}
+};
+
+template<class R, class T, class A1, class A2, class A3> struct BOOST_MEM_FN_NAME(cmf3): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)<R, T, A1, A2, A3, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3) const>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const;
+ explicit BOOST_MEM_FN_NAME(cmf3)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)<R, T, A1, A2, A3, F>(f) {}
+};
+
+
+template<class R, class T, class A1, class A2, class A3, class A4> struct BOOST_MEM_FN_NAME(mf4): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)<R, T, A1, A2, A3, A4, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4)>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4);
+ explicit BOOST_MEM_FN_NAME(mf4)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)<R, T, A1, A2, A3, A4, F>(f) {}
+};
+
+template<class R, class T, class A1, class A2, class A3, class A4> struct BOOST_MEM_FN_NAME(cmf4): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)<R, T, A1, A2, A3, A4, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4) const>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const;
+ explicit BOOST_MEM_FN_NAME(cmf4)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)<R, T, A1, A2, A3, A4, F>(f) {}
+};
+
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5> struct BOOST_MEM_FN_NAME(mf5): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)<R, T, A1, A2, A3, A4, A5, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5)>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5);
+ explicit BOOST_MEM_FN_NAME(mf5)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)<R, T, A1, A2, A3, A4, A5, F>(f) {}
+};
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5> struct BOOST_MEM_FN_NAME(cmf5): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)<R, T, A1, A2, A3, A4, A5, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5) const>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const;
+ explicit BOOST_MEM_FN_NAME(cmf5)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)<R, T, A1, A2, A3, A4, A5, F>(f) {}
+};
+
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> struct BOOST_MEM_FN_NAME(mf6): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)<R, T, A1, A2, A3, A4, A5, A6, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6)>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6);
+ explicit BOOST_MEM_FN_NAME(mf6)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)<R, T, A1, A2, A3, A4, A5, A6, F>(f) {}
+};
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> struct BOOST_MEM_FN_NAME(cmf6): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)<R, T, A1, A2, A3, A4, A5, A6, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6) const>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const;
+ explicit BOOST_MEM_FN_NAME(cmf6)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)<R, T, A1, A2, A3, A4, A5, A6, F>(f) {}
+};
+
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct BOOST_MEM_FN_NAME(mf7): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7)>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7);
+ explicit BOOST_MEM_FN_NAME(mf7)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7, F>(f) {}
+};
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct BOOST_MEM_FN_NAME(cmf7): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7) const>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const;
+ explicit BOOST_MEM_FN_NAME(cmf7)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7, F>(f) {}
+};
+
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct BOOST_MEM_FN_NAME(mf8): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7, A8)>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8);
+ explicit BOOST_MEM_FN_NAME(mf8)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, F>(f) {}
+};
+
+template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct BOOST_MEM_FN_NAME(cmf8): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7, A8) const>
+{
+ typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const;
+ explicit BOOST_MEM_FN_NAME(cmf8)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, F>(f) {}
+};
+
diff --git a/include/boost/bind/placeholders.hpp b/include/boost/bind/placeholders.hpp
new file mode 100644
index 0000000..b819ef4
--- /dev/null
+++ b/include/boost/bind/placeholders.hpp
@@ -0,0 +1,62 @@
+#ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
+#define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// bind/placeholders.hpp - _N definitions
+//
+// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+// Copyright 2015 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
+//
+// See http://www.boost.org/libs/bind/bind.html for documentation.
+//
+
+#include <boost/bind/arg.hpp>
+#include <boost/config.hpp>
+
+namespace boost
+{
+
+namespace placeholders
+{
+
+#if defined(__BORLANDC__) || defined(__GNUC__) && (__GNUC__ < 4)
+
+inline boost::arg<1> _1() { return boost::arg<1>(); }
+inline boost::arg<2> _2() { return boost::arg<2>(); }
+inline boost::arg<3> _3() { return boost::arg<3>(); }
+inline boost::arg<4> _4() { return boost::arg<4>(); }
+inline boost::arg<5> _5() { return boost::arg<5>(); }
+inline boost::arg<6> _6() { return boost::arg<6>(); }
+inline boost::arg<7> _7() { return boost::arg<7>(); }
+inline boost::arg<8> _8() { return boost::arg<8>(); }
+inline boost::arg<9> _9() { return boost::arg<9>(); }
+
+#else
+
+BOOST_STATIC_CONSTEXPR boost::arg<1> _1;
+BOOST_STATIC_CONSTEXPR boost::arg<2> _2;
+BOOST_STATIC_CONSTEXPR boost::arg<3> _3;
+BOOST_STATIC_CONSTEXPR boost::arg<4> _4;
+BOOST_STATIC_CONSTEXPR boost::arg<5> _5;
+BOOST_STATIC_CONSTEXPR boost::arg<6> _6;
+BOOST_STATIC_CONSTEXPR boost::arg<7> _7;
+BOOST_STATIC_CONSTEXPR boost::arg<8> _8;
+BOOST_STATIC_CONSTEXPR boost::arg<9> _9;
+
+#endif
+
+} // namespace placeholders
+
+} // namespace boost
+
+#endif // #ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
diff --git a/include/boost/bind/protect.hpp b/include/boost/bind/protect.hpp
new file mode 100644
index 0000000..749e158
--- /dev/null
+++ b/include/boost/bind/protect.hpp
@@ -0,0 +1,304 @@
+#ifndef BOOST_BIND_PROTECT_HPP_INCLUDED
+#define BOOST_BIND_PROTECT_HPP_INCLUDED
+
+//
+// protect.hpp
+//
+// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2009 Steven Watanabe
+//
+// 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/detail/workaround.hpp>
+
+namespace boost
+{
+
+namespace _bi
+{
+
+template<class F> class protected_bind_t
+{
+public:
+
+ typedef typename F::result_type result_type;
+
+ explicit protected_bind_t(F f): f_(f)
+ {
+ }
+
+ result_type operator()()
+ {
+ return f_();
+ }
+
+ result_type operator()() const
+ {
+ return f_();
+ }
+
+ template<class A1> result_type operator()(A1 & a1)
+ {
+ return f_(a1);
+ }
+
+ template<class A1> result_type operator()(A1 & a1) const
+ {
+ return f_(a1);
+ }
+
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1> result_type operator()(const A1 & a1)
+ {
+ return f_(a1);
+ }
+
+ template<class A1> result_type operator()(const A1 & a1) const
+ {
+ return f_(a1);
+ }
+
+#endif
+
+ template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2)
+ {
+ return f_(a1, a2);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) const
+ {
+ return f_(a1, a2);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2> result_type operator()(A1 const & a1, A2 & a2)
+ {
+ return f_(a1, a2);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 const & a1, A2 & a2) const
+ {
+ return f_(a1, a2);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 & a1, A2 const & a2)
+ {
+ return f_(a1, a2);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 & a1, A2 const & a2) const
+ {
+ return f_(a1, a2);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 const & a1, A2 const & a2)
+ {
+ return f_(a1, a2);
+ }
+
+ template<class A1, class A2> result_type operator()(A1 const & a1, A2 const & a2) const
+ {
+ return f_(a1, a2);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3)
+ {
+ return f_(a1, a2, a3);
+ }
+
+ template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) const
+ {
+ return f_(a1, a2, a3);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3)
+ {
+ return f_(a1, a2, a3);
+ }
+
+ template<class A1, class A2, class A3> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) const
+ {
+ return f_(a1, a2, a3);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4)
+ {
+ return f_(a1, a2, a3, a4);
+ }
+
+ template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const
+ {
+ return f_(a1, a2, a3, a4);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4)
+ {
+ return f_(a1, a2, a3, a4);
+ }
+
+ template<class A1, class A2, class A3, class A4> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) const
+ {
+ return f_(a1, a2, a3, a4);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5)
+ {
+ return f_(a1, a2, a3, a4, a5);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const
+ {
+ return f_(a1, a2, a3, a4, a5);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5)
+ {
+ return f_(a1, a2, a3, a4, a5);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) const
+ {
+ return f_(a1, a2, a3, a4, a5);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6)
+ {
+ return f_(a1, a2, a3, a4, a5, a6);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const
+ {
+ return f_(a1, a2, a3, a4, a5, a6);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6)
+ {
+ return f_(a1, a2, a3, a4, a5, a6);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) const
+ {
+ return f_(a1, a2, a3, a4, a5, a6);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7)
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7)
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) const
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8)
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8)
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) const
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+#endif
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9)
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ }
+
+#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9)
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ }
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) const
+ {
+ return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ }
+
+#endif
+
+private:
+
+ F f_;
+};
+
+} // namespace _bi
+
+template<class F> _bi::protected_bind_t<F> protect(F f)
+{
+ return _bi::protected_bind_t<F>(f);
+}
+
+} // namespace boost
+
+#endif // #ifndef BOOST_BIND_PROTECT_HPP_INCLUDED
diff --git a/include/boost/bind/storage.hpp b/include/boost/bind/storage.hpp
new file mode 100644
index 0000000..be490b0
--- /dev/null
+++ b/include/boost/bind/storage.hpp
@@ -0,0 +1,475 @@
+#ifndef BOOST_BIND_STORAGE_HPP_INCLUDED
+#define BOOST_BIND_STORAGE_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// bind/storage.hpp
+//
+// boost/bind.hpp support header, optimized storage
+//
+// Copyright (c) 2006 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
+//
+// See http://www.boost.org/libs/bind/bind.html for documentation.
+//
+
+#include <boost/config.hpp>
+#include <boost/bind/arg.hpp>
+
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable: 4512) // assignment operator could not be generated
+#endif
+
+namespace boost
+{
+
+namespace _bi
+{
+
+// 1
+
+template<class A1> struct storage1
+{
+ explicit storage1( A1 a1 ): a1_( a1 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ BOOST_BIND_VISIT_EACH(v, a1_, 0);
+ }
+
+ A1 a1_;
+};
+
+#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( __BORLANDC__ )
+
+template<int I> struct storage1< boost::arg<I> >
+{
+ explicit storage1( boost::arg<I> ) {}
+
+ template<class V> void accept(V &) const { }
+
+ static boost::arg<I> a1_() { return boost::arg<I>(); }
+};
+
+template<int I> struct storage1< boost::arg<I> (*) () >
+{
+ explicit storage1( boost::arg<I> (*) () ) {}
+
+ template<class V> void accept(V &) const { }
+
+ static boost::arg<I> a1_() { return boost::arg<I>(); }
+};
+
+#endif
+
+// 2
+
+template<class A1, class A2> struct storage2: public storage1<A1>
+{
+ typedef storage1<A1> inherited;
+
+ storage2( A1 a1, A2 a2 ): storage1<A1>( a1 ), a2_( a2 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ BOOST_BIND_VISIT_EACH(v, a2_, 0);
+ }
+
+ A2 a2_;
+};
+
+#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+template<class A1, int I> struct storage2< A1, boost::arg<I> >: public storage1<A1>
+{
+ typedef storage1<A1> inherited;
+
+ storage2( A1 a1, boost::arg<I> ): storage1<A1>( a1 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a2_() { return boost::arg<I>(); }
+};
+
+template<class A1, int I> struct storage2< A1, boost::arg<I> (*) () >: public storage1<A1>
+{
+ typedef storage1<A1> inherited;
+
+ storage2( A1 a1, boost::arg<I> (*) () ): storage1<A1>( a1 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a2_() { return boost::arg<I>(); }
+};
+
+#endif
+
+// 3
+
+template<class A1, class A2, class A3> struct storage3: public storage2< A1, A2 >
+{
+ typedef storage2<A1, A2> inherited;
+
+ storage3( A1 a1, A2 a2, A3 a3 ): storage2<A1, A2>( a1, a2 ), a3_( a3 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ BOOST_BIND_VISIT_EACH(v, a3_, 0);
+ }
+
+ A3 a3_;
+};
+
+#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+template<class A1, class A2, int I> struct storage3< A1, A2, boost::arg<I> >: public storage2< A1, A2 >
+{
+ typedef storage2<A1, A2> inherited;
+
+ storage3( A1 a1, A2 a2, boost::arg<I> ): storage2<A1, A2>( a1, a2 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a3_() { return boost::arg<I>(); }
+};
+
+template<class A1, class A2, int I> struct storage3< A1, A2, boost::arg<I> (*) () >: public storage2< A1, A2 >
+{
+ typedef storage2<A1, A2> inherited;
+
+ storage3( A1 a1, A2 a2, boost::arg<I> (*) () ): storage2<A1, A2>( a1, a2 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a3_() { return boost::arg<I>(); }
+};
+
+#endif
+
+// 4
+
+template<class A1, class A2, class A3, class A4> struct storage4: public storage3< A1, A2, A3 >
+{
+ typedef storage3<A1, A2, A3> inherited;
+
+ storage4( A1 a1, A2 a2, A3 a3, A4 a4 ): storage3<A1, A2, A3>( a1, a2, a3 ), a4_( a4 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ BOOST_BIND_VISIT_EACH(v, a4_, 0);
+ }
+
+ A4 a4_;
+};
+
+#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+template<class A1, class A2, class A3, int I> struct storage4< A1, A2, A3, boost::arg<I> >: public storage3< A1, A2, A3 >
+{
+ typedef storage3<A1, A2, A3> inherited;
+
+ storage4( A1 a1, A2 a2, A3 a3, boost::arg<I> ): storage3<A1, A2, A3>( a1, a2, a3 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a4_() { return boost::arg<I>(); }
+};
+
+template<class A1, class A2, class A3, int I> struct storage4< A1, A2, A3, boost::arg<I> (*) () >: public storage3< A1, A2, A3 >
+{
+ typedef storage3<A1, A2, A3> inherited;
+
+ storage4( A1 a1, A2 a2, A3 a3, boost::arg<I> (*) () ): storage3<A1, A2, A3>( a1, a2, a3 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a4_() { return boost::arg<I>(); }
+};
+
+#endif
+
+// 5
+
+template<class A1, class A2, class A3, class A4, class A5> struct storage5: public storage4< A1, A2, A3, A4 >
+{
+ typedef storage4<A1, A2, A3, A4> inherited;
+
+ storage5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): storage4<A1, A2, A3, A4>( a1, a2, a3, a4 ), a5_( a5 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ BOOST_BIND_VISIT_EACH(v, a5_, 0);
+ }
+
+ A5 a5_;
+};
+
+#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+template<class A1, class A2, class A3, class A4, int I> struct storage5< A1, A2, A3, A4, boost::arg<I> >: public storage4< A1, A2, A3, A4 >
+{
+ typedef storage4<A1, A2, A3, A4> inherited;
+
+ storage5( A1 a1, A2 a2, A3 a3, A4 a4, boost::arg<I> ): storage4<A1, A2, A3, A4>( a1, a2, a3, a4 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a5_() { return boost::arg<I>(); }
+};
+
+template<class A1, class A2, class A3, class A4, int I> struct storage5< A1, A2, A3, A4, boost::arg<I> (*) () >: public storage4< A1, A2, A3, A4 >
+{
+ typedef storage4<A1, A2, A3, A4> inherited;
+
+ storage5( A1 a1, A2 a2, A3 a3, A4 a4, boost::arg<I> (*) () ): storage4<A1, A2, A3, A4>( a1, a2, a3, a4 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a5_() { return boost::arg<I>(); }
+};
+
+#endif
+
+// 6
+
+template<class A1, class A2, class A3, class A4, class A5, class A6> struct storage6: public storage5< A1, A2, A3, A4, A5 >
+{
+ typedef storage5<A1, A2, A3, A4, A5> inherited;
+
+ storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): storage5<A1, A2, A3, A4, A5>( a1, a2, a3, a4, a5 ), a6_( a6 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ BOOST_BIND_VISIT_EACH(v, a6_, 0);
+ }
+
+ A6 a6_;
+};
+
+#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+template<class A1, class A2, class A3, class A4, class A5, int I> struct storage6< A1, A2, A3, A4, A5, boost::arg<I> >: public storage5< A1, A2, A3, A4, A5 >
+{
+ typedef storage5<A1, A2, A3, A4, A5> inherited;
+
+ storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, boost::arg<I> ): storage5<A1, A2, A3, A4, A5>( a1, a2, a3, a4, a5 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a6_() { return boost::arg<I>(); }
+};
+
+template<class A1, class A2, class A3, class A4, class A5, int I> struct storage6< A1, A2, A3, A4, A5, boost::arg<I> (*) () >: public storage5< A1, A2, A3, A4, A5 >
+{
+ typedef storage5<A1, A2, A3, A4, A5> inherited;
+
+ storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, boost::arg<I> (*) () ): storage5<A1, A2, A3, A4, A5>( a1, a2, a3, a4, a5 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a6_() { return boost::arg<I>(); }
+};
+
+#endif
+
+// 7
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct storage7: public storage6< A1, A2, A3, A4, A5, A6 >
+{
+ typedef storage6<A1, A2, A3, A4, A5, A6> inherited;
+
+ storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): storage6<A1, A2, A3, A4, A5, A6>( a1, a2, a3, a4, a5, a6 ), a7_( a7 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ BOOST_BIND_VISIT_EACH(v, a7_, 0);
+ }
+
+ A7 a7_;
+};
+
+#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, int I> struct storage7< A1, A2, A3, A4, A5, A6, boost::arg<I> >: public storage6< A1, A2, A3, A4, A5, A6 >
+{
+ typedef storage6<A1, A2, A3, A4, A5, A6> inherited;
+
+ storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, boost::arg<I> ): storage6<A1, A2, A3, A4, A5, A6>( a1, a2, a3, a4, a5, a6 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a7_() { return boost::arg<I>(); }
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, int I> struct storage7< A1, A2, A3, A4, A5, A6, boost::arg<I> (*) () >: public storage6< A1, A2, A3, A4, A5, A6 >
+{
+ typedef storage6<A1, A2, A3, A4, A5, A6> inherited;
+
+ storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, boost::arg<I> (*) () ): storage6<A1, A2, A3, A4, A5, A6>( a1, a2, a3, a4, a5, a6 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a7_() { return boost::arg<I>(); }
+};
+
+#endif
+
+// 8
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct storage8: public storage7< A1, A2, A3, A4, A5, A6, A7 >
+{
+ typedef storage7<A1, A2, A3, A4, A5, A6, A7> inherited;
+
+ storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): storage7<A1, A2, A3, A4, A5, A6, A7>( a1, a2, a3, a4, a5, a6, a7 ), a8_( a8 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ BOOST_BIND_VISIT_EACH(v, a8_, 0);
+ }
+
+ A8 a8_;
+};
+
+#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, int I> struct storage8< A1, A2, A3, A4, A5, A6, A7, boost::arg<I> >: public storage7< A1, A2, A3, A4, A5, A6, A7 >
+{
+ typedef storage7<A1, A2, A3, A4, A5, A6, A7> inherited;
+
+ storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, boost::arg<I> ): storage7<A1, A2, A3, A4, A5, A6, A7>( a1, a2, a3, a4, a5, a6, a7 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a8_() { return boost::arg<I>(); }
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, int I> struct storage8< A1, A2, A3, A4, A5, A6, A7, boost::arg<I> (*) () >: public storage7< A1, A2, A3, A4, A5, A6, A7 >
+{
+ typedef storage7<A1, A2, A3, A4, A5, A6, A7> inherited;
+
+ storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, boost::arg<I> (*) () ): storage7<A1, A2, A3, A4, A5, A6, A7>( a1, a2, a3, a4, a5, a6, a7 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a8_() { return boost::arg<I>(); }
+};
+
+#endif
+
+// 9
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> struct storage9: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 >
+{
+ typedef storage8<A1, A2, A3, A4, A5, A6, A7, A8> inherited;
+
+ storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): storage8<A1, A2, A3, A4, A5, A6, A7, A8>( a1, a2, a3, a4, a5, a6, a7, a8 ), a9_( a9 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ BOOST_BIND_VISIT_EACH(v, a9_, 0);
+ }
+
+ A9 a9_;
+};
+
+#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, int I> struct storage9< A1, A2, A3, A4, A5, A6, A7, A8, boost::arg<I> >: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 >
+{
+ typedef storage8<A1, A2, A3, A4, A5, A6, A7, A8> inherited;
+
+ storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, boost::arg<I> ): storage8<A1, A2, A3, A4, A5, A6, A7, A8>( a1, a2, a3, a4, a5, a6, a7, a8 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a9_() { return boost::arg<I>(); }
+};
+
+template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, int I> struct storage9< A1, A2, A3, A4, A5, A6, A7, A8, boost::arg<I> (*) () >: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 >
+{
+ typedef storage8<A1, A2, A3, A4, A5, A6, A7, A8> inherited;
+
+ storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, boost::arg<I> (*) () ): storage8<A1, A2, A3, A4, A5, A6, A7, A8>( a1, a2, a3, a4, a5, a6, a7, a8 ) {}
+
+ template<class V> void accept(V & v) const
+ {
+ inherited::accept(v);
+ }
+
+ static boost::arg<I> a9_() { return boost::arg<I>(); }
+};
+
+#endif
+
+} // namespace _bi
+
+} // namespace boost
+
+#ifdef BOOST_MSVC
+# pragma warning(default: 4512) // assignment operator could not be generated
+# pragma warning(pop)
+#endif
+
+#endif // #ifndef BOOST_BIND_STORAGE_HPP_INCLUDED
diff --git a/include/boost/is_placeholder.hpp b/include/boost/is_placeholder.hpp
new file mode 100644
index 0000000..5f1b544
--- /dev/null
+++ b/include/boost/is_placeholder.hpp
@@ -0,0 +1,31 @@
+#ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED
+#define BOOST_IS_PLACEHOLDER_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined( _MSC_VER ) && ( _MSC_VER >= 1020 )
+# pragma once
+#endif
+
+
+// is_placeholder.hpp - TR1 is_placeholder metafunction
+//
+// Copyright (c) 2006 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
+
+
+namespace boost
+{
+
+template< class T > struct is_placeholder
+{
+ enum _vt { value = 0 };
+};
+
+} // namespace boost
+
+#endif // #ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED
diff --git a/include/boost/mem_fn.hpp b/include/boost/mem_fn.hpp
new file mode 100644
index 0000000..3bcd2c5
--- /dev/null
+++ b/include/boost/mem_fn.hpp
@@ -0,0 +1,24 @@
+#ifndef BOOST_MEM_FN_HPP_INCLUDED
+#define BOOST_MEM_FN_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// mem_fn.hpp - a generalization of std::mem_fun[_ref]
+//
+// Copyright (c) 2009 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
+//
+// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
+//
+
+#include <boost/bind/mem_fn.hpp>
+
+#endif // #ifndef BOOST_MEM_FN_HPP_INCLUDED
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..3f5edf3
--- /dev/null
+++ b/index.html
@@ -0,0 +1,16 @@
+<html>
+<head>
+<meta http-equiv="refresh" content="0; URL=doc/html/bind.html">
+</head>
+<body>
+Automatic redirection failed, please go to
+<a href="doc/html/bind.html">doc/html/bind.html</a> or
+<a href="doc/html/mem_fn.html">doc/html/mem_fn.html</a>.
+</body>
+</html>
+<!--
+ © Copyright Beman Dawes, 2001
+ 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
+-->
diff --git a/mem_fn.html b/mem_fn.html
new file mode 100644
index 0000000..820d2cc
--- /dev/null
+++ b/mem_fn.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Boost.MemberFunction</title>
+<meta charset="utf-8">
+<meta http-equiv="refresh" content="0; url=doc/html/mem_fn.html">
+<style>
+ body {
+ background: #fff;
+ color: #000;
+ }
+ a {
+ color: #00f;
+ text-decoration: none;
+ }
+</style>
+</head>
+<body>
+ <p>
+ Automatic redirection failed, please go to
+ <a href="doc/html/mem_fn.html">doc/html/mem_fn.html</a>
+ </p>
+ <p>
+ © 2001, 2002 Peter Dimov and Multi Media Ltd.<br>
+ © 2003-2005 Peter Dimov
+ </p>
+</body>
+</html>
diff --git a/meta/libraries.json b/meta/libraries.json
new file mode 100644
index 0000000..ebf8f7b
--- /dev/null
+++ b/meta/libraries.json
@@ -0,0 +1,34 @@
+[
+ {
+ "key": "bind",
+ "name": "Bind",
+ "authors": [
+ "Peter Dimov"
+ ],
+ "description": "boost::bind is a generalization of the standard functions std::bind1st and std::bind2nd. It supports arbitrary function objects, functions, function pointers, and member function pointers, and is able to bind any argument to a specific value or route input arguments into arbitrary positions.",
+ "std": [
+ "tr1"
+ ],
+ "category": [
+ "Function-objects"
+ ],
+ "maintainers": [
+ "Peter Dimov <pdimov -at- pdimov.com>"
+ ]
+ },
+ {
+ "key": "bind/mem_fn",
+ "name": "Member Function",
+ "authors": [
+ "Peter Dimov"
+ ],
+ "description": "Generalized binders for function/object/pointers and member functions.",
+ "documentation": "mem_fn.html",
+ "std": [
+ "tr1"
+ ],
+ "category": [
+ "Function-objects"
+ ]
+ }
+]
diff --git a/test/Jamfile.v2 b/test/Jamfile.v2
new file mode 100644
index 0000000..272725c
--- /dev/null
+++ b/test/Jamfile.v2
@@ -0,0 +1,74 @@
+# Boost.Bind Library test Jamfile
+#
+# Copyright (c) 2003-2006, 2017 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)
+
+# bring in rules for testing
+import testing ;
+
+# quick test (for CI)
+run quick.cpp ;
+
+# full test suite
+run bind_test.cpp ;
+run bind_dm_test.cpp ;
+run bind_eq_test.cpp ;
+run bind_const_test.cpp ;
+run bind_cv_test.cpp ;
+run bind_stateful_test.cpp ;
+run bind_dm2_test.cpp ;
+run bind_not_test.cpp ;
+run bind_rel_test.cpp ;
+run bind_function_test.cpp ;
+run bind_lookup_problem_test.cpp ;
+run bind_rv_sp_test.cpp ;
+compile bind_unary_addr.cpp ;
+run bind_dm3_test.cpp ;
+run bind_visit_test.cpp ;
+run bind_placeholder_test.cpp ;
+run bind_rvalue_test.cpp ;
+run bind_and_or_test.cpp ;
+run bind_void_test.cpp ;
+run bind_void_dm_test.cpp ;
+run bind_void_mf_test.cpp ;
+run mem_fn_test.cpp ;
+run mem_fn_void_test.cpp ;
+run mem_fn_derived_test.cpp ;
+run mem_fn_eq_test.cpp ;
+run mem_fn_dm_test.cpp ;
+run mem_fn_rv_test.cpp ;
+run ref_fn_test.cpp ;
+run bind_fnobj2_test.cpp ;
+run bind_fn2_test.cpp ;
+run bind_mf2_test.cpp ;
+run bind_eq2_test.cpp ;
+run mem_fn_ref_test.cpp ;
+run bind_ref_test.cpp ;
+run bind_eq3_test.cpp ;
+run protect_test.cpp ;
+run mem_fn_unary_addr_test.cpp ;
+run bind_function2_test.cpp ;
+run bind_fwd_test.cpp ;
+run bind_fwd2_test.cpp ;
+run bind_no_placeholders_test.cpp ;
+run placeholder_const_ref_test.cpp ;
+run bind_function_ap_test.cpp ;
+run bind_type_test.cpp ;
+run bind_unique_ptr_test.cpp ;
+run bind_nested_rv_test.cpp ;
+compile arg_copy_test.cpp ;
+compile-fail arg_copy_fail.cpp ;
+run placeholder_std_bind_test.cpp ;
+run bind_fastcall_test.cpp ;
+run bind_stdcall_test.cpp ;
+run bind_cdecl_mf_test.cpp ;
+run bind_fastcall_mf_test.cpp ;
+run bind_stdcall_mf_test.cpp ;
+run mem_fn_cdecl_test.cpp ;
+run mem_fn_fastcall_test.cpp ;
+run mem_fn_stdcall_test.cpp ;
+run bind_noexcept_test.cpp ;
+run bind_noexcept_mf_test.cpp ;
diff --git a/test/arg_copy_fail.cpp b/test/arg_copy_fail.cpp
new file mode 100644
index 0000000..35e9e3d
--- /dev/null
+++ b/test/arg_copy_fail.cpp
@@ -0,0 +1,19 @@
+//
+// arg_copy_fail.cpp - arg<1> to arg<2>
+//
+// Copyright 2016 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
+//
+
+#include <boost/bind/arg.hpp>
+
+//
+
+int main()
+{
+ boost::arg<1> a1(( boost::arg<2>() ));
+ (void)a1;
+}
diff --git a/test/arg_copy_test.cpp b/test/arg_copy_test.cpp
new file mode 100644
index 0000000..b727ce6
--- /dev/null
+++ b/test/arg_copy_test.cpp
@@ -0,0 +1,34 @@
+//
+// arg_copy_test.cpp - copying a custom placeholder _1 to arg<1>
+//
+// Copyright 2016 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
+//
+
+#include <boost/is_placeholder.hpp>
+#include <boost/bind/arg.hpp>
+
+//
+
+template<int I> struct ph
+{
+};
+
+namespace boost
+{
+
+template<int I> struct is_placeholder< ::ph<I> >
+{
+ enum _vt { value = I };
+};
+
+} // namespace boost
+
+int main()
+{
+ boost::arg<1> a1 = ph<1>();
+ (void)a1;
+}
diff --git a/test/bind_and_or_test.cpp b/test/bind_and_or_test.cpp
new file mode 100644
index 0000000..337a11e
--- /dev/null
+++ b/test/bind_and_or_test.cpp
@@ -0,0 +1,84 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_and_or_test.cpp - &&, || operators
+//
+// Copyright (c) 2008 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+bool f( bool x )
+{
+ return x;
+}
+
+bool g( bool x )
+{
+ return !x;
+}
+
+bool h()
+{
+ BOOST_ERROR( "Short-circuit evaluation failure" );
+ return false;
+}
+
+template< class F, class A1, class A2, class R > void test( F f, A1 a1, A2 a2, R r )
+{
+ BOOST_TEST( f( a1, a2 ) == r );
+}
+
+int main()
+{
+ // &&
+
+ test( boost::bind( f, true ) && boost::bind( g, true ), false, false, f( true ) && g( true ) );
+ test( boost::bind( f, true ) && boost::bind( g, false ), false, false, f( true ) && g( false ) );
+
+ test( boost::bind( f, false ) && boost::bind( h ), false, false, f( false ) && h() );
+
+ test( boost::bind( f, _1 ) && boost::bind( g, _2 ), true, true, f( true ) && g( true ) );
+ test( boost::bind( f, _1 ) && boost::bind( g, _2 ), true, false, f( true ) && g( false ) );
+
+ test( boost::bind( f, _1 ) && boost::bind( h ), false, false, f( false ) && h() );
+
+ // ||
+
+ test( boost::bind( f, false ) || boost::bind( g, true ), false, false, f( false ) || g( true ) );
+ test( boost::bind( f, false ) || boost::bind( g, false ), false, false, f( false ) || g( false ) );
+
+ test( boost::bind( f, true ) || boost::bind( h ), false, false, f( true ) || h() );
+
+ test( boost::bind( f, _1 ) || boost::bind( g, _2 ), false, true, f( false ) || g( true ) );
+ test( boost::bind( f, _1 ) || boost::bind( g, _2 ), false, false, f( false ) || g( false ) );
+
+ test( boost::bind( f, _1 ) || boost::bind( h ), true, false, f( true ) || h() );
+
+ //
+
+ return boost::report_errors();
+}
diff --git a/test/bind_cdecl_mf_test.cpp b/test/bind_cdecl_mf_test.cpp
new file mode 100644
index 0000000..eaf84d6
--- /dev/null
+++ b/test/bind_cdecl_mf_test.cpp
@@ -0,0 +1,174 @@
+#include <boost/config.hpp>
+
+#ifndef BOOST_MSVC
+
+int main()
+{
+}
+
+#else
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_cdecl_mf_test.cpp - test for bind.hpp + __cdecl (member functions)
+//
+// Copyright (c) 2005 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)
+//
+
+#define BOOST_MEM_FN_ENABLE_CDECL
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ int __cdecl f0() { f1(17); return 0; }
+ int __cdecl g0() const { g1(17); return 0; }
+
+ int __cdecl f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int __cdecl g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+
+ int __cdecl f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
+ int __cdecl g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
+
+ int __cdecl f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
+ int __cdecl g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
+
+ int __cdecl f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
+ int __cdecl g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
+
+ int __cdecl f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int __cdecl g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
+
+ int __cdecl f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int __cdecl g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+
+ int __cdecl f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int __cdecl g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+
+ int __cdecl f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int __cdecl g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+};
+
+void member_function_test()
+{
+ using namespace boost;
+
+ X x;
+
+ // 0
+
+ bind(&X::f0, &x)();
+ bind(&X::f0, ref(x))();
+
+ bind(&X::g0, &x)();
+ bind(&X::g0, x)();
+ bind(&X::g0, ref(x))();
+
+ // 1
+
+ bind(&X::f1, &x, 1)();
+ bind(&X::f1, ref(x), 1)();
+
+ bind(&X::g1, &x, 1)();
+ bind(&X::g1, x, 1)();
+ bind(&X::g1, ref(x), 1)();
+
+ // 2
+
+ bind(&X::f2, &x, 1, 2)();
+ bind(&X::f2, ref(x), 1, 2)();
+
+ bind(&X::g2, &x, 1, 2)();
+ bind(&X::g2, x, 1, 2)();
+ bind(&X::g2, ref(x), 1, 2)();
+
+ // 3
+
+ bind(&X::f3, &x, 1, 2, 3)();
+ bind(&X::f3, ref(x), 1, 2, 3)();
+
+ bind(&X::g3, &x, 1, 2, 3)();
+ bind(&X::g3, x, 1, 2, 3)();
+ bind(&X::g3, ref(x), 1, 2, 3)();
+
+ // 4
+
+ bind(&X::f4, &x, 1, 2, 3, 4)();
+ bind(&X::f4, ref(x), 1, 2, 3, 4)();
+
+ bind(&X::g4, &x, 1, 2, 3, 4)();
+ bind(&X::g4, x, 1, 2, 3, 4)();
+ bind(&X::g4, ref(x), 1, 2, 3, 4)();
+
+ // 5
+
+ bind(&X::f5, &x, 1, 2, 3, 4, 5)();
+ bind(&X::f5, ref(x), 1, 2, 3, 4, 5)();
+
+ bind(&X::g5, &x, 1, 2, 3, 4, 5)();
+ bind(&X::g5, x, 1, 2, 3, 4, 5)();
+ bind(&X::g5, ref(x), 1, 2, 3, 4, 5)();
+
+ // 6
+
+ bind(&X::f6, &x, 1, 2, 3, 4, 5, 6)();
+ bind(&X::f6, ref(x), 1, 2, 3, 4, 5, 6)();
+
+ bind(&X::g6, &x, 1, 2, 3, 4, 5, 6)();
+ bind(&X::g6, x, 1, 2, 3, 4, 5, 6)();
+ bind(&X::g6, ref(x), 1, 2, 3, 4, 5, 6)();
+
+ // 7
+
+ bind(&X::f7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&X::f7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ bind(&X::g7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&X::g7, x, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&X::g7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ // 8
+
+ bind(&X::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&X::f8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ bind(&X::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&X::g8, x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&X::g8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ BOOST_TEST( x.hash == 23558 );
+}
+
+int main()
+{
+ member_function_test();
+ return boost::report_errors();
+}
+
+#endif
diff --git a/test/bind_const_test.cpp b/test/bind_const_test.cpp
new file mode 100644
index 0000000..9647ca9
--- /dev/null
+++ b/test/bind_const_test.cpp
@@ -0,0 +1,184 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_const_test.cpp - test const bind objects
+//
+// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2001 David Abrahams
+//
+// 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/bind.hpp>
+#include <boost/ref.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+long f_0()
+{
+ return 17041L;
+}
+
+long f_1(long a)
+{
+ return a;
+}
+
+long f_2(long a, long b)
+{
+ return a + 10 * b;
+}
+
+long f_3(long a, long b, long c)
+{
+ return a + 10 * b + 100 * c;
+}
+
+long f_4(long a, long b, long c, long d)
+{
+ return a + 10 * b + 100 * c + 1000 * d;
+}
+
+long f_5(long a, long b, long c, long d, long e)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e;
+}
+
+long f_6(long a, long b, long c, long d, long e, long f)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
+}
+
+long f_7(long a, long b, long c, long d, long e, long f, long g)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
+}
+
+long f_8(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
+}
+
+long f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+long global_result;
+
+void fv_0()
+{
+ global_result = 17041L;
+}
+
+void fv_1(long a)
+{
+ global_result = a;
+}
+
+void fv_2(long a, long b)
+{
+ global_result = a + 10 * b;
+}
+
+void fv_3(long a, long b, long c)
+{
+ global_result = a + 10 * b + 100 * c;
+}
+
+void fv_4(long a, long b, long c, long d)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d;
+}
+
+void fv_5(long a, long b, long c, long d, long e)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e;
+}
+
+void fv_6(long a, long b, long c, long d, long e, long f)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
+}
+
+void fv_7(long a, long b, long c, long d, long e, long f, long g)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
+}
+
+void fv_8(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
+}
+
+void fv_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+template<class F, class A> long test(F const & f, A const & a)
+{
+ return f(a);
+}
+
+template<class F, class A> long testv(F const & f, A const & a)
+{
+ f(a);
+ return global_result;
+}
+
+void function_test()
+{
+ using namespace boost;
+
+ int const i = 1;
+
+ BOOST_TEST( test( bind(f_0), i ) == 17041L );
+ BOOST_TEST( test( bind(f_1, _1), i ) == 1L );
+ BOOST_TEST( test( bind(f_2, _1, 2), i ) == 21L );
+ BOOST_TEST( test( bind(f_3, _1, 2, 3), i ) == 321L );
+ BOOST_TEST( test( bind(f_4, _1, 2, 3, 4), i ) == 4321L );
+ BOOST_TEST( test( bind(f_5, _1, 2, 3, 4, 5), i ) == 54321L );
+ BOOST_TEST( test( bind(f_6, _1, 2, 3, 4, 5, 6), i ) == 654321L );
+ BOOST_TEST( test( bind(f_7, _1, 2, 3, 4, 5, 6, 7), i ) == 7654321L );
+ BOOST_TEST( test( bind(f_8, _1, 2, 3, 4, 5, 6, 7, 8), i ) == 87654321L );
+ BOOST_TEST( test( bind(f_9, _1, 2, 3, 4, 5, 6, 7, 8, 9), i ) == 987654321L );
+
+ BOOST_TEST( testv( bind(fv_0), i ) == 17041L );
+ BOOST_TEST( testv( bind(fv_1, _1), i ) == 1L );
+ BOOST_TEST( testv( bind(fv_2, _1, 2), i ) == 21L );
+ BOOST_TEST( testv( bind(fv_3, _1, 2, 3), i ) == 321L );
+ BOOST_TEST( testv( bind(fv_4, _1, 2, 3, 4), i ) == 4321L );
+ BOOST_TEST( testv( bind(fv_5, _1, 2, 3, 4, 5), i ) == 54321L );
+ BOOST_TEST( testv( bind(fv_6, _1, 2, 3, 4, 5, 6), i ) == 654321L );
+ BOOST_TEST( testv( bind(fv_7, _1, 2, 3, 4, 5, 6, 7), i ) == 7654321L );
+ BOOST_TEST( testv( bind(fv_8, _1, 2, 3, 4, 5, 6, 7, 8), i ) == 87654321L );
+ BOOST_TEST( testv( bind(fv_9, _1, 2, 3, 4, 5, 6, 7, 8, 9), i ) == 987654321L );
+}
+
+int main()
+{
+ function_test();
+ return boost::report_errors();
+}
diff --git a/test/bind_cv_test.cpp b/test/bind_cv_test.cpp
new file mode 100644
index 0000000..257aaa9
--- /dev/null
+++ b/test/bind_cv_test.cpp
@@ -0,0 +1,164 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_cv_test.cpp
+//
+// Copyright (c) 2004 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ // SGI-related compilers have odd compiler-synthesized ctors dtors
+ #ifdef __PATHSCALE__
+ X() {}
+ ~X() {}
+ #endif
+
+ int operator()()
+ {
+ return 17041;
+ }
+
+ int operator()() const
+ {
+ return -17041;
+ }
+
+ int operator()(int x1)
+ {
+ return x1;
+ }
+
+ int operator()(int x1) const
+ {
+ return -x1;
+ }
+
+ int operator()(int x1, int x2)
+ {
+ return x1+x2;
+ }
+
+ int operator()(int x1, int x2) const
+ {
+ return -(x1+x2);
+ }
+
+ int operator()(int x1, int x2, int x3)
+ {
+ return x1+x2+x3;
+ }
+
+ int operator()(int x1, int x2, int x3) const
+ {
+ return -(x1+x2+x3);
+ }
+
+ int operator()(int x1, int x2, int x3, int x4)
+ {
+ return x1+x2+x3+x4;
+ }
+
+ int operator()(int x1, int x2, int x3, int x4) const
+ {
+ return -(x1+x2+x3+x4);
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5)
+ {
+ return x1+x2+x3+x4+x5;
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5) const
+ {
+ return -(x1+x2+x3+x4+x5);
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5, int x6)
+ {
+ return x1+x2+x3+x4+x5+x6;
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5, int x6) const
+ {
+ return -(x1+x2+x3+x4+x5+x6);
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5, int x6, int x7)
+ {
+ return x1+x2+x3+x4+x5+x6+x7;
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5, int x6, int x7) const
+ {
+ return -(x1+x2+x3+x4+x5+x6+x7);
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8)
+ {
+ return x1+x2+x3+x4+x5+x6+x7+x8;
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8) const
+ {
+ return -(x1+x2+x3+x4+x5+x6+x7+x8);
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9)
+ {
+ return x1+x2+x3+x4+x5+x6+x7+x8+x9;
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9) const
+ {
+ return -(x1+x2+x3+x4+x5+x6+x7+x8+x9);
+ }
+};
+
+template<class F> void test(F f, int r)
+{
+ F const & cf = f;
+ BOOST_TEST( cf() == -r );
+ BOOST_TEST( f() == r );
+}
+
+int main()
+{
+ test( boost::bind<int>( X() ), 17041 );
+ test( boost::bind<int>( X(), 1 ), 1 );
+ test( boost::bind<int>( X(), 1, 2 ), 1+2 );
+ test( boost::bind<int>( X(), 1, 2, 3 ), 1+2+3 );
+ test( boost::bind<int>( X(), 1, 2, 3, 4 ), 1+2+3+4 );
+ test( boost::bind<int>( X(), 1, 2, 3, 4, 5 ), 1+2+3+4+5 );
+ test( boost::bind<int>( X(), 1, 2, 3, 4, 5, 6 ), 1+2+3+4+5+6 );
+ test( boost::bind<int>( X(), 1, 2, 3, 4, 5, 6, 7 ), 1+2+3+4+5+6+7 );
+ test( boost::bind<int>( X(), 1, 2, 3, 4, 5, 6, 7, 8 ), 1+2+3+4+5+6+7+8 );
+ test( boost::bind<int>( X(), 1, 2, 3, 4, 5, 6, 7, 8, 9 ), 1+2+3+4+5+6+7+8+9 );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_dm2_test.cpp b/test/bind_dm2_test.cpp
new file mode 100644
index 0000000..4bac5c7
--- /dev/null
+++ b/test/bind_dm2_test.cpp
@@ -0,0 +1,70 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_dm2_test.cpp - data members, advanced uses
+//
+// Copyright (c) 2005 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+#include <string>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ int m;
+};
+
+struct Y
+{
+ char m[ 64 ];
+};
+
+int main()
+{
+ X x = { 0 };
+ X * px = &x;
+
+ boost::bind< int& >( &X::m, _1 )( px ) = 42;
+
+ BOOST_TEST( x.m == 42 );
+
+ boost::bind< int& >( &X::m, boost::ref(x) )() = 17041;
+
+ BOOST_TEST( x.m == 17041 );
+
+ X const * pcx = &x;
+
+ BOOST_TEST( boost::bind< long >( &X::m, _1 )( pcx ) == 17041L );
+ BOOST_TEST( boost::bind< long >( &X::m, pcx )() == 17041L );
+
+ Y y = { "test" };
+ std::string v( "test" );
+
+ BOOST_TEST( boost::bind< char const* >( &Y::m, &y )() == v );
+ BOOST_TEST( boost::bind< std::string >( &Y::m, &y )() == v );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_dm3_test.cpp b/test/bind_dm3_test.cpp
new file mode 100644
index 0000000..c9571d4
--- /dev/null
+++ b/test/bind_dm3_test.cpp
@@ -0,0 +1,46 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_dm3_test.cpp - data members (regression 1.31 - 1.32)
+//
+// Copyright (c) 2005 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include <utility>
+
+int main()
+{
+ typedef std::pair<int, int> pair_type;
+
+ pair_type pair( 10, 20 );
+
+ int const & x = boost::bind( &pair_type::first, _1 )( pair );
+
+ BOOST_TEST( &pair.first == &x );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_dm_test.cpp b/test/bind_dm_test.cpp
new file mode 100644
index 0000000..6710965
--- /dev/null
+++ b/test/bind_dm_test.cpp
@@ -0,0 +1,73 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_dm_test.cpp - data members
+//
+// Copyright (c) 2005 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ int m;
+};
+
+X f( int v )
+{
+ X r = { v };
+ return r;
+}
+
+int main()
+{
+ X x = { 17041 };
+ X * px = &x;
+
+ BOOST_TEST( boost::bind( &X::m, _1 )( x ) == 17041 );
+ BOOST_TEST( boost::bind( &X::m, _1 )( px ) == 17041 );
+
+ BOOST_TEST( boost::bind( &X::m, x )() == 17041 );
+ BOOST_TEST( boost::bind( &X::m, px )() == 17041 );
+ BOOST_TEST( boost::bind( &X::m, boost::ref(x) )() == 17041 );
+
+
+ X const cx = x;
+ X const * pcx = &cx;
+
+ BOOST_TEST( boost::bind( &X::m, _1 )( cx ) == 17041 );
+ BOOST_TEST( boost::bind( &X::m, _1 )( pcx ) == 17041 );
+
+ BOOST_TEST( boost::bind( &X::m, cx )() == 17041 );
+ BOOST_TEST( boost::bind( &X::m, pcx )() == 17041 );
+ BOOST_TEST( boost::bind( &X::m, boost::ref(cx) )() == 17041 );
+
+ int const v = 42;
+
+ BOOST_TEST( boost::bind( &X::m, boost::bind( f, _1 ) )( v ) == v );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_eq2_test.cpp b/test/bind_eq2_test.cpp
new file mode 100644
index 0000000..3d7ca38
--- /dev/null
+++ b/test/bind_eq2_test.cpp
@@ -0,0 +1,49 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_eq2_test.cpp - boost::bind equality operator
+//
+// Copyright (c) 2004, 2005, 2009 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)
+//
+
+#include <boost/bind.hpp>
+#include <boost/function_equal.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+void f( int )
+{
+}
+
+int g( int i )
+{
+ return i + 5;
+}
+
+template< class F > void test_self_equal( F f )
+{
+#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+ using boost::function_equal;
+#endif
+
+ BOOST_TEST( function_equal( f, f ) );
+}
+
+int main()
+{
+ test_self_equal( boost::bind( f, _1 ) );
+ test_self_equal( boost::bind( g, _1 ) );
+ test_self_equal( boost::bind( f, boost::bind( g, _1 ) ) );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_eq3_test.cpp b/test/bind_eq3_test.cpp
new file mode 100644
index 0000000..03a5593
--- /dev/null
+++ b/test/bind_eq3_test.cpp
@@ -0,0 +1,45 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_eq3_test.cpp - function_equal with bind and weak_ptr
+//
+// Copyright (c) 2004, 2005, 2009 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
+//
+
+#include <boost/bind.hpp>
+#include <boost/function_equal.hpp>
+#include <boost/weak_ptr.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int f( boost::weak_ptr<void> wp )
+{
+ return wp.use_count();
+}
+
+template< class F > void test_self_equal( F f )
+{
+#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+ using boost::function_equal;
+#endif
+
+ BOOST_TEST( function_equal( f, f ) );
+}
+
+int main()
+{
+ test_self_equal( boost::bind( f, _1 ) );
+ test_self_equal( boost::bind( f, boost::weak_ptr<void>() ) );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_eq_test.cpp b/test/bind_eq_test.cpp
new file mode 100644
index 0000000..742ac73
--- /dev/null
+++ b/test/bind_eq_test.cpp
@@ -0,0 +1,427 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_eq_test.cpp - boost::bind equality operator
+//
+// Copyright (c) 2004, 2005 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)
+//
+
+#include <boost/bind.hpp>
+#include <boost/ref.hpp>
+
+#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+# include <boost/function_equal.hpp>
+#endif
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ int i_;
+
+ explicit X(int i): i_(i)
+ {
+ }
+
+ bool operator==(X const & rhs) const
+ {
+ return i_ == rhs.i_;
+ }
+};
+
+// f_*
+
+int f_0()
+{
+ return 0;
+}
+
+int f_1(X)
+{
+ return 0;
+}
+
+int f_2(X, X)
+{
+ return 0;
+}
+
+int f_3(X, X, X)
+{
+ return 0;
+}
+
+int f_4(X, X, X, X)
+{
+ return 0;
+}
+
+int f_5(X, X, X, X, X)
+{
+ return 0;
+}
+
+int f_6(X, X, X, X, X, X)
+{
+ return 0;
+}
+
+int f_7(X, X, X, X, X, X, X)
+{
+ return 0;
+}
+
+int f_8(X, X, X, X, X, X, X, X)
+{
+ return 0;
+}
+
+int f_9(X, X, X, X, X, X, X, X, X)
+{
+ return 0;
+}
+
+// fv_*
+
+void fv_0()
+{
+}
+
+void fv_1(X)
+{
+}
+
+void fv_2(X, X)
+{
+}
+
+void fv_3(X, X, X)
+{
+}
+
+void fv_4(X, X, X, X)
+{
+}
+
+void fv_5(X, X, X, X, X)
+{
+}
+
+void fv_6(X, X, X, X, X, X)
+{
+}
+
+void fv_7(X, X, X, X, X, X, X)
+{
+}
+
+void fv_8(X, X, X, X, X, X, X, X)
+{
+}
+
+void fv_9(X, X, X, X, X, X, X, X, X)
+{
+}
+
+template<class F> void test_eq(F f1, F f2)
+{
+#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
+ using boost::function_equal;
+
+#endif
+
+ BOOST_TEST( function_equal( f1, f2 ) );
+}
+
+template<class F> void test_ne(F f1, F f2)
+{
+#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
+ using boost::function_equal;
+
+#endif
+
+ BOOST_TEST( !function_equal( f1, f2 ) );
+}
+
+// 0
+
+template<class F> void test_0(F f)
+{
+ test_eq( boost::bind(f), boost::bind(f) );
+}
+
+// 1
+
+template<class F, class V> void test_1_(F f, V v1, V v2)
+{
+ test_eq( boost::bind(f, v1), boost::bind(f, v1) );
+ test_ne( boost::bind(f, v1), boost::bind(f, v2) );
+}
+
+template<class F> void test_1(F f)
+{
+ test_eq( boost::bind(f, _1), boost::bind(f, _1) );
+
+ test_1_( f, X(1), X(2) );
+
+ X a(0), b(0);
+ test_1_( f, boost::ref(a), boost::ref(b) );
+}
+
+// 2
+
+template<class F, class V> void test_2_(F f, V v1, V v2)
+{
+ test_eq( boost::bind(f, v1, v1), boost::bind(f, v1, v1) );
+ test_ne( boost::bind(f, v1, v1), boost::bind(f, v1, v2) );
+ test_ne( boost::bind(f, v1, v1), boost::bind(f, v2, v1) );
+}
+
+template<class F> void test_2(F f)
+{
+ test_eq( boost::bind(f, _1, _2), boost::bind(f, _1, _2) );
+
+ test_2_( f, X(1), X(2) );
+
+ X a(0), b(0);
+ test_2_( f, boost::ref(a), boost::ref(b) );
+}
+
+// 3
+
+template<class F, class V> void test_3_(F f, V v1, V v2)
+{
+ test_eq( boost::bind(f, v1, v1, v1), boost::bind(f, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1), boost::bind(f, v1, v1, v2) );
+ test_ne( boost::bind(f, v1, v1, v1), boost::bind(f, v1, v2, v1) );
+ test_ne( boost::bind(f, v1, v1, v1), boost::bind(f, v2, v1, v1) );
+}
+
+template<class F> void test_3(F f)
+{
+ test_eq( boost::bind(f, _1, _2, _3), boost::bind(f, _1, _2, _3) );
+
+ test_3_( f, X(1), X(2) );
+
+ X a(0), b(0);
+ test_3_( f, boost::ref(a), boost::ref(b) );
+}
+
+// 4
+
+template<class F, class V> void test_4_(F f, V v1, V v2)
+{
+ test_eq( boost::bind(f, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v2) );
+ test_ne( boost::bind(f, v1, v1, v1, v1), boost::bind(f, v1, v1, v2, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1), boost::bind(f, v1, v2, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1), boost::bind(f, v2, v1, v1, v1) );
+}
+
+template<class F> void test_4(F f)
+{
+ test_eq( boost::bind(f, _1, _2, _3, _4), boost::bind(f, _1, _2, _3, _4) );
+
+ test_4_( f, X(1), X(2) );
+
+ X a(0), b(0);
+ test_4_( f, boost::ref(a), boost::ref(b) );
+}
+
+// 5
+
+template<class F, class V> void test_5_(F f, V v1, V v2)
+{
+ test_eq( boost::bind(f, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v2) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v2, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v2, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1), boost::bind(f, v1, v2, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1), boost::bind(f, v2, v1, v1, v1, v1) );
+}
+
+template<class F> void test_5(F f)
+{
+ test_eq( boost::bind(f, _1, _2, _3, _4, _5), boost::bind(f, _1, _2, _3, _4, _5) );
+
+ test_5_( f, X(1), X(2) );
+
+ X a(0), b(0);
+ test_5_( f, boost::ref(a), boost::ref(b) );
+}
+
+// 6
+
+template<class F, class V> void test_6_(F f, V v1, V v2)
+{
+ test_eq( boost::bind(f, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v2) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v2, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v2, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v2, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v2, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1), boost::bind(f, v2, v1, v1, v1, v1, v1) );
+}
+
+template<class F> void test_6(F f)
+{
+ test_eq( boost::bind(f, _1, _2, _3, _4, _5, _6), boost::bind(f, _1, _2, _3, _4, _5, _6) );
+
+ test_6_( f, X(1), X(2) );
+
+ X a(0), b(0);
+ test_6_( f, boost::ref(a), boost::ref(b) );
+}
+
+// 7
+
+template<class F, class V> void test_7_(F f, V v1, V v2)
+{
+ test_eq( boost::bind(f, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v1, v2) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v2, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v2, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v2, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v2, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v2, v1, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v2, v1, v1, v1, v1, v1, v1) );
+}
+
+template<class F> void test_7(F f)
+{
+ test_eq( boost::bind(f, _1, _2, _3, _4, _5, _6, _7), boost::bind(f, _1, _2, _3, _4, _5, _6, _7) );
+
+ test_7_( f, X(1), X(2) );
+
+ X a(0), b(0);
+ test_7_( f, boost::ref(a), boost::ref(b) );
+}
+
+// 8
+
+template<class F, class V> void test_8_(F f, V v1, V v2)
+{
+ test_eq( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v2) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v1, v2, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v2, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v2, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v2, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v2, v1, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v2, v1, v1, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v2, v1, v1, v1, v1, v1, v1, v1) );
+}
+
+template<class F> void test_8(F f)
+{
+ test_eq( boost::bind(f, _1, _2, _3, _4, _5, _6, _7, _8), boost::bind(f, _1, _2, _3, _4, _5, _6, _7, _8) );
+
+ test_8_( f, X(1), X(2) );
+
+ X a(0), b(0);
+ test_8_( f, boost::ref(a), boost::ref(b) );
+}
+
+// 9
+
+template<class F, class V> void test_9_(F f, V v1, V v2)
+{
+ test_eq( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1, v2) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v2, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v1, v2, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v1, v2, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v1, v2, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v1, v2, v1, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v1, v2, v1, v1, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v1, v2, v1, v1, v1, v1, v1, v1, v1) );
+ test_ne( boost::bind(f, v1, v1, v1, v1, v1, v1, v1, v1, v1), boost::bind(f, v2, v1, v1, v1, v1, v1, v1, v1, v1) );
+}
+
+template<class F> void test_9(F f)
+{
+ test_eq( boost::bind(f, _1, _2, _3, _4, _5, _6, _7, _8, _9), boost::bind(f, _1, _2, _3, _4, _5, _6, _7, _8, _9) );
+
+ test_9_( f, X(1), X(2) );
+
+ X a(0), b(0);
+ test_9_( f, boost::ref(a), boost::ref(b) );
+}
+
+int main()
+{
+ // 0
+
+ test_0( f_0 );
+ test_0( fv_0 );
+
+ // 1
+
+ test_1( f_1 );
+ test_1( fv_1 );
+
+ // 2
+
+ test_2( f_2 );
+ test_2( fv_2 );
+
+ // 3
+
+ test_3( f_3 );
+ test_3( fv_3 );
+
+ // 4
+
+ test_4( f_4 );
+ test_4( fv_4 );
+
+ // 5
+
+ test_5( f_5 );
+ test_5( fv_5 );
+
+ // 6
+
+ test_6( f_6 );
+ test_6( fv_6 );
+
+ // 7
+
+ test_7( f_7 );
+ test_7( fv_7 );
+
+ // 8
+
+ test_8( f_8 );
+ test_8( fv_8 );
+
+ // 9
+
+ test_9( f_9 );
+ test_9( fv_9 );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_fastcall_mf_test.cpp b/test/bind_fastcall_mf_test.cpp
new file mode 100644
index 0000000..e333ec7
--- /dev/null
+++ b/test/bind_fastcall_mf_test.cpp
@@ -0,0 +1,174 @@
+#include <boost/config.hpp>
+
+#ifndef BOOST_MSVC
+
+int main()
+{
+}
+
+#else
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_stdcall_mf_test.cpp - test for bind.hpp + __stdcall (member functions)
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+//
+// 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)
+//
+
+#define BOOST_MEM_FN_ENABLE_FASTCALL
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ void __fastcall f0() { f1(17); }
+ void __fastcall g0() const { g1(17); }
+
+ void __fastcall f1(int a1) { hash = (hash * 17041 + a1) % 32768; }
+ void __fastcall g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; }
+
+ void __fastcall f2(int a1, int a2) { f1(a1); f1(a2); }
+ void __fastcall g2(int a1, int a2) const { g1(a1); g1(a2); }
+
+ void __fastcall f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); }
+ void __fastcall g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); }
+
+ void __fastcall f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); }
+ void __fastcall g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); }
+
+ void __fastcall f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); }
+ void __fastcall g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); }
+
+ void __fastcall f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); }
+ void __fastcall g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); }
+
+ void __fastcall f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); }
+ void __fastcall g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); }
+
+ void __fastcall f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); }
+ void __fastcall g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); }
+};
+
+void member_function_test()
+{
+ using namespace boost;
+
+ X x;
+
+ // 0
+
+ bind(&X::f0, &x)();
+ bind(&X::f0, ref(x))();
+
+ bind(&X::g0, &x)();
+ bind(&X::g0, x)();
+ bind(&X::g0, ref(x))();
+
+ // 1
+
+ bind(&X::f1, &x, 1)();
+ bind(&X::f1, ref(x), 1)();
+
+ bind(&X::g1, &x, 1)();
+ bind(&X::g1, x, 1)();
+ bind(&X::g1, ref(x), 1)();
+
+ // 2
+
+ bind(&X::f2, &x, 1, 2)();
+ bind(&X::f2, ref(x), 1, 2)();
+
+ bind(&X::g2, &x, 1, 2)();
+ bind(&X::g2, x, 1, 2)();
+ bind(&X::g2, ref(x), 1, 2)();
+
+ // 3
+
+ bind(&X::f3, &x, 1, 2, 3)();
+ bind(&X::f3, ref(x), 1, 2, 3)();
+
+ bind(&X::g3, &x, 1, 2, 3)();
+ bind(&X::g3, x, 1, 2, 3)();
+ bind(&X::g3, ref(x), 1, 2, 3)();
+
+ // 4
+
+ bind(&X::f4, &x, 1, 2, 3, 4)();
+ bind(&X::f4, ref(x), 1, 2, 3, 4)();
+
+ bind(&X::g4, &x, 1, 2, 3, 4)();
+ bind(&X::g4, x, 1, 2, 3, 4)();
+ bind(&X::g4, ref(x), 1, 2, 3, 4)();
+
+ // 5
+
+ bind(&X::f5, &x, 1, 2, 3, 4, 5)();
+ bind(&X::f5, ref(x), 1, 2, 3, 4, 5)();
+
+ bind(&X::g5, &x, 1, 2, 3, 4, 5)();
+ bind(&X::g5, x, 1, 2, 3, 4, 5)();
+ bind(&X::g5, ref(x), 1, 2, 3, 4, 5)();
+
+ // 6
+
+ bind(&X::f6, &x, 1, 2, 3, 4, 5, 6)();
+ bind(&X::f6, ref(x), 1, 2, 3, 4, 5, 6)();
+
+ bind(&X::g6, &x, 1, 2, 3, 4, 5, 6)();
+ bind(&X::g6, x, 1, 2, 3, 4, 5, 6)();
+ bind(&X::g6, ref(x), 1, 2, 3, 4, 5, 6)();
+
+ // 7
+
+ bind(&X::f7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&X::f7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ bind(&X::g7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&X::g7, x, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&X::g7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ // 8
+
+ bind(&X::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&X::f8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ bind(&X::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&X::g8, x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&X::g8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ BOOST_TEST( x.hash == 23558 );
+}
+
+int main()
+{
+ member_function_test();
+ return boost::report_errors();
+}
+
+#endif
diff --git a/test/bind_fastcall_test.cpp b/test/bind_fastcall_test.cpp
new file mode 100644
index 0000000..b48c071
--- /dev/null
+++ b/test/bind_fastcall_test.cpp
@@ -0,0 +1,120 @@
+#include <boost/config.hpp>
+
+#ifndef BOOST_MSVC
+
+int main()
+{
+}
+
+#else
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_fastcall_test.cpp - test for bind.hpp + __fastcall (free functions)
+//
+// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+//
+// 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)
+//
+
+#define BOOST_BIND_ENABLE_FASTCALL
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+long __fastcall f_0()
+{
+ return 17041L;
+}
+
+long __fastcall f_1(long a)
+{
+ return a;
+}
+
+long __fastcall f_2(long a, long b)
+{
+ return a + 10 * b;
+}
+
+long __fastcall f_3(long a, long b, long c)
+{
+ return a + 10 * b + 100 * c;
+}
+
+long __fastcall f_4(long a, long b, long c, long d)
+{
+ return a + 10 * b + 100 * c + 1000 * d;
+}
+
+long __fastcall f_5(long a, long b, long c, long d, long e)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e;
+}
+
+long __fastcall f_6(long a, long b, long c, long d, long e, long f)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
+}
+
+long __fastcall f_7(long a, long b, long c, long d, long e, long f, long g)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
+}
+
+long __fastcall f_8(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
+}
+
+long __fastcall f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+void function_test()
+{
+ using namespace boost;
+
+ int const i = 1;
+
+ BOOST_TEST( bind(f_0)(i) == 17041L );
+ BOOST_TEST( bind(f_1, _1)(i) == 1L );
+ BOOST_TEST( bind(f_2, _1, 2)(i) == 21L );
+ BOOST_TEST( bind(f_3, _1, 2, 3)(i) == 321L );
+ BOOST_TEST( bind(f_4, _1, 2, 3, 4)(i) == 4321L );
+ BOOST_TEST( bind(f_5, _1, 2, 3, 4, 5)(i) == 54321L );
+ BOOST_TEST( bind(f_6, _1, 2, 3, 4, 5, 6)(i) == 654321L );
+ BOOST_TEST( bind(f_7, _1, 2, 3, 4, 5, 6, 7)(i) == 7654321L );
+ BOOST_TEST( bind(f_8, _1, 2, 3, 4, 5, 6, 7, 8)(i) == 87654321L );
+ BOOST_TEST( bind(f_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i) == 987654321L );
+}
+
+int main()
+{
+ function_test();
+ return boost::report_errors();
+}
+
+#endif
diff --git a/test/bind_fn2_test.cpp b/test/bind_fn2_test.cpp
new file mode 100644
index 0000000..93f587c
--- /dev/null
+++ b/test/bind_fn2_test.cpp
@@ -0,0 +1,171 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_fn2_test.cpp - test for functions w/ the type<> syntax
+//
+// Copyright (c) 2005, 2008 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+long global_result;
+
+// long
+
+long f_0()
+{
+ return global_result = 17041L;
+}
+
+long f_1(long a)
+{
+ return global_result = a;
+}
+
+long f_2(long a, long b)
+{
+ return global_result = a + 10 * b;
+}
+
+long f_3(long a, long b, long c)
+{
+ return global_result = a + 10 * b + 100 * c;
+}
+
+long f_4(long a, long b, long c, long d)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d;
+}
+
+long f_5(long a, long b, long c, long d, long e)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e;
+}
+
+long f_6(long a, long b, long c, long d, long e, long f)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
+}
+
+long f_7(long a, long b, long c, long d, long e, long f, long g)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
+}
+
+long f_8(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
+}
+
+long f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+// void
+
+void fv_0()
+{
+ global_result = 17041L;
+}
+
+void fv_1(long a)
+{
+ global_result = a;
+}
+
+void fv_2(long a, long b)
+{
+ global_result = a + 10 * b;
+}
+
+void fv_3(long a, long b, long c)
+{
+ global_result = a + 10 * b + 100 * c;
+}
+
+void fv_4(long a, long b, long c, long d)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d;
+}
+
+void fv_5(long a, long b, long c, long d, long e)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e;
+}
+
+void fv_6(long a, long b, long c, long d, long e, long f)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
+}
+
+void fv_7(long a, long b, long c, long d, long e, long f, long g)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
+}
+
+void fv_8(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
+}
+
+void fv_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+void function_test()
+{
+ using namespace boost;
+
+ bind( type<void>(), f_0 )(); BOOST_TEST( global_result == 17041L );
+ bind( type<void>(), f_1, 1 )(); BOOST_TEST( global_result == 1L );
+ bind( type<void>(), f_2, 1, 2 )(); BOOST_TEST( global_result == 21L );
+ bind( type<void>(), f_3, 1, 2, 3 )(); BOOST_TEST( global_result == 321L );
+ bind( type<void>(), f_4, 1, 2, 3, 4 )(); BOOST_TEST( global_result == 4321L );
+ bind( type<void>(), f_5, 1, 2, 3, 4, 5 )(); BOOST_TEST( global_result == 54321L );
+ bind( type<void>(), f_6, 1, 2, 3, 4, 5, 6 )(); BOOST_TEST( global_result == 654321L );
+ bind( type<void>(), f_7, 1, 2, 3, 4, 5, 6, 7 )(); BOOST_TEST( global_result == 7654321L );
+ bind( type<void>(), f_8, 1, 2, 3, 4, 5, 6, 7, 8 )(); BOOST_TEST( global_result == 87654321L );
+ bind( type<void>(), f_9, 1, 2, 3, 4, 5, 6, 7, 8, 9 )(); BOOST_TEST( global_result == 987654321L );
+
+ bind( type<void>(), fv_0 )(); BOOST_TEST( global_result == 17041L );
+ bind( type<void>(), fv_1, 1 )(); BOOST_TEST( global_result == 1L );
+ bind( type<void>(), fv_2, 1, 2 )(); BOOST_TEST( global_result == 21L );
+ bind( type<void>(), fv_3, 1, 2, 3 )(); BOOST_TEST( global_result == 321L );
+ bind( type<void>(), fv_4, 1, 2, 3, 4 )(); BOOST_TEST( global_result == 4321L );
+ bind( type<void>(), fv_5, 1, 2, 3, 4, 5 )(); BOOST_TEST( global_result == 54321L );
+ bind( type<void>(), fv_6, 1, 2, 3, 4, 5, 6 )(); BOOST_TEST( global_result == 654321L );
+ bind( type<void>(), fv_7, 1, 2, 3, 4, 5, 6, 7 )(); BOOST_TEST( global_result == 7654321L );
+ bind( type<void>(), fv_8, 1, 2, 3, 4, 5, 6, 7, 8 )(); BOOST_TEST( global_result == 87654321L );
+ bind( type<void>(), fv_9, 1, 2, 3, 4, 5, 6, 7, 8, 9 )(); BOOST_TEST( global_result == 987654321L );
+}
+
+int main()
+{
+ function_test();
+ return boost::report_errors();
+}
diff --git a/test/bind_fnobj2_test.cpp b/test/bind_fnobj2_test.cpp
new file mode 100644
index 0000000..a85fe5d
--- /dev/null
+++ b/test/bind_fnobj2_test.cpp
@@ -0,0 +1,76 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_fnobj2_test.cpp - test for function objects w/ the type<> syntax
+//
+// Copyright (c) 2005, 2008 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ int operator()() const { operator()(17); return 0; }
+ int operator()(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+ int operator()(int a1, int a2) const { operator()(a1); operator()(a2); return 0; }
+ int operator()(int a1, int a2, int a3) const { operator()(a1, a2); operator()(a3); return 0; }
+ int operator()(int a1, int a2, int a3, int a4) const { operator()(a1, a2, a3); operator()(a4); return 0; }
+ int operator()(int a1, int a2, int a3, int a4, int a5) const { operator()(a1, a2, a3, a4); operator()(a5); return 0; }
+ int operator()(int a1, int a2, int a3, int a4, int a5, int a6) const { operator()(a1, a2, a3, a4, a5); operator()(a6); return 0; }
+ int operator()(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { operator()(a1, a2, a3, a4, a5, a6); operator()(a7); return 0; }
+ int operator()(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { operator()(a1, a2, a3, a4, a5, a6, a7); operator()(a8); return 0; }
+ int operator()(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9) const { operator()(a1, a2, a3, a4, a5, a6, a7, a8); operator()(a9); return 0; }
+};
+
+void function_object_test()
+{
+ using namespace boost;
+
+ X x;
+
+ bind( type<void>(), ref(x) )();
+ bind( type<void>(), ref(x), 1 )();
+ bind( type<void>(), ref(x), 1, 2 )();
+ bind( type<void>(), ref(x), 1, 2, 3 )();
+ bind( type<void>(), ref(x), 1, 2, 3, 4 )();
+ bind( type<void>(), ref(x), 1, 2, 3, 4, 5 )();
+ bind( type<void>(), ref(x), 1, 2, 3, 4, 5, 6 )();
+ bind( type<void>(), ref(x), 1, 2, 3, 4, 5, 6, 7)();
+ bind( type<void>(), ref(x), 1, 2, 3, 4, 5, 6, 7, 8 )();
+ bind( type<void>(), ref(x), 1, 2, 3, 4, 5, 6, 7, 8, 9 )();
+
+ BOOST_TEST( x.hash == 9932 );
+}
+
+int main()
+{
+ function_object_test();
+ return boost::report_errors();
+}
diff --git a/test/bind_function2_test.cpp b/test/bind_function2_test.cpp
new file mode 100644
index 0000000..f991248
--- /dev/null
+++ b/test/bind_function2_test.cpp
@@ -0,0 +1,118 @@
+#include <boost/config.hpp>
+
+//
+// bind_function2_test.cpp - regression test
+//
+// Copyright (c) 2015 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
+//
+
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+void fv1( int & a )
+{
+ a = 17041;
+}
+
+void fv2( int & a, int b )
+{
+ a = b;
+}
+
+void fv3( int & a, int b, int c )
+{
+ a = b + c;
+}
+
+void fv4( int & a, int b, int c, int d )
+{
+ a = b + c + d;
+}
+
+void fv5( int & a, int b, int c, int d, int e )
+{
+ a = b + c + d + e;
+}
+
+void fv6( int & a, int b, int c, int d, int e, int f )
+{
+ a = b + c + d + e + f;
+}
+
+void fv7( int & a, int b, int c, int d, int e, int f, int g )
+{
+ a = b + c + d + e + f + g;
+}
+
+void fv8( int & a, int b, int c, int d, int e, int f, int g, int h )
+{
+ a = b + c + d + e + f + g + h;
+}
+
+void fv9( int & a, int b, int c, int d, int e, int f, int g, int h, int i )
+{
+ a = b + c + d + e + f + g + h + i;
+}
+
+void function_test()
+{
+ int x = 0;
+
+ {
+ boost::function<void(int&)> fw1 = boost::bind( fv1, _1 );
+ fw1( x ); BOOST_TEST( x == 17041 );
+ }
+
+ {
+ boost::function<void(int&, int)> fw2 = boost::bind( fv2, _1, _2 );
+ fw2( x, 1 ); BOOST_TEST( x == 1 );
+ }
+
+ {
+ boost::function<void(int&, int, int)> fw3 = boost::bind( fv3, _1, _2, _3 );
+ fw3( x, 1, 2 ); BOOST_TEST( x == 1+2 );
+ }
+
+ {
+ boost::function<void(int&, int, int, int)> fw4 = boost::bind( fv4, _1, _2, _3, _4 );
+ fw4( x, 1, 2, 3 ); BOOST_TEST( x == 1+2+3 );
+ }
+
+ {
+ boost::function<void(int&, int, int, int, int)> fw5 = boost::bind( fv5, _1, _2, _3, _4, _5 );
+ fw5( x, 1, 2, 3, 4 ); BOOST_TEST( x == 1+2+3+4 );
+ }
+
+ {
+ boost::function<void(int&, int, int, int, int, int)> fw6 = boost::bind( fv6, _1, _2, _3, _4, _5, _6 );
+ fw6( x, 1, 2, 3, 4, 5 ); BOOST_TEST( x == 1+2+3+4+5 );
+ }
+
+ {
+ boost::function<void(int&, int, int, int, int, int, int)> fw7 = boost::bind( fv7, _1, _2, _3, _4, _5, _6, _7 );
+ fw7( x, 1, 2, 3, 4, 5, 6 ); BOOST_TEST( x == 1+2+3+4+5+6 );
+ }
+
+ {
+ boost::function<void(int&, int, int, int, int, int, int, int)> fw8 = boost::bind( fv8, _1, _2, _3, _4, _5, _6, _7, _8 );
+ fw8( x, 1, 2, 3, 4, 5, 6, 7 ); BOOST_TEST( x == 1+2+3+4+5+6+7 );
+ }
+
+ {
+ boost::function<void(int&, int, int, int, int, int, int, int, int)> fw9 = boost::bind( fv9, _1, _2, _3, _4, _5, _6, _7, _8, _9 );
+ fw9( x, 1, 2, 3, 4, 5, 6, 7, 8 ); BOOST_TEST( x == 1+2+3+4+5+6+7+8 );
+ }
+}
+
+int main()
+{
+ function_test();
+ return boost::report_errors();
+}
diff --git a/test/bind_function_ap_test.cpp b/test/bind_function_ap_test.cpp
new file mode 100644
index 0000000..67551d3
--- /dev/null
+++ b/test/bind_function_ap_test.cpp
@@ -0,0 +1,234 @@
+#include <boost/config.hpp>
+
+//
+// bind_function_ap_test.cpp - regression test
+//
+// Copyright (c) 2015 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_NO_AUTO_PTR )
+
+int main()
+{
+}
+
+#else
+
+#if defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 406 )
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined( __clang__ ) && defined( __has_warning )
+# if __has_warning( "-Wdeprecated-declarations" )
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+# endif
+#endif
+
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <memory>
+
+//
+
+void fv1( std::auto_ptr<int> p1 )
+{
+ BOOST_TEST( *p1 == 1 );
+}
+
+void fv2( std::auto_ptr<int> p1, std::auto_ptr<int> p2 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+}
+
+void fv3( std::auto_ptr<int> p1, std::auto_ptr<int> p2, std::auto_ptr<int> p3 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+}
+
+void fv4( std::auto_ptr<int> p1, std::auto_ptr<int> p2, std::auto_ptr<int> p3, std::auto_ptr<int> p4 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+ BOOST_TEST( *p4 == 4 );
+}
+
+void fv5( std::auto_ptr<int> p1, std::auto_ptr<int> p2, std::auto_ptr<int> p3, std::auto_ptr<int> p4, std::auto_ptr<int> p5 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+ BOOST_TEST( *p4 == 4 );
+ BOOST_TEST( *p5 == 5 );
+}
+
+void fv6( std::auto_ptr<int> p1, std::auto_ptr<int> p2, std::auto_ptr<int> p3, std::auto_ptr<int> p4, std::auto_ptr<int> p5, std::auto_ptr<int> p6 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+ BOOST_TEST( *p4 == 4 );
+ BOOST_TEST( *p5 == 5 );
+ BOOST_TEST( *p6 == 6 );
+}
+
+void fv7( std::auto_ptr<int> p1, std::auto_ptr<int> p2, std::auto_ptr<int> p3, std::auto_ptr<int> p4, std::auto_ptr<int> p5, std::auto_ptr<int> p6, std::auto_ptr<int> p7 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+ BOOST_TEST( *p4 == 4 );
+ BOOST_TEST( *p5 == 5 );
+ BOOST_TEST( *p6 == 6 );
+ BOOST_TEST( *p7 == 7 );
+}
+
+void fv8( std::auto_ptr<int> p1, std::auto_ptr<int> p2, std::auto_ptr<int> p3, std::auto_ptr<int> p4, std::auto_ptr<int> p5, std::auto_ptr<int> p6, std::auto_ptr<int> p7, std::auto_ptr<int> p8 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+ BOOST_TEST( *p4 == 4 );
+ BOOST_TEST( *p5 == 5 );
+ BOOST_TEST( *p6 == 6 );
+ BOOST_TEST( *p7 == 7 );
+ BOOST_TEST( *p8 == 8 );
+}
+
+void fv9( std::auto_ptr<int> p1, std::auto_ptr<int> p2, std::auto_ptr<int> p3, std::auto_ptr<int> p4, std::auto_ptr<int> p5, std::auto_ptr<int> p6, std::auto_ptr<int> p7, std::auto_ptr<int> p8, std::auto_ptr<int> p9 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+ BOOST_TEST( *p4 == 4 );
+ BOOST_TEST( *p5 == 5 );
+ BOOST_TEST( *p6 == 6 );
+ BOOST_TEST( *p7 == 7 );
+ BOOST_TEST( *p8 == 8 );
+ BOOST_TEST( *p9 == 9 );
+}
+
+void test()
+{
+ {
+ boost::function<void(std::auto_ptr<int>)> fw1 = boost::bind( fv1, _1 );
+
+ std::auto_ptr<int> p1( new int(1) );
+
+ fw1( p1 );
+ }
+
+ {
+ boost::function<void(std::auto_ptr<int>, std::auto_ptr<int>)> fw2 = boost::bind( fv2, _1, _2 );
+
+ std::auto_ptr<int> p1( new int(1) );
+ std::auto_ptr<int> p2( new int(2) );
+
+ fw2( p1, p2 );
+ }
+
+ {
+ boost::function<void(std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>)> fw3 = boost::bind( fv3, _1, _2, _3 );
+
+ std::auto_ptr<int> p1( new int(1) );
+ std::auto_ptr<int> p2( new int(2) );
+ std::auto_ptr<int> p3( new int(3) );
+
+ fw3( p1, p2, p3 );
+ }
+
+ {
+ boost::function<void(std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>)> fw4 = boost::bind( fv4, _1, _2, _3, _4 );
+
+ std::auto_ptr<int> p1( new int(1) );
+ std::auto_ptr<int> p2( new int(2) );
+ std::auto_ptr<int> p3( new int(3) );
+ std::auto_ptr<int> p4( new int(4) );
+
+ fw4( p1, p2, p3, p4 );
+ }
+
+ {
+ boost::function<void(std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>)> fw5 = boost::bind( fv5, _1, _2, _3, _4, _5 );
+
+ std::auto_ptr<int> p1( new int(1) );
+ std::auto_ptr<int> p2( new int(2) );
+ std::auto_ptr<int> p3( new int(3) );
+ std::auto_ptr<int> p4( new int(4) );
+ std::auto_ptr<int> p5( new int(5) );
+
+ fw5( p1, p2, p3, p4, p5 );
+ }
+
+ {
+ boost::function<void(std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>)> fw6 = boost::bind( fv6, _1, _2, _3, _4, _5, _6 );
+
+ std::auto_ptr<int> p1( new int(1) );
+ std::auto_ptr<int> p2( new int(2) );
+ std::auto_ptr<int> p3( new int(3) );
+ std::auto_ptr<int> p4( new int(4) );
+ std::auto_ptr<int> p5( new int(5) );
+ std::auto_ptr<int> p6( new int(6) );
+
+ fw6( p1, p2, p3, p4, p5, p6 );
+ }
+
+ {
+ boost::function<void(std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>)> fw7 = boost::bind( fv7, _1, _2, _3, _4, _5, _6, _7 );
+
+ std::auto_ptr<int> p1( new int(1) );
+ std::auto_ptr<int> p2( new int(2) );
+ std::auto_ptr<int> p3( new int(3) );
+ std::auto_ptr<int> p4( new int(4) );
+ std::auto_ptr<int> p5( new int(5) );
+ std::auto_ptr<int> p6( new int(6) );
+ std::auto_ptr<int> p7( new int(7) );
+
+ fw7( p1, p2, p3, p4, p5, p6, p7 );
+ }
+
+ {
+ boost::function<void(std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>)> fw8 = boost::bind( fv8, _1, _2, _3, _4, _5, _6, _7, _8 );
+
+ std::auto_ptr<int> p1( new int(1) );
+ std::auto_ptr<int> p2( new int(2) );
+ std::auto_ptr<int> p3( new int(3) );
+ std::auto_ptr<int> p4( new int(4) );
+ std::auto_ptr<int> p5( new int(5) );
+ std::auto_ptr<int> p6( new int(6) );
+ std::auto_ptr<int> p7( new int(7) );
+ std::auto_ptr<int> p8( new int(8) );
+
+ fw8( p1, p2, p3, p4, p5, p6, p7, p8 );
+ }
+
+ {
+ boost::function<void(std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>, std::auto_ptr<int>)> fw9 = boost::bind( fv9, _1, _2, _3, _4, _5, _6, _7, _8, _9 );
+
+ std::auto_ptr<int> p1( new int(1) );
+ std::auto_ptr<int> p2( new int(2) );
+ std::auto_ptr<int> p3( new int(3) );
+ std::auto_ptr<int> p4( new int(4) );
+ std::auto_ptr<int> p5( new int(5) );
+ std::auto_ptr<int> p6( new int(6) );
+ std::auto_ptr<int> p7( new int(7) );
+ std::auto_ptr<int> p8( new int(8) );
+ std::auto_ptr<int> p9( new int(9) );
+
+ fw9( p1, p2, p3, p4, p5, p6, p7, p8, p9 );
+ }
+}
+
+int main()
+{
+ test();
+ return boost::report_errors();
+}
+
+#endif // #if defined( BOOST_NO_AUTO_PTR )
diff --git a/test/bind_function_test.cpp b/test/bind_function_test.cpp
new file mode 100644
index 0000000..5ce18c4
--- /dev/null
+++ b/test/bind_function_test.cpp
@@ -0,0 +1,77 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_function_test.cpp - function<>
+//
+// Copyright (c) 2005 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_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+#include <boost/function.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/bind.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int f( int x )
+{
+ return x;
+}
+
+int g( int x )
+{
+ return x + 1;
+}
+
+int main()
+{
+ boost::function0<int> fn;
+
+ BOOST_TEST( !fn.contains( boost::bind( f, 1 ) ) );
+ BOOST_TEST( !fn.contains( boost::bind( f, 2 ) ) );
+ BOOST_TEST( !fn.contains( boost::bind( g, 1 ) ) );
+
+ fn = boost::bind( f, 1 );
+
+ BOOST_TEST( fn() == 1 );
+
+ BOOST_TEST( fn.contains( boost::bind( f, 1 ) ) );
+ BOOST_TEST( !fn.contains( boost::bind( f, 2 ) ) );
+ BOOST_TEST( !fn.contains( boost::bind( g, 1 ) ) );
+
+ fn = boost::bind( f, 2 );
+
+ BOOST_TEST( fn() == 2 );
+
+ BOOST_TEST( !fn.contains( boost::bind( f, 1 ) ) );
+ BOOST_TEST( fn.contains( boost::bind( f, 2 ) ) );
+ BOOST_TEST( !fn.contains( boost::bind( g, 1 ) ) );
+
+ fn = boost::bind( g, 1 );
+
+ BOOST_TEST( fn() == 2 );
+
+ BOOST_TEST( !fn.contains( boost::bind( f, 1 ) ) );
+ BOOST_TEST( !fn.contains( boost::bind( f, 2 ) ) );
+ BOOST_TEST( fn.contains( boost::bind( g, 1 ) ) );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_fwd2_test.cpp b/test/bind_fwd2_test.cpp
new file mode 100644
index 0000000..5b7bf9c
--- /dev/null
+++ b/test/bind_fwd2_test.cpp
@@ -0,0 +1,121 @@
+#include <boost/config.hpp>
+
+//
+// bind_fwd2_test.cpp - forwarding test for 2 arguments
+//
+// Copyright (c) 2015 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
+//
+
+#include <boost/bind.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+int fv1( int const & a )
+{
+ return a;
+}
+
+void fv2_1( int & a, int const & b )
+{
+ a = b;
+}
+
+void fv2_2( int const & a, int & b )
+{
+ b = a;
+}
+
+int fv2_3( int const & a, int const & b )
+{
+ return a+b;
+}
+
+void test()
+{
+ {
+ int const a = 1;
+ int r = boost::bind( fv1, _1 )( a );
+ BOOST_TEST( r == 1 );
+ }
+
+ {
+ int r = boost::bind( fv1, _1 )( 1 );
+ BOOST_TEST( r == 1 );
+ }
+
+ {
+ int a = 1;
+ int const b = 2;
+
+ boost::bind( fv2_1, _1, _2 )( a, b );
+
+ BOOST_TEST( a == 2 );
+ }
+
+ {
+ int a = 1;
+
+ boost::bind( fv2_1, _1, _2 )( a, 2 );
+
+ BOOST_TEST( a == 2 );
+ }
+
+ {
+ int const a = 1;
+ int b = 2;
+
+ boost::bind( fv2_2, _1, _2 )( a, b );
+
+ BOOST_TEST( b == 1 );
+ }
+
+ {
+ int b = 2;
+
+ boost::bind( fv2_2, _1, _2 )( 1, b );
+
+ BOOST_TEST( b == 1 );
+ }
+
+ {
+ int const a = 1;
+ int const b = 2;
+
+ int r = boost::bind( fv2_3, _1, _2 )( a, b );
+
+ BOOST_TEST( r == 3 );
+ }
+
+ {
+ int const a = 1;
+
+ int r = boost::bind( fv2_3, _1, _2 )( a, 2 );
+
+ BOOST_TEST( r == 3 );
+ }
+
+ {
+ int const b = 2;
+
+ int r = boost::bind( fv2_3, _1, _2 )( 1, b );
+
+ BOOST_TEST( r == 3 );
+ }
+
+ {
+ int r = boost::bind( fv2_3, _1, _2 )( 1, 2 );
+
+ BOOST_TEST( r == 3 );
+ }
+}
+
+int main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/test/bind_fwd_test.cpp b/test/bind_fwd_test.cpp
new file mode 100644
index 0000000..92bd3b1
--- /dev/null
+++ b/test/bind_fwd_test.cpp
@@ -0,0 +1,250 @@
+#include <boost/config.hpp>
+
+//
+// bind_fwd_test.cpp - forwarding test
+//
+// Copyright (c) 2015 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
+//
+
+#include <boost/bind.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+void fv1( int & a )
+{
+ a = 1;
+}
+
+void fv2( int & a, int & b )
+{
+ a = 1;
+ b = 2;
+}
+
+void fv3( int & a, int & b, int & c )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+}
+
+void fv4( int & a, int & b, int & c, int & d )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+}
+
+void fv5( int & a, int & b, int & c, int & d, int & e )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ e = 5;
+}
+
+void fv6( int & a, int & b, int & c, int & d, int & e, int & f )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ e = 5;
+ f = 6;
+}
+
+void fv7( int & a, int & b, int & c, int & d, int & e, int & f, int & g )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ e = 5;
+ f = 6;
+ g = 7;
+}
+
+void fv8( int & a, int & b, int & c, int & d, int & e, int & f, int & g, int & h )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ e = 5;
+ f = 6;
+ g = 7;
+ h = 8;
+}
+
+void fv9( int & a, int & b, int & c, int & d, int & e, int & f, int & g, int & h, int & i )
+{
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ e = 5;
+ f = 6;
+ g = 7;
+ h = 8;
+ i = 9;
+}
+
+void test()
+{
+ {
+ int a = 0;
+
+ boost::bind( fv1, _1 )( a );
+
+ BOOST_TEST( a == 1 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+
+ boost::bind( fv2, _1, _2 )( a, b );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+
+ boost::bind( fv3, _1, _2, _3 )( a, b, c );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+ int d = 0;
+
+ boost::bind( fv4, _1, _2, _3, _4 )( a, b, c, d );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ BOOST_TEST( d == 4 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+ int d = 0;
+ int e = 0;
+
+ boost::bind( fv5, _1, _2, _3, _4, _5 )( a, b, c, d, e );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ BOOST_TEST( d == 4 );
+ BOOST_TEST( e == 5 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+ int d = 0;
+ int e = 0;
+ int f = 0;
+
+ boost::bind( fv6, _1, _2, _3, _4, _5, _6 )( a, b, c, d, e, f );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ BOOST_TEST( d == 4 );
+ BOOST_TEST( e == 5 );
+ BOOST_TEST( f == 6 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+ int d = 0;
+ int e = 0;
+ int f = 0;
+ int g = 0;
+
+ boost::bind( fv7, _1, _2, _3, _4, _5, _6, _7 )( a, b, c, d, e, f, g );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ BOOST_TEST( d == 4 );
+ BOOST_TEST( e == 5 );
+ BOOST_TEST( f == 6 );
+ BOOST_TEST( g == 7 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+ int d = 0;
+ int e = 0;
+ int f = 0;
+ int g = 0;
+ int h = 0;
+
+ boost::bind( fv8, _1, _2, _3, _4, _5, _6, _7, _8 )( a, b, c, d, e, f, g, h );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ BOOST_TEST( d == 4 );
+ BOOST_TEST( e == 5 );
+ BOOST_TEST( f == 6 );
+ BOOST_TEST( g == 7 );
+ BOOST_TEST( h == 8 );
+ }
+
+ {
+ int a = 0;
+ int b = 0;
+ int c = 0;
+ int d = 0;
+ int e = 0;
+ int f = 0;
+ int g = 0;
+ int h = 0;
+ int i = 0;
+
+ boost::bind( fv9, _1, _2, _3, _4, _5, _6, _7, _8, _9 )( a, b, c, d, e, f, g, h, i );
+
+ BOOST_TEST( a == 1 );
+ BOOST_TEST( b == 2 );
+ BOOST_TEST( c == 3 );
+ BOOST_TEST( d == 4 );
+ BOOST_TEST( e == 5 );
+ BOOST_TEST( f == 6 );
+ BOOST_TEST( g == 7 );
+ BOOST_TEST( h == 8 );
+ BOOST_TEST( i == 9 );
+ }
+}
+
+int main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/test/bind_lookup_problem_test.cpp b/test/bind_lookup_problem_test.cpp
new file mode 100644
index 0000000..269b80a
--- /dev/null
+++ b/test/bind_lookup_problem_test.cpp
@@ -0,0 +1,40 @@
+//
+// bind_lookup_problem_test.cpp
+//
+// Copyright (C) Markus Schoepflin 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)
+//
+
+#include <boost/bind.hpp>
+
+template<class T> void value();
+
+void f0() { }
+void f1(int) { }
+void f2(int, int) { }
+void f3(int, int, int) { }
+void f4(int, int, int, int) { }
+void f5(int, int, int, int, int) { }
+void f6(int, int, int, int, int, int) { }
+void f7(int, int, int, int, int, int, int) { }
+void f8(int, int, int, int, int, int, int, int) { }
+void f9(int, int, int, int, int, int, int, int, int) { }
+
+int main()
+{
+ boost::bind(f0);
+ boost::bind(f1, 0);
+ boost::bind(f2, 0, 0);
+ boost::bind(f3, 0, 0, 0);
+ boost::bind(f4, 0, 0, 0, 0);
+ boost::bind(f5, 0, 0, 0, 0, 0);
+ boost::bind(f6, 0, 0, 0, 0, 0, 0);
+ boost::bind(f7, 0, 0, 0, 0, 0, 0, 0);
+ boost::bind(f8, 0, 0, 0, 0, 0, 0, 0, 0);
+ boost::bind(f9, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+
+ return 0;
+}
diff --git a/test/bind_mf2_test.cpp b/test/bind_mf2_test.cpp
new file mode 100644
index 0000000..c04f958
--- /dev/null
+++ b/test/bind_mf2_test.cpp
@@ -0,0 +1,162 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_mf2_test.cpp - test for member functions w/ the type<> syntax
+//
+// Copyright (c) 2005, 2008 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ int f0() { f1(17); return 0; }
+ int g0() const { g1(17); return 0; }
+
+ int f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+
+ int f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
+ int g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
+
+ int f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
+ int g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
+
+ int f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
+ int g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
+
+ int f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
+
+ int f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+
+ int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+
+ int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+};
+
+void member_function_test()
+{
+ using namespace boost;
+
+ X x;
+
+ // 0
+
+ bind( type<void>(), &X::f0, &x )();
+ bind( type<void>(), &X::f0, ref(x) )();
+
+ bind( type<void>(), &X::g0, &x )();
+ bind( type<void>(), &X::g0, x )();
+ bind( type<void>(), &X::g0, ref(x) )();
+
+ // 1
+
+ bind( type<void>(), &X::f1, &x, 1 )();
+ bind( type<void>(), &X::f1, ref(x), 1 )();
+
+ bind( type<void>(), &X::g1, &x, 1 )();
+ bind( type<void>(), &X::g1, x, 1 )();
+ bind( type<void>(), &X::g1, ref(x), 1 )();
+
+ // 2
+
+ bind( type<void>(), &X::f2, &x, 1, 2 )();
+ bind( type<void>(), &X::f2, ref(x), 1, 2 )();
+
+ bind( type<void>(), &X::g2, &x, 1, 2 )();
+ bind( type<void>(), &X::g2, x, 1, 2 )();
+ bind( type<void>(), &X::g2, ref(x), 1, 2 )();
+
+ // 3
+
+ bind( type<void>(), &X::f3, &x, 1, 2, 3 )();
+ bind( type<void>(), &X::f3, ref(x), 1, 2, 3 )();
+
+ bind( type<void>(), &X::g3, &x, 1, 2, 3 )();
+ bind( type<void>(), &X::g3, x, 1, 2, 3 )();
+ bind( type<void>(), &X::g3, ref(x), 1, 2, 3 )();
+
+ // 4
+
+ bind( type<void>(), &X::f4, &x, 1, 2, 3, 4 )();
+ bind( type<void>(), &X::f4, ref(x), 1, 2, 3, 4 )();
+
+ bind( type<void>(), &X::g4, &x, 1, 2, 3, 4 )();
+ bind( type<void>(), &X::g4, x, 1, 2, 3, 4 )();
+ bind( type<void>(), &X::g4, ref(x), 1, 2, 3, 4 )();
+
+ // 5
+
+ bind( type<void>(), &X::f5, &x, 1, 2, 3, 4, 5 )();
+ bind( type<void>(), &X::f5, ref(x), 1, 2, 3, 4, 5 )();
+
+ bind( type<void>(), &X::g5, &x, 1, 2, 3, 4, 5 )();
+ bind( type<void>(), &X::g5, x, 1, 2, 3, 4, 5 )();
+ bind( type<void>(), &X::g5, ref(x), 1, 2, 3, 4, 5 )();
+
+ // 6
+
+ bind( type<void>(), &X::f6, &x, 1, 2, 3, 4, 5, 6 )();
+ bind( type<void>(), &X::f6, ref(x), 1, 2, 3, 4, 5, 6 )();
+
+ bind( type<void>(), &X::g6, &x, 1, 2, 3, 4, 5, 6 )();
+ bind( type<void>(), &X::g6, x, 1, 2, 3, 4, 5, 6 )();
+ bind( type<void>(), &X::g6, ref(x), 1, 2, 3, 4, 5, 6 )();
+
+ // 7
+
+ bind( type<void>(), &X::f7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind( type<void>(), &X::f7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ bind( type<void>(), &X::g7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind( type<void>(), &X::g7, x, 1, 2, 3, 4, 5, 6, 7)();
+ bind( type<void>(), &X::g7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ // 8
+
+ bind( type<void>(), &X::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8 )();
+ bind( type<void>(), &X::f8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8 )();
+
+ bind( type<void>(), &X::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8 )();
+ bind( type<void>(), &X::g8, x, 1, 2, 3, 4, 5, 6, 7, 8 )();
+ bind( type<void>(), &X::g8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8 )();
+
+ BOOST_TEST( x.hash == 23558 );
+}
+
+int main()
+{
+ member_function_test();
+ return boost::report_errors();
+}
diff --git a/test/bind_nested_rv_test.cpp b/test/bind_nested_rv_test.cpp
new file mode 100644
index 0000000..281088f
--- /dev/null
+++ b/test/bind_nested_rv_test.cpp
@@ -0,0 +1,177 @@
+#include <boost/config.hpp>
+
+//
+// bind_nested_rv_test.cpp
+//
+// Copyright (c) 2016 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
+//
+
+#include <boost/bind.hpp>
+#include <boost/make_shared.hpp>
+#include <boost/function.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+bool f1( boost::shared_ptr<int> p1 )
+{
+ BOOST_TEST( p1 != 0 && *p1 == 1 );
+ return true;
+}
+
+bool f2( boost::shared_ptr<int> p1, boost::shared_ptr<int> p2 )
+{
+ BOOST_TEST( p1 != 0 && *p1 == 1 );
+ BOOST_TEST( p2 != 0 && *p2 == 2 );
+ return true;
+}
+
+bool f3( boost::shared_ptr<int> p1, boost::shared_ptr<int> p2, boost::shared_ptr<int> p3 )
+{
+ BOOST_TEST( p1 != 0 && *p1 == 1 );
+ BOOST_TEST( p2 != 0 && *p2 == 2 );
+ BOOST_TEST( p3 != 0 && *p3 == 3 );
+ return true;
+}
+
+bool f4( boost::shared_ptr<int> p1, boost::shared_ptr<int> p2, boost::shared_ptr<int> p3, boost::shared_ptr<int> p4 )
+{
+ BOOST_TEST( p1 != 0 && *p1 == 1 );
+ BOOST_TEST( p2 != 0 && *p2 == 2 );
+ BOOST_TEST( p3 != 0 && *p3 == 3 );
+ BOOST_TEST( p4 != 0 && *p4 == 4 );
+ return true;
+}
+
+bool f5( boost::shared_ptr<int> p1, boost::shared_ptr<int> p2, boost::shared_ptr<int> p3, boost::shared_ptr<int> p4, boost::shared_ptr<int> p5 )
+{
+ BOOST_TEST( p1 != 0 && *p1 == 1 );
+ BOOST_TEST( p2 != 0 && *p2 == 2 );
+ BOOST_TEST( p3 != 0 && *p3 == 3 );
+ BOOST_TEST( p4 != 0 && *p4 == 4 );
+ BOOST_TEST( p5 != 0 && *p5 == 5 );
+ return true;
+}
+
+bool f6( boost::shared_ptr<int> p1, boost::shared_ptr<int> p2, boost::shared_ptr<int> p3, boost::shared_ptr<int> p4, boost::shared_ptr<int> p5, boost::shared_ptr<int> p6 )
+{
+ BOOST_TEST( p1 != 0 && *p1 == 1 );
+ BOOST_TEST( p2 != 0 && *p2 == 2 );
+ BOOST_TEST( p3 != 0 && *p3 == 3 );
+ BOOST_TEST( p4 != 0 && *p4 == 4 );
+ BOOST_TEST( p5 != 0 && *p5 == 5 );
+ BOOST_TEST( p6 != 0 && *p6 == 6 );
+ return true;
+}
+
+bool f7( boost::shared_ptr<int> p1, boost::shared_ptr<int> p2, boost::shared_ptr<int> p3, boost::shared_ptr<int> p4, boost::shared_ptr<int> p5, boost::shared_ptr<int> p6, boost::shared_ptr<int> p7 )
+{
+ BOOST_TEST( p1 != 0 && *p1 == 1 );
+ BOOST_TEST( p2 != 0 && *p2 == 2 );
+ BOOST_TEST( p3 != 0 && *p3 == 3 );
+ BOOST_TEST( p4 != 0 && *p4 == 4 );
+ BOOST_TEST( p5 != 0 && *p5 == 5 );
+ BOOST_TEST( p6 != 0 && *p6 == 6 );
+ BOOST_TEST( p7 != 0 && *p7 == 7 );
+ return true;
+}
+
+bool f8( boost::shared_ptr<int> p1, boost::shared_ptr<int> p2, boost::shared_ptr<int> p3, boost::shared_ptr<int> p4, boost::shared_ptr<int> p5, boost::shared_ptr<int> p6, boost::shared_ptr<int> p7, boost::shared_ptr<int> p8 )
+{
+ BOOST_TEST( p1 != 0 && *p1 == 1 );
+ BOOST_TEST( p2 != 0 && *p2 == 2 );
+ BOOST_TEST( p3 != 0 && *p3 == 3 );
+ BOOST_TEST( p4 != 0 && *p4 == 4 );
+ BOOST_TEST( p5 != 0 && *p5 == 5 );
+ BOOST_TEST( p6 != 0 && *p6 == 6 );
+ BOOST_TEST( p7 != 0 && *p7 == 7 );
+ BOOST_TEST( p8 != 0 && *p8 == 8 );
+ return true;
+}
+
+bool f9( boost::shared_ptr<int> p1, boost::shared_ptr<int> p2, boost::shared_ptr<int> p3, boost::shared_ptr<int> p4, boost::shared_ptr<int> p5, boost::shared_ptr<int> p6, boost::shared_ptr<int> p7, boost::shared_ptr<int> p8, boost::shared_ptr<int> p9 )
+{
+ BOOST_TEST( p1 != 0 && *p1 == 1 );
+ BOOST_TEST( p2 != 0 && *p2 == 2 );
+ BOOST_TEST( p3 != 0 && *p3 == 3 );
+ BOOST_TEST( p4 != 0 && *p4 == 4 );
+ BOOST_TEST( p5 != 0 && *p5 == 5 );
+ BOOST_TEST( p6 != 0 && *p6 == 6 );
+ BOOST_TEST( p7 != 0 && *p7 == 7 );
+ BOOST_TEST( p8 != 0 && *p8 == 8 );
+ BOOST_TEST( p9 != 0 && *p9 == 9 );
+ return true;
+}
+
+void test()
+{
+ {
+ boost::function<bool(boost::shared_ptr<int>)> f( f1 );
+
+ ( boost::bind( f, _1 ) && boost::bind( f1, _1 ) )( boost::make_shared<int>( 1 ) );
+ }
+
+ {
+ boost::function<bool(boost::shared_ptr<int>, boost::shared_ptr<int>)> f( f2 );
+
+ ( boost::bind( f, _1, _2 ) && boost::bind( f2, _1, _2 ) )( boost::make_shared<int>( 1 ), boost::make_shared<int>( 2 ) );
+ }
+
+ {
+ boost::function<bool(boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>)> f( f3 );
+
+ ( boost::bind( f, _1, _2, _3 ) && boost::bind( f3, _1, _2, _3 ) )( boost::make_shared<int>( 1 ), boost::make_shared<int>( 2 ), boost::make_shared<int>( 3 ) );
+ }
+
+ {
+ boost::function<bool(boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>)> f( f3 );
+
+ ( boost::bind( f, _1, _2, _3 ) && boost::bind( f3, _1, _2, _3 ) )( boost::make_shared<int>( 1 ), boost::make_shared<int>( 2 ), boost::make_shared<int>( 3 ) );
+ }
+
+ {
+ boost::function<bool(boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>)> f( f4 );
+
+ ( boost::bind( f, _1, _2, _3, _4 ) && boost::bind( f4, _1, _2, _3, _4 ) )( boost::make_shared<int>( 1 ), boost::make_shared<int>( 2 ), boost::make_shared<int>( 3 ), boost::make_shared<int>( 4 ) );
+ }
+
+ {
+ boost::function<bool(boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>)> f( f5 );
+
+ ( boost::bind( f, _1, _2, _3, _4, _5 ) && boost::bind( f5, _1, _2, _3, _4, _5 ) )( boost::make_shared<int>( 1 ), boost::make_shared<int>( 2 ), boost::make_shared<int>( 3 ), boost::make_shared<int>( 4 ), boost::make_shared<int>( 5 ) );
+ }
+
+ {
+ boost::function<bool(boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>)> f( f6 );
+
+ ( boost::bind( f, _1, _2, _3, _4, _5, _6 ) && boost::bind( f6, _1, _2, _3, _4, _5, _6 ) )( boost::make_shared<int>( 1 ), boost::make_shared<int>( 2 ), boost::make_shared<int>( 3 ), boost::make_shared<int>( 4 ), boost::make_shared<int>( 5 ), boost::make_shared<int>( 6 ) );
+ }
+
+ {
+ boost::function<bool(boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>)> f( f7 );
+
+ ( boost::bind( f, _1, _2, _3, _4, _5, _6, _7 ) && boost::bind( f7, _1, _2, _3, _4, _5, _6, _7 ) )( boost::make_shared<int>( 1 ), boost::make_shared<int>( 2 ), boost::make_shared<int>( 3 ), boost::make_shared<int>( 4 ), boost::make_shared<int>( 5 ), boost::make_shared<int>( 6 ), boost::make_shared<int>( 7 ) );
+ }
+
+ {
+ boost::function<bool(boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>)> f( f8 );
+
+ ( boost::bind( f, _1, _2, _3, _4, _5, _6, _7, _8 ) && boost::bind( f8, _1, _2, _3, _4, _5, _6, _7, _8 ) )( boost::make_shared<int>( 1 ), boost::make_shared<int>( 2 ), boost::make_shared<int>( 3 ), boost::make_shared<int>( 4 ), boost::make_shared<int>( 5 ), boost::make_shared<int>( 6 ), boost::make_shared<int>( 7 ), boost::make_shared<int>( 8 ) );
+ }
+
+ {
+ boost::function<bool(boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>, boost::shared_ptr<int>)> f( f9 );
+
+ ( boost::bind( f, _1, _2, _3, _4, _5, _6, _7, _8, _9 ) && boost::bind( f9, _1, _2, _3, _4, _5, _6, _7, _8, _9 ) )( boost::make_shared<int>( 1 ), boost::make_shared<int>( 2 ), boost::make_shared<int>( 3 ), boost::make_shared<int>( 4 ), boost::make_shared<int>( 5 ), boost::make_shared<int>( 6 ), boost::make_shared<int>( 7 ), boost::make_shared<int>( 8 ), boost::make_shared<int>( 9 ) );
+ }
+}
+
+int main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/test/bind_no_placeholders_test.cpp b/test/bind_no_placeholders_test.cpp
new file mode 100644
index 0000000..840823d
--- /dev/null
+++ b/test/bind_no_placeholders_test.cpp
@@ -0,0 +1,99 @@
+//
+// bind_no_placeholders_test.cpp - test for BOOST_BIND_NO_PLACEHOLDERS
+//
+// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2001 David Abrahams
+// Copyright (c) 2015 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
+//
+
+#define BOOST_BIND_NO_PLACEHOLDERS
+#include <boost/bind.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+//
+
+long f_0()
+{
+ return 17041L;
+}
+
+long f_1(long a)
+{
+ return a;
+}
+
+long f_2(long a, long b)
+{
+ return a + 10 * b;
+}
+
+long f_3(long a, long b, long c)
+{
+ return a + 10 * b + 100 * c;
+}
+
+long f_4(long a, long b, long c, long d)
+{
+ return a + 10 * b + 100 * c + 1000 * d;
+}
+
+long f_5(long a, long b, long c, long d, long e)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e;
+}
+
+long f_6(long a, long b, long c, long d, long e, long f)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
+}
+
+long f_7(long a, long b, long c, long d, long e, long f, long g)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
+}
+
+long f_8(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
+}
+
+long f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+void function_test()
+{
+ using namespace boost;
+
+ arg<1> _1;
+ arg<2> _2;
+ arg<3> _3;
+ arg<4> _4;
+ arg<5> _5;
+ arg<6> _6;
+ arg<7> _7;
+ arg<8> _8;
+ arg<9> _9;
+
+ BOOST_TEST( bind(f_0)() == 17041L );
+ BOOST_TEST( bind(f_1, _1)(1) == 1L );
+ BOOST_TEST( bind(f_2, _1, _2)(1, 2) == 21L );
+ BOOST_TEST( bind(f_3, _1, _2, _3)(1, 2, 3) == 321L );
+ BOOST_TEST( bind(f_4, _1, _2, _3, _4)(1, 2, 3, 4) == 4321L );
+ BOOST_TEST( bind(f_5, _1, _2, _3, _4, _5)(1, 2, 3, 4, 5) == 54321L );
+ BOOST_TEST( bind(f_6, _1, _2, _3, _4, _5, _6)(1, 2, 3, 4, 5, 6) == 654321L );
+ BOOST_TEST( bind(f_7, _1, _2, _3, _4, _5, _6, _7)(1, 2, 3, 4, 5, 6, 7) == 7654321L );
+ BOOST_TEST( bind(f_8, _1, _2, _3, _4, _5, _6, _7, _8)(1, 2, 3, 4, 5, 6, 7, 8) == 87654321L );
+ BOOST_TEST( bind(f_9, _1, _2, _3, _4, _5, _6, _7, _8, _9)(1, 2, 3, 4, 5, 6, 7, 8, 9) == 987654321L );
+}
+
+int main()
+{
+ function_test();
+ return boost::report_errors();
+}
diff --git a/test/bind_noexcept_mf_test.cpp b/test/bind_noexcept_mf_test.cpp
new file mode 100644
index 0000000..752861c
--- /dev/null
+++ b/test/bind_noexcept_mf_test.cpp
@@ -0,0 +1,154 @@
+//
+// bind_noexcept_mf_test.cpp
+//
+// Copyright 2017 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)
+//
+
+#include <boost/bind.hpp>
+#include <boost/ref.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <boost/config.hpp>
+
+#if defined(BOOST_NO_CXX11_NOEXCEPT)
+
+int main()
+{
+}
+
+#else
+
+//
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ int f0() noexcept { f1(17); return 0; }
+ int g0() const noexcept { g1(17); return 0; }
+
+ int f1(int a1) noexcept { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int g1(int a1) const noexcept { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+
+ int f2(int a1, int a2) noexcept { f1(a1); f1(a2); return 0; }
+ int g2(int a1, int a2) const noexcept { g1(a1); g1(a2); return 0; }
+
+ int f3(int a1, int a2, int a3) noexcept { f2(a1, a2); f1(a3); return 0; }
+ int g3(int a1, int a2, int a3) const noexcept { g2(a1, a2); g1(a3); return 0; }
+
+ int f4(int a1, int a2, int a3, int a4) noexcept { f3(a1, a2, a3); f1(a4); return 0; }
+ int g4(int a1, int a2, int a3, int a4) const noexcept { g3(a1, a2, a3); g1(a4); return 0; }
+
+ int f5(int a1, int a2, int a3, int a4, int a5) noexcept { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int g5(int a1, int a2, int a3, int a4, int a5) const noexcept { g4(a1, a2, a3, a4); g1(a5); return 0; }
+
+ int f6(int a1, int a2, int a3, int a4, int a5, int a6) noexcept { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int g6(int a1, int a2, int a3, int a4, int a5, int a6) const noexcept { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+
+ int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) noexcept { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const noexcept { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+
+ int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) noexcept { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const noexcept { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+};
+
+void member_function_test()
+{
+ X x;
+
+ // 0
+
+ boost::bind(&X::f0, &x)();
+ boost::bind(&X::f0, boost::ref(x))();
+
+ boost::bind(&X::g0, &x)();
+ boost::bind(&X::g0, x)();
+ boost::bind(&X::g0, boost::ref(x))();
+
+ // 1
+
+ boost::bind(&X::f1, &x, 1)();
+ boost::bind(&X::f1, boost::ref(x), 1)();
+
+ boost::bind(&X::g1, &x, 1)();
+ boost::bind(&X::g1, x, 1)();
+ boost::bind(&X::g1, boost::ref(x), 1)();
+
+ // 2
+
+ boost::bind(&X::f2, &x, 1, 2)();
+ boost::bind(&X::f2, boost::ref(x), 1, 2)();
+
+ boost::bind(&X::g2, &x, 1, 2)();
+ boost::bind(&X::g2, x, 1, 2)();
+ boost::bind(&X::g2, boost::ref(x), 1, 2)();
+
+ // 3
+
+ boost::bind(&X::f3, &x, 1, 2, 3)();
+ boost::bind(&X::f3, boost::ref(x), 1, 2, 3)();
+
+ boost::bind(&X::g3, &x, 1, 2, 3)();
+ boost::bind(&X::g3, x, 1, 2, 3)();
+ boost::bind(&X::g3, boost::ref(x), 1, 2, 3)();
+
+ // 4
+
+ boost::bind(&X::f4, &x, 1, 2, 3, 4)();
+ boost::bind(&X::f4, boost::ref(x), 1, 2, 3, 4)();
+
+ boost::bind(&X::g4, &x, 1, 2, 3, 4)();
+ boost::bind(&X::g4, x, 1, 2, 3, 4)();
+ boost::bind(&X::g4, boost::ref(x), 1, 2, 3, 4)();
+
+ // 5
+
+ boost::bind(&X::f5, &x, 1, 2, 3, 4, 5)();
+ boost::bind(&X::f5, boost::ref(x), 1, 2, 3, 4, 5)();
+
+ boost::bind(&X::g5, &x, 1, 2, 3, 4, 5)();
+ boost::bind(&X::g5, x, 1, 2, 3, 4, 5)();
+ boost::bind(&X::g5, boost::ref(x), 1, 2, 3, 4, 5)();
+
+ // 6
+
+ boost::bind(&X::f6, &x, 1, 2, 3, 4, 5, 6)();
+ boost::bind(&X::f6, boost::ref(x), 1, 2, 3, 4, 5, 6)();
+
+ boost::bind(&X::g6, &x, 1, 2, 3, 4, 5, 6)();
+ boost::bind(&X::g6, x, 1, 2, 3, 4, 5, 6)();
+ boost::bind(&X::g6, boost::ref(x), 1, 2, 3, 4, 5, 6)();
+
+ // 7
+
+ boost::bind(&X::f7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ boost::bind(&X::f7, boost::ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ boost::bind(&X::g7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ boost::bind(&X::g7, x, 1, 2, 3, 4, 5, 6, 7)();
+ boost::bind(&X::g7, boost::ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ // 8
+
+ boost::bind(&X::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ boost::bind(&X::f8, boost::ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ boost::bind(&X::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ boost::bind(&X::g8, x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ boost::bind(&X::g8, boost::ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ BOOST_TEST( x.hash == 23558 );
+}
+
+int main()
+{
+ member_function_test();
+ return boost::report_errors();
+}
+
+#endif
diff --git a/test/bind_noexcept_test.cpp b/test/bind_noexcept_test.cpp
new file mode 100644
index 0000000..44af4f6
--- /dev/null
+++ b/test/bind_noexcept_test.cpp
@@ -0,0 +1,97 @@
+//
+// bind_noexcept_test.cpp
+//
+// Copyright 2017 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)
+//
+
+#include <boost/bind.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <boost/config.hpp>
+
+#if defined(BOOST_NO_CXX11_NOEXCEPT)
+
+int main()
+{
+}
+
+#else
+
+//
+
+long f_0() noexcept
+{
+ return 17041L;
+}
+
+long f_1(long a) noexcept
+{
+ return a;
+}
+
+long f_2(long a, long b) noexcept
+{
+ return a + 10 * b;
+}
+
+long f_3(long a, long b, long c) noexcept
+{
+ return a + 10 * b + 100 * c;
+}
+
+long f_4(long a, long b, long c, long d) noexcept
+{
+ return a + 10 * b + 100 * c + 1000 * d;
+}
+
+long f_5(long a, long b, long c, long d, long e) noexcept
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e;
+}
+
+long f_6(long a, long b, long c, long d, long e, long f) noexcept
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
+}
+
+long f_7(long a, long b, long c, long d, long e, long f, long g) noexcept
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
+}
+
+long f_8(long a, long b, long c, long d, long e, long f, long g, long h) noexcept
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
+}
+
+long f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i) noexcept
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+void function_test()
+{
+ int const i = 1;
+
+ BOOST_TEST( boost::bind(f_0)(i) == 17041L );
+ BOOST_TEST( boost::bind(f_1, _1)(i) == 1L );
+ BOOST_TEST( boost::bind(f_2, _1, 2)(i) == 21L );
+ BOOST_TEST( boost::bind(f_3, _1, 2, 3)(i) == 321L );
+ BOOST_TEST( boost::bind(f_4, _1, 2, 3, 4)(i) == 4321L );
+ BOOST_TEST( boost::bind(f_5, _1, 2, 3, 4, 5)(i) == 54321L );
+ BOOST_TEST( boost::bind(f_6, _1, 2, 3, 4, 5, 6)(i) == 654321L );
+ BOOST_TEST( boost::bind(f_7, _1, 2, 3, 4, 5, 6, 7)(i) == 7654321L );
+ BOOST_TEST( boost::bind(f_8, _1, 2, 3, 4, 5, 6, 7, 8)(i) == 87654321L );
+ BOOST_TEST( boost::bind(f_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i) == 987654321L );
+}
+
+int main()
+{
+ function_test();
+ return boost::report_errors();
+}
+
+#endif
diff --git a/test/bind_not_test.cpp b/test/bind_not_test.cpp
new file mode 100644
index 0000000..27da3f2
--- /dev/null
+++ b/test/bind_not_test.cpp
@@ -0,0 +1,57 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_not_test.cpp - operator!
+//
+// Copyright (c) 2005 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+template<class F, class A1, class R> void test( F f, A1 a1, R r )
+{
+ BOOST_TEST( f(a1) == r );
+}
+
+bool f( bool v )
+{
+ return v;
+}
+
+int g( int v )
+{
+ return v;
+}
+
+int main()
+{
+ test( !boost::bind( f, true ), 0, !f( true ) );
+ test( !boost::bind( g, _1 ), 5, !g( 5 ) );
+ test( boost::bind( f, !boost::bind( f, true ) ), 0, f( !f( true ) ) );
+ test( boost::bind( f, !boost::bind( f, _1 ) ), true, f( !f( true ) ) );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_placeholder_test.cpp b/test/bind_placeholder_test.cpp
new file mode 100644
index 0000000..174dd82
--- /dev/null
+++ b/test/bind_placeholder_test.cpp
@@ -0,0 +1,83 @@
+#include <boost/config.hpp>
+
+#if defined( BOOST_MSVC )
+
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+
+#endif
+
+// bind_placeholder_test.cpp - test custom placeholders
+//
+// Copyright (c) 2006 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)
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+long f( long a, long b, long c, long d, long e, long f, long g, long h, long i )
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+template< int I > struct custom_placeholder
+{
+};
+
+namespace boost
+{
+
+template< int I > struct is_placeholder< custom_placeholder< I > >
+{
+ enum { value = I };
+};
+
+} // namespace boost
+
+int main()
+{
+ int const x1 = 1;
+ int const x2 = 2;
+ int const x3 = 3;
+ int const x4 = 4;
+ int const x5 = 5;
+ int const x6 = 6;
+ int const x7 = 7;
+ int const x8 = 8;
+ int const x9 = 9;
+
+ custom_placeholder<1> p1;
+ custom_placeholder<2> p2;
+ custom_placeholder<3> p3;
+ custom_placeholder<4> p4;
+ custom_placeholder<5> p5;
+ custom_placeholder<6> p6;
+ custom_placeholder<7> p7;
+ custom_placeholder<8> p8;
+ custom_placeholder<9> p9;
+
+ BOOST_TEST(
+ boost::bind( f, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
+ ( x1, x2, x3, x4, x5, x6, x7, x8, x9 ) == 987654321L );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_ref_test.cpp b/test/bind_ref_test.cpp
new file mode 100644
index 0000000..f08172e
--- /dev/null
+++ b/test/bind_ref_test.cpp
@@ -0,0 +1,36 @@
+//
+// bind_ref_test.cpp - reference_wrapper
+//
+// Copyright (c) 2009 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
+//
+
+#include <boost/bind.hpp>
+#include <boost/ref.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ int f( int x )
+ {
+ return x;
+ }
+
+ int g( int x ) const
+ {
+ return -x;
+ }
+};
+
+int main()
+{
+ X x;
+
+ BOOST_TEST( boost::bind( &X::f, _1, 1 )( boost::ref( x ) ) == 1 );
+ BOOST_TEST( boost::bind( &X::g, _1, 2 )( boost::cref( x ) ) == -2 );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_rel_test.cpp b/test/bind_rel_test.cpp
new file mode 100644
index 0000000..5c50b6f
--- /dev/null
+++ b/test/bind_rel_test.cpp
@@ -0,0 +1,97 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_rel_test.cpp - ==, !=, <, <=, >, >= operators
+//
+// Copyright (c) 2005 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+int f( int x )
+{
+ return x + x;
+}
+
+int g( int x )
+{
+ return 2 * x;
+}
+
+int main()
+{
+ int x = 4;
+ int y = x + x;
+
+ // bind op value
+
+ BOOST_TEST( ( boost::bind( f, _1 ) == y )( x ) );
+ BOOST_TEST( !( ( boost::bind( f, _1 ) != y )( x ) ) );
+
+ BOOST_TEST( !( ( boost::bind( f, _1 ) < y )( x ) ) );
+ BOOST_TEST( ( boost::bind( f, _1 ) < y + 1 )( x ) );
+
+ BOOST_TEST( !( ( boost::bind( f, _1 ) > y )( x ) ) );
+ BOOST_TEST( ( boost::bind( f, _1 ) > y - 1 )( x ) );
+
+ BOOST_TEST( !( ( boost::bind( f, _1 ) <= y - 1 )( x ) ) );
+ BOOST_TEST( ( boost::bind( f, _1 ) <= y )( x ) );
+ BOOST_TEST( ( boost::bind( f, _1 ) <= y + 1 )( x ) );
+
+ BOOST_TEST( !( ( boost::bind( f, _1 ) >= y + 1 )( x ) ) );
+ BOOST_TEST( ( boost::bind( f, _1 ) >= y )( x ) );
+ BOOST_TEST( ( boost::bind( f, _1 ) >= y - 1 )( x ) );
+
+ // bind op ref
+
+ BOOST_TEST( ( boost::bind( f, _1 ) == boost::ref( y ) )( x ) );
+ BOOST_TEST( !( ( boost::bind( f, _1 ) != boost::ref( y ) )( x ) ) );
+ BOOST_TEST( !( ( boost::bind( f, _1 ) < boost::ref( y ) )( x ) ) );
+ BOOST_TEST( !( ( boost::bind( f, _1 ) > boost::ref( y ) )( x ) ) );
+ BOOST_TEST( ( boost::bind( f, _1 ) <= boost::ref( y ) )( x ) );
+ BOOST_TEST( ( boost::bind( f, _1 ) >= boost::ref( y ) )( x ) );
+
+ // bind op placeholder
+
+ BOOST_TEST( ( boost::bind( f, _1 ) == _2 )( x, y ) );
+ BOOST_TEST( !( ( boost::bind( f, _1 ) != _2 )( x, y ) ) );
+ BOOST_TEST( !( ( boost::bind( f, _1 ) < _2 )( x, y ) ) );
+ BOOST_TEST( !( ( boost::bind( f, _1 ) > _2 )( x, y ) ) );
+ BOOST_TEST( ( boost::bind( f, _1 ) <= _2 )( x, y ) );
+ BOOST_TEST( ( boost::bind( f, _1 ) >= _2 )( x, y ) );
+
+ // bind op bind
+
+ // important: bind( f, _1 ) and bind( g, _1 ) have the same type
+ BOOST_TEST( ( boost::bind( f, _1 ) == boost::bind( g, _1 ) )( x ) );
+ BOOST_TEST( !( ( boost::bind( f, _1 ) != boost::bind( g, _1 ) )( x ) ) );
+ BOOST_TEST( !( ( boost::bind( f, _1 ) < boost::bind( g, _1 ) )( x ) ) );
+ BOOST_TEST( ( boost::bind( f, _1 ) <= boost::bind( g, _1 ) )( x ) );
+ BOOST_TEST( !( ( boost::bind( f, _1 ) > boost::bind( g, _1 ) )( x ) ) );
+ BOOST_TEST( ( boost::bind( f, _1 ) >= boost::bind( g, _1 ) )( x ) );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_rv_sp_test.cpp b/test/bind_rv_sp_test.cpp
new file mode 100644
index 0000000..b5853cd
--- /dev/null
+++ b/test/bind_rv_sp_test.cpp
@@ -0,0 +1,64 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_rv_sp_test.cpp - smart pointer returned by value from an inner bind
+//
+// Copyright (c) 2005 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/shared_ptr.hpp>
+
+struct X
+{
+ int v_;
+
+ X( int v ): v_( v )
+ {
+ }
+
+ int f()
+ {
+ return v_;
+ }
+};
+
+struct Y
+{
+ boost::shared_ptr<X> f()
+ {
+ return boost::shared_ptr<X>( new X( 42 ) );
+ }
+};
+
+int main()
+{
+ Y y;
+
+ BOOST_TEST( boost::bind( &X::f, boost::bind( &Y::f, &y ) )() == 42 );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_rvalue_test.cpp b/test/bind_rvalue_test.cpp
new file mode 100644
index 0000000..e0bd229
--- /dev/null
+++ b/test/bind_rvalue_test.cpp
@@ -0,0 +1,81 @@
+#include <boost/config.hpp>
+
+#if defined( BOOST_MSVC )
+
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+
+#endif
+
+// bind_rvalue_test.cpp
+//
+// Copyright (c) 2006 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)
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+int f( int x )
+{
+ return x;
+}
+
+int main()
+{
+ BOOST_TEST(
+ boost::bind( f, _1 )
+ ( 1 ) == 1 );
+
+ BOOST_TEST(
+ boost::bind( f, _2 )
+ ( 1, 2 ) == 2 );
+
+ BOOST_TEST(
+ boost::bind( f, _3 )
+ ( 1, 2, 3 ) == 3 );
+
+ BOOST_TEST(
+ boost::bind( f, _4 )
+ ( 1, 2, 3, 4 ) == 4 );
+
+ BOOST_TEST(
+ boost::bind( f, _5 )
+ ( 1, 2, 3, 4, 5 ) == 5 );
+
+ BOOST_TEST(
+ boost::bind( f, _6 )
+ ( 1, 2, 3, 4, 5, 6 ) == 6 );
+
+ BOOST_TEST(
+ boost::bind( f, _7 )
+ ( 1, 2, 3, 4, 5, 6, 7 ) == 7 );
+
+ BOOST_TEST(
+ boost::bind( f, _8 )
+ ( 1, 2, 3, 4, 5, 6, 7, 8 ) == 8 );
+
+ BOOST_TEST(
+ boost::bind( f, _9 )
+ ( 1, 2, 3, 4, 5, 6, 7, 8, 9 ) == 9 );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_stateful_test.cpp b/test/bind_stateful_test.cpp
new file mode 100644
index 0000000..04fc0e8
--- /dev/null
+++ b/test/bind_stateful_test.cpp
@@ -0,0 +1,227 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_stateful_test.cpp
+//
+// Copyright (c) 2004 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+class X
+{
+private:
+
+ int state_;
+
+public:
+
+ X(): state_(0)
+ {
+ }
+
+ // SGI-related compilers have odd compiler-synthesized ctors and dtors
+ #ifdef __PATHSCALE__
+ ~X() {}
+ #endif
+
+ int state() const
+ {
+ return state_;
+ }
+
+ int operator()()
+ {
+ return state_ += 17041;
+ }
+
+ int operator()(int x1)
+ {
+ return state_ += x1;
+ }
+
+ int operator()(int x1, int x2)
+ {
+ return state_ += x1+x2;
+ }
+
+ int operator()(int x1, int x2, int x3)
+ {
+ return state_ += x1+x2+x3;
+ }
+
+ int operator()(int x1, int x2, int x3, int x4)
+ {
+ return state_ += x1+x2+x3+x4;
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5)
+ {
+ return state_ += x1+x2+x3+x4+x5;
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5, int x6)
+ {
+ return state_ += x1+x2+x3+x4+x5+x6;
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5, int x6, int x7)
+ {
+ return state_ += x1+x2+x3+x4+x5+x6+x7;
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8)
+ {
+ return state_ += x1+x2+x3+x4+x5+x6+x7+x8;
+ }
+
+ int operator()(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9)
+ {
+ return state_ += x1+x2+x3+x4+x5+x6+x7+x8+x9;
+ }
+};
+
+int f0(int & state_)
+{
+ return state_ += 17041;
+}
+
+int f1(int & state_, int x1)
+{
+ return state_ += x1;
+}
+
+int f2(int & state_, int x1, int x2)
+{
+ return state_ += x1+x2;
+}
+
+int f3(int & state_, int x1, int x2, int x3)
+{
+ return state_ += x1+x2+x3;
+}
+
+int f4(int & state_, int x1, int x2, int x3, int x4)
+{
+ return state_ += x1+x2+x3+x4;
+}
+
+int f5(int & state_, int x1, int x2, int x3, int x4, int x5)
+{
+ return state_ += x1+x2+x3+x4+x5;
+}
+
+int f6(int & state_, int x1, int x2, int x3, int x4, int x5, int x6)
+{
+ return state_ += x1+x2+x3+x4+x5+x6;
+}
+
+int f7(int & state_, int x1, int x2, int x3, int x4, int x5, int x6, int x7)
+{
+ return state_ += x1+x2+x3+x4+x5+x6+x7;
+}
+
+int f8(int & state_, int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8)
+{
+ return state_ += x1+x2+x3+x4+x5+x6+x7+x8;
+}
+
+template<class F> void test(F f, int a, int b)
+{
+ BOOST_TEST( f() == a + b );
+ BOOST_TEST( f() == a + 2*b );
+ BOOST_TEST( f() == a + 3*b );
+}
+
+void stateful_function_object_test()
+{
+ test( boost::bind<int>( X() ), 0, 17041 );
+ test( boost::bind<int>( X(), 1 ), 0, 1 );
+ test( boost::bind<int>( X(), 1, 2 ), 0, 1+2 );
+ test( boost::bind<int>( X(), 1, 2, 3 ), 0, 1+2+3 );
+ test( boost::bind<int>( X(), 1, 2, 3, 4 ), 0, 1+2+3+4 );
+ test( boost::bind<int>( X(), 1, 2, 3, 4, 5 ), 0, 1+2+3+4+5 );
+ test( boost::bind<int>( X(), 1, 2, 3, 4, 5, 6 ), 0, 1+2+3+4+5+6 );
+ test( boost::bind<int>( X(), 1, 2, 3, 4, 5, 6, 7 ), 0, 1+2+3+4+5+6+7 );
+ test( boost::bind<int>( X(), 1, 2, 3, 4, 5, 6, 7, 8 ), 0, 1+2+3+4+5+6+7+8 );
+ test( boost::bind<int>( X(), 1, 2, 3, 4, 5, 6, 7, 8, 9 ), 0, 1+2+3+4+5+6+7+8+9 );
+
+ X x;
+
+ int n = x.state();
+
+ test( boost::bind<int>( boost::ref(x) ), n, 17041 );
+ n += 3*17041;
+
+ test( boost::bind<int>( boost::ref(x), 1 ), n, 1 );
+ n += 3*1;
+
+ test( boost::bind<int>( boost::ref(x), 1, 2 ), n, 1+2 );
+ n += 3*(1+2);
+
+ test( boost::bind<int>( boost::ref(x), 1, 2, 3 ), n, 1+2+3 );
+ n += 3*(1+2+3);
+
+ test( boost::bind<int>( boost::ref(x), 1, 2, 3, 4 ), n, 1+2+3+4 );
+ n += 3*(1+2+3+4);
+
+ test( boost::bind<int>( boost::ref(x), 1, 2, 3, 4, 5 ), n, 1+2+3+4+5 );
+ n += 3*(1+2+3+4+5);
+
+ test( boost::bind<int>( boost::ref(x), 1, 2, 3, 4, 5, 6 ), n, 1+2+3+4+5+6 );
+ n += 3*(1+2+3+4+5+6);
+
+ test( boost::bind<int>( boost::ref(x), 1, 2, 3, 4, 5, 6, 7 ), n, 1+2+3+4+5+6+7 );
+ n += 3*(1+2+3+4+5+6+7);
+
+ test( boost::bind<int>( boost::ref(x), 1, 2, 3, 4, 5, 6, 7, 8 ), n, 1+2+3+4+5+6+7+8 );
+ n += 3*(1+2+3+4+5+6+7+8);
+
+ test( boost::bind<int>( boost::ref(x), 1, 2, 3, 4, 5, 6, 7, 8, 9 ), n, 1+2+3+4+5+6+7+8+9 );
+ n += 3*(1+2+3+4+5+6+7+8+9);
+
+ BOOST_TEST( x.state() == n );
+}
+
+void stateful_function_test()
+{
+ test( boost::bind( f0, 0 ), 0, 17041 );
+ test( boost::bind( f1, 0, 1 ), 0, 1 );
+ test( boost::bind( f2, 0, 1, 2 ), 0, 1+2 );
+ test( boost::bind( f3, 0, 1, 2, 3 ), 0, 1+2+3 );
+ test( boost::bind( f4, 0, 1, 2, 3, 4 ), 0, 1+2+3+4 );
+ test( boost::bind( f5, 0, 1, 2, 3, 4, 5 ), 0, 1+2+3+4+5 );
+ test( boost::bind( f6, 0, 1, 2, 3, 4, 5, 6 ), 0, 1+2+3+4+5+6 );
+ test( boost::bind( f7, 0, 1, 2, 3, 4, 5, 6, 7 ), 0, 1+2+3+4+5+6+7 );
+ test( boost::bind( f8, 0, 1, 2, 3, 4, 5, 6, 7, 8 ), 0, 1+2+3+4+5+6+7+8 );
+}
+
+int main()
+{
+ stateful_function_object_test();
+ stateful_function_test();
+ return boost::report_errors();
+}
diff --git a/test/bind_stdcall_mf_test.cpp b/test/bind_stdcall_mf_test.cpp
new file mode 100644
index 0000000..a7570c2
--- /dev/null
+++ b/test/bind_stdcall_mf_test.cpp
@@ -0,0 +1,174 @@
+#include <boost/config.hpp>
+
+#ifndef BOOST_MSVC
+
+int main()
+{
+}
+
+#else
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_stdcall_mf_test.cpp - test for bind.hpp + __stdcall (member functions)
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+//
+// 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)
+//
+
+#define BOOST_MEM_FN_ENABLE_STDCALL
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ int __stdcall f0() { f1(17); return 0; }
+ int __stdcall g0() const { g1(17); return 0; }
+
+ int __stdcall f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int __stdcall g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+
+ int __stdcall f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
+ int __stdcall g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
+
+ int __stdcall f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
+ int __stdcall g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
+
+ int __stdcall f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
+ int __stdcall g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
+
+ int __stdcall f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int __stdcall g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
+
+ int __stdcall f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int __stdcall g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+
+ int __stdcall f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int __stdcall g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+
+ int __stdcall f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int __stdcall g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+};
+
+void member_function_test()
+{
+ using namespace boost;
+
+ X x;
+
+ // 0
+
+ bind(&X::f0, &x)();
+ bind(&X::f0, ref(x))();
+
+ bind(&X::g0, &x)();
+ bind(&X::g0, x)();
+ bind(&X::g0, ref(x))();
+
+ // 1
+
+ bind(&X::f1, &x, 1)();
+ bind(&X::f1, ref(x), 1)();
+
+ bind(&X::g1, &x, 1)();
+ bind(&X::g1, x, 1)();
+ bind(&X::g1, ref(x), 1)();
+
+ // 2
+
+ bind(&X::f2, &x, 1, 2)();
+ bind(&X::f2, ref(x), 1, 2)();
+
+ bind(&X::g2, &x, 1, 2)();
+ bind(&X::g2, x, 1, 2)();
+ bind(&X::g2, ref(x), 1, 2)();
+
+ // 3
+
+ bind(&X::f3, &x, 1, 2, 3)();
+ bind(&X::f3, ref(x), 1, 2, 3)();
+
+ bind(&X::g3, &x, 1, 2, 3)();
+ bind(&X::g3, x, 1, 2, 3)();
+ bind(&X::g3, ref(x), 1, 2, 3)();
+
+ // 4
+
+ bind(&X::f4, &x, 1, 2, 3, 4)();
+ bind(&X::f4, ref(x), 1, 2, 3, 4)();
+
+ bind(&X::g4, &x, 1, 2, 3, 4)();
+ bind(&X::g4, x, 1, 2, 3, 4)();
+ bind(&X::g4, ref(x), 1, 2, 3, 4)();
+
+ // 5
+
+ bind(&X::f5, &x, 1, 2, 3, 4, 5)();
+ bind(&X::f5, ref(x), 1, 2, 3, 4, 5)();
+
+ bind(&X::g5, &x, 1, 2, 3, 4, 5)();
+ bind(&X::g5, x, 1, 2, 3, 4, 5)();
+ bind(&X::g5, ref(x), 1, 2, 3, 4, 5)();
+
+ // 6
+
+ bind(&X::f6, &x, 1, 2, 3, 4, 5, 6)();
+ bind(&X::f6, ref(x), 1, 2, 3, 4, 5, 6)();
+
+ bind(&X::g6, &x, 1, 2, 3, 4, 5, 6)();
+ bind(&X::g6, x, 1, 2, 3, 4, 5, 6)();
+ bind(&X::g6, ref(x), 1, 2, 3, 4, 5, 6)();
+
+ // 7
+
+ bind(&X::f7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&X::f7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ bind(&X::g7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&X::g7, x, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&X::g7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ // 8
+
+ bind(&X::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&X::f8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ bind(&X::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&X::g8, x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&X::g8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ BOOST_TEST( x.hash == 23558 );
+}
+
+int main()
+{
+ member_function_test();
+ return boost::report_errors();
+}
+
+#endif
diff --git a/test/bind_stdcall_test.cpp b/test/bind_stdcall_test.cpp
new file mode 100644
index 0000000..a009c9a
--- /dev/null
+++ b/test/bind_stdcall_test.cpp
@@ -0,0 +1,122 @@
+#include <boost/config.hpp>
+
+#ifndef BOOST_MSVC
+
+int main()
+{
+}
+
+#else
+
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_stdcall_test.cpp - test for bind.hpp + __stdcall (free functions)
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+//
+// 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)
+//
+
+#define BOOST_BIND_ENABLE_STDCALL
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+long __stdcall f_0()
+{
+ return 17041L;
+}
+
+long __stdcall f_1(long a)
+{
+ return a;
+}
+
+long __stdcall f_2(long a, long b)
+{
+ return a + 10 * b;
+}
+
+long __stdcall f_3(long a, long b, long c)
+{
+ return a + 10 * b + 100 * c;
+}
+
+long __stdcall f_4(long a, long b, long c, long d)
+{
+ return a + 10 * b + 100 * c + 1000 * d;
+}
+
+long __stdcall f_5(long a, long b, long c, long d, long e)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e;
+}
+
+long __stdcall f_6(long a, long b, long c, long d, long e, long f)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
+}
+
+long __stdcall f_7(long a, long b, long c, long d, long e, long f, long g)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
+}
+
+long __stdcall f_8(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
+}
+
+long __stdcall f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+void function_test()
+{
+ using namespace boost;
+
+ int const i = 1;
+
+ BOOST_TEST( bind(f_0)(i) == 17041L );
+ BOOST_TEST( bind(f_1, _1)(i) == 1L );
+ BOOST_TEST( bind(f_2, _1, 2)(i) == 21L );
+ BOOST_TEST( bind(f_3, _1, 2, 3)(i) == 321L );
+ BOOST_TEST( bind(f_4, _1, 2, 3, 4)(i) == 4321L );
+ BOOST_TEST( bind(f_5, _1, 2, 3, 4, 5)(i) == 54321L );
+ BOOST_TEST( bind(f_6, _1, 2, 3, 4, 5, 6)(i) == 654321L );
+ BOOST_TEST( bind(f_7, _1, 2, 3, 4, 5, 6, 7)(i) == 7654321L );
+ BOOST_TEST( bind(f_8, _1, 2, 3, 4, 5, 6, 7, 8)(i) == 87654321L );
+ BOOST_TEST( bind(f_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i) == 987654321L );
+}
+
+int main()
+{
+ function_test();
+ return boost::report_errors();
+}
+
+#endif
diff --git a/test/bind_test.cpp b/test/bind_test.cpp
new file mode 100644
index 0000000..ede5d49
--- /dev/null
+++ b/test/bind_test.cpp
@@ -0,0 +1,521 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_test.cpp - monolithic test for bind.hpp
+//
+// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2001 David Abrahams
+//
+// 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/bind.hpp>
+#include <boost/ref.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+long f_0()
+{
+ return 17041L;
+}
+
+long f_1(long a)
+{
+ return a;
+}
+
+long f_2(long a, long b)
+{
+ return a + 10 * b;
+}
+
+long f_3(long a, long b, long c)
+{
+ return a + 10 * b + 100 * c;
+}
+
+long f_4(long a, long b, long c, long d)
+{
+ return a + 10 * b + 100 * c + 1000 * d;
+}
+
+long f_5(long a, long b, long c, long d, long e)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e;
+}
+
+long f_6(long a, long b, long c, long d, long e, long f)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
+}
+
+long f_7(long a, long b, long c, long d, long e, long f, long g)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
+}
+
+long f_8(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
+}
+
+long f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
+{
+ return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+long global_result;
+
+void fv_0()
+{
+ global_result = 17041L;
+}
+
+void fv_1(long a)
+{
+ global_result = a;
+}
+
+void fv_2(long a, long b)
+{
+ global_result = a + 10 * b;
+}
+
+void fv_3(long a, long b, long c)
+{
+ global_result = a + 10 * b + 100 * c;
+}
+
+void fv_4(long a, long b, long c, long d)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d;
+}
+
+void fv_5(long a, long b, long c, long d, long e)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e;
+}
+
+void fv_6(long a, long b, long c, long d, long e, long f)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
+}
+
+void fv_7(long a, long b, long c, long d, long e, long f, long g)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
+}
+
+void fv_8(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
+}
+
+void fv_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
+{
+ global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+void function_test()
+{
+ using namespace boost;
+
+ int const i = 1;
+
+ BOOST_TEST( bind(f_0)(i) == 17041L );
+ BOOST_TEST( bind(f_1, _1)(i) == 1L );
+ BOOST_TEST( bind(f_2, _1, 2)(i) == 21L );
+ BOOST_TEST( bind(f_3, _1, 2, 3)(i) == 321L );
+ BOOST_TEST( bind(f_4, _1, 2, 3, 4)(i) == 4321L );
+ BOOST_TEST( bind(f_5, _1, 2, 3, 4, 5)(i) == 54321L );
+ BOOST_TEST( bind(f_6, _1, 2, 3, 4, 5, 6)(i) == 654321L );
+ BOOST_TEST( bind(f_7, _1, 2, 3, 4, 5, 6, 7)(i) == 7654321L );
+ BOOST_TEST( bind(f_8, _1, 2, 3, 4, 5, 6, 7, 8)(i) == 87654321L );
+ BOOST_TEST( bind(f_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i) == 987654321L );
+
+ BOOST_TEST( (bind(fv_0)(i), (global_result == 17041L)) );
+ BOOST_TEST( (bind(fv_1, _1)(i), (global_result == 1L)) );
+ BOOST_TEST( (bind(fv_2, _1, 2)(i), (global_result == 21L)) );
+ BOOST_TEST( (bind(fv_3, _1, 2, 3)(i), (global_result == 321L)) );
+ BOOST_TEST( (bind(fv_4, _1, 2, 3, 4)(i), (global_result == 4321L)) );
+ BOOST_TEST( (bind(fv_5, _1, 2, 3, 4, 5)(i), (global_result == 54321L)) );
+ BOOST_TEST( (bind(fv_6, _1, 2, 3, 4, 5, 6)(i), (global_result == 654321L)) );
+ BOOST_TEST( (bind(fv_7, _1, 2, 3, 4, 5, 6, 7)(i), (global_result == 7654321L)) );
+ BOOST_TEST( (bind(fv_8, _1, 2, 3, 4, 5, 6, 7, 8)(i), (global_result == 87654321L)) );
+ BOOST_TEST( (bind(fv_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i), (global_result == 987654321L)) );
+}
+
+//
+
+struct Y
+{
+ short operator()(short & r) const { return ++r; }
+ int operator()(int a, int b) const { return a + 10 * b; }
+ long operator() (long a, long b, long c) const { return a + 10 * b + 100 * c; }
+ void operator() (long a, long b, long c, long d) const { global_result = a + 10 * b + 100 * c + 1000 * d; }
+};
+
+void function_object_test()
+{
+ using namespace boost;
+
+ short i(6);
+
+ int const k = 3;
+
+ BOOST_TEST( bind<short>(Y(), ref(i))() == 7 );
+ BOOST_TEST( bind<short>(Y(), ref(i))() == 8 );
+ BOOST_TEST( bind<int>(Y(), i, _1)(k) == 38 );
+ BOOST_TEST( bind<long>(Y(), i, _1, 9)(k) == 938 );
+
+#if !defined(__MWERKS__) || (__MWERKS__ > 0x2407) // Fails for this version of the compiler.
+
+ global_result = 0;
+ bind<void>(Y(), i, _1, 9, 4)(k);
+ BOOST_TEST( global_result == 4938 );
+
+#endif
+}
+
+void function_object_test2()
+{
+ using namespace boost;
+
+ short i(6);
+
+ int const k = 3;
+
+ BOOST_TEST( bind(type<short>(), Y(), ref(i))() == 7 );
+ BOOST_TEST( bind(type<short>(), Y(), ref(i))() == 8 );
+ BOOST_TEST( bind(type<int>(), Y(), i, _1)(k) == 38 );
+ BOOST_TEST( bind(type<long>(), Y(), i, _1, 9)(k) == 938 );
+
+ global_result = 0;
+ bind(type<void>(), Y(), i, _1, 9, 4)(k);
+ BOOST_TEST( global_result == 4938 );
+}
+
+//
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+
+struct Z
+{
+ typedef int result_type;
+ int operator()(int a, int b) const { return a + 10 * b; }
+};
+
+void adaptable_function_object_test()
+{
+ BOOST_TEST( boost::bind(Z(), 7, 4)() == 47 );
+}
+
+#endif
+
+//
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ int f0() { f1(17); return 0; }
+ int g0() const { g1(17); return 0; }
+
+ int f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+
+ int f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
+ int g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
+
+ int f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
+ int g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
+
+ int f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
+ int g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
+
+ int f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
+
+ int f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+
+ int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+
+ int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+};
+
+struct V
+{
+ mutable unsigned int hash;
+
+ V(): hash(0) {}
+
+ void f0() { f1(17); }
+ void g0() const { g1(17); }
+
+ void f1(int a1) { hash = (hash * 17041 + a1) % 32768; }
+ void g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; }
+
+ void f2(int a1, int a2) { f1(a1); f1(a2); }
+ void g2(int a1, int a2) const { g1(a1); g1(a2); }
+
+ void f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); }
+ void g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); }
+
+ void f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); }
+ void g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); }
+
+ void f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); }
+ void g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); }
+
+ void f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); }
+ void g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); }
+
+ void f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); }
+ void g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); }
+
+ void f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); }
+ void g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); }
+};
+
+void member_function_test()
+{
+ using namespace boost;
+
+ X x;
+
+ // 0
+
+ bind(&X::f0, &x)();
+ bind(&X::f0, ref(x))();
+
+ bind(&X::g0, &x)();
+ bind(&X::g0, x)();
+ bind(&X::g0, ref(x))();
+
+ // 1
+
+ bind(&X::f1, &x, 1)();
+ bind(&X::f1, ref(x), 1)();
+
+ bind(&X::g1, &x, 1)();
+ bind(&X::g1, x, 1)();
+ bind(&X::g1, ref(x), 1)();
+
+ // 2
+
+ bind(&X::f2, &x, 1, 2)();
+ bind(&X::f2, ref(x), 1, 2)();
+
+ bind(&X::g2, &x, 1, 2)();
+ bind(&X::g2, x, 1, 2)();
+ bind(&X::g2, ref(x), 1, 2)();
+
+ // 3
+
+ bind(&X::f3, &x, 1, 2, 3)();
+ bind(&X::f3, ref(x), 1, 2, 3)();
+
+ bind(&X::g3, &x, 1, 2, 3)();
+ bind(&X::g3, x, 1, 2, 3)();
+ bind(&X::g3, ref(x), 1, 2, 3)();
+
+ // 4
+
+ bind(&X::f4, &x, 1, 2, 3, 4)();
+ bind(&X::f4, ref(x), 1, 2, 3, 4)();
+
+ bind(&X::g4, &x, 1, 2, 3, 4)();
+ bind(&X::g4, x, 1, 2, 3, 4)();
+ bind(&X::g4, ref(x), 1, 2, 3, 4)();
+
+ // 5
+
+ bind(&X::f5, &x, 1, 2, 3, 4, 5)();
+ bind(&X::f5, ref(x), 1, 2, 3, 4, 5)();
+
+ bind(&X::g5, &x, 1, 2, 3, 4, 5)();
+ bind(&X::g5, x, 1, 2, 3, 4, 5)();
+ bind(&X::g5, ref(x), 1, 2, 3, 4, 5)();
+
+ // 6
+
+ bind(&X::f6, &x, 1, 2, 3, 4, 5, 6)();
+ bind(&X::f6, ref(x), 1, 2, 3, 4, 5, 6)();
+
+ bind(&X::g6, &x, 1, 2, 3, 4, 5, 6)();
+ bind(&X::g6, x, 1, 2, 3, 4, 5, 6)();
+ bind(&X::g6, ref(x), 1, 2, 3, 4, 5, 6)();
+
+ // 7
+
+ bind(&X::f7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&X::f7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ bind(&X::g7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&X::g7, x, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&X::g7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ // 8
+
+ bind(&X::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&X::f8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ bind(&X::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&X::g8, x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&X::g8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ BOOST_TEST( x.hash == 23558 );
+}
+
+void member_function_void_test()
+{
+ using namespace boost;
+
+ V v;
+
+ // 0
+
+ bind(&V::f0, &v)();
+ bind(&V::f0, ref(v))();
+
+ bind(&V::g0, &v)();
+ bind(&V::g0, v)();
+ bind(&V::g0, ref(v))();
+
+ // 1
+
+ bind(&V::f1, &v, 1)();
+ bind(&V::f1, ref(v), 1)();
+
+ bind(&V::g1, &v, 1)();
+ bind(&V::g1, v, 1)();
+ bind(&V::g1, ref(v), 1)();
+
+ // 2
+
+ bind(&V::f2, &v, 1, 2)();
+ bind(&V::f2, ref(v), 1, 2)();
+
+ bind(&V::g2, &v, 1, 2)();
+ bind(&V::g2, v, 1, 2)();
+ bind(&V::g2, ref(v), 1, 2)();
+
+ // 3
+
+ bind(&V::f3, &v, 1, 2, 3)();
+ bind(&V::f3, ref(v), 1, 2, 3)();
+
+ bind(&V::g3, &v, 1, 2, 3)();
+ bind(&V::g3, v, 1, 2, 3)();
+ bind(&V::g3, ref(v), 1, 2, 3)();
+
+ // 4
+
+ bind(&V::f4, &v, 1, 2, 3, 4)();
+ bind(&V::f4, ref(v), 1, 2, 3, 4)();
+
+ bind(&V::g4, &v, 1, 2, 3, 4)();
+ bind(&V::g4, v, 1, 2, 3, 4)();
+ bind(&V::g4, ref(v), 1, 2, 3, 4)();
+
+ // 5
+
+ bind(&V::f5, &v, 1, 2, 3, 4, 5)();
+ bind(&V::f5, ref(v), 1, 2, 3, 4, 5)();
+
+ bind(&V::g5, &v, 1, 2, 3, 4, 5)();
+ bind(&V::g5, v, 1, 2, 3, 4, 5)();
+ bind(&V::g5, ref(v), 1, 2, 3, 4, 5)();
+
+ // 6
+
+ bind(&V::f6, &v, 1, 2, 3, 4, 5, 6)();
+ bind(&V::f6, ref(v), 1, 2, 3, 4, 5, 6)();
+
+ bind(&V::g6, &v, 1, 2, 3, 4, 5, 6)();
+ bind(&V::g6, v, 1, 2, 3, 4, 5, 6)();
+ bind(&V::g6, ref(v), 1, 2, 3, 4, 5, 6)();
+
+ // 7
+
+ bind(&V::f7, &v, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&V::f7, ref(v), 1, 2, 3, 4, 5, 6, 7)();
+
+ bind(&V::g7, &v, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&V::g7, v, 1, 2, 3, 4, 5, 6, 7)();
+ bind(&V::g7, ref(v), 1, 2, 3, 4, 5, 6, 7)();
+
+ // 8
+
+ bind(&V::f8, &v, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&V::f8, ref(v), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ bind(&V::g8, &v, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&V::g8, v, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind(&V::g8, ref(v), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ BOOST_TEST( v.hash == 23558 );
+}
+
+void nested_bind_test()
+{
+ using namespace boost;
+
+ int const x = 1;
+ int const y = 2;
+
+ BOOST_TEST( bind(f_1, bind(f_1, _1))(x) == 1L );
+ BOOST_TEST( bind(f_1, bind(f_2, _1, _2))(x, y) == 21L );
+ BOOST_TEST( bind(f_2, bind(f_1, _1), bind(f_1, _1))(x) == 11L );
+ BOOST_TEST( bind(f_2, bind(f_1, _1), bind(f_1, _2))(x, y) == 21L );
+ BOOST_TEST( bind(f_1, bind(f_0))() == 17041L );
+
+ BOOST_TEST( (bind(fv_1, bind(f_1, _1))(x), (global_result == 1L)) );
+ BOOST_TEST( (bind(fv_1, bind(f_2, _1, _2))(x, y), (global_result == 21L)) );
+ BOOST_TEST( (bind(fv_2, bind(f_1, _1), bind(f_1, _1))(x), (global_result == 11L)) );
+ BOOST_TEST( (bind(fv_2, bind(f_1, _1), bind(f_1, _2))(x, y), (global_result == 21L)) );
+ BOOST_TEST( (bind(fv_1, bind(f_0))(), (global_result == 17041L)) );
+}
+
+int main()
+{
+ function_test();
+ function_object_test();
+ function_object_test2();
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
+ adaptable_function_object_test();
+#endif
+
+ member_function_test();
+ member_function_void_test();
+ nested_bind_test();
+
+ return boost::report_errors();
+}
diff --git a/test/bind_type_test.cpp b/test/bind_type_test.cpp
new file mode 100644
index 0000000..fc58bad
--- /dev/null
+++ b/test/bind_type_test.cpp
@@ -0,0 +1,75 @@
+#include <boost/config.hpp>
+
+//
+// bind_type_test.cpp
+//
+// Copyright (c) 2015 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
+//
+
+#include <boost/bind.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+template<int I> struct X
+{
+};
+
+void fv1( X<1> )
+{
+}
+
+void fv2( X<1>, X<2> )
+{
+}
+
+void fv3( X<1>, X<2>, X<3> )
+{
+}
+
+void fv4( X<1>, X<2>, X<3>, X<4> )
+{
+}
+
+void fv5( X<1>, X<2>, X<3>, X<4>, X<5> )
+{
+}
+
+void fv6( X<1>, X<2>, X<3>, X<4>, X<5>, X<6> )
+{
+}
+
+void fv7( X<1>, X<2>, X<3>, X<4>, X<5>, X<6>, X<7> )
+{
+}
+
+void fv8( X<1>, X<2>, X<3>, X<4>, X<5>, X<6>, X<7>, X<8> )
+{
+}
+
+void fv9( X<1>, X<2>, X<3>, X<4>, X<5>, X<6>, X<7>, X<8>, X<9> )
+{
+}
+
+void test()
+{
+ boost::bind( fv1, _1 )( X<1>() );
+ boost::bind( fv2, _1, _2 )( X<1>(), X<2>() );
+ boost::bind( fv3, _1, _2, _3 )( X<1>(), X<2>(), X<3>() );
+ boost::bind( fv4, _1, _2, _3, _4 )( X<1>(), X<2>(), X<3>(), X<4>() );
+ boost::bind( fv5, _1, _2, _3, _4, _5 )( X<1>(), X<2>(), X<3>(), X<4>(), X<5>() );
+ boost::bind( fv6, _1, _2, _3, _4, _5, _6 )( X<1>(), X<2>(), X<3>(), X<4>(), X<5>(), X<6>() );
+ boost::bind( fv7, _1, _2, _3, _4, _5, _6, _7 )( X<1>(), X<2>(), X<3>(), X<4>(), X<5>(), X<6>(), X<7>() );
+ boost::bind( fv8, _1, _2, _3, _4, _5, _6, _7, _8 )( X<1>(), X<2>(), X<3>(), X<4>(), X<5>(), X<6>(), X<7>(), X<8>() );
+ boost::bind( fv9, _1, _2, _3, _4, _5, _6, _7, _8, _9 )( X<1>(), X<2>(), X<3>(), X<4>(), X<5>(), X<6>(), X<7>(), X<8>(), X<9>() );
+}
+
+int main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/test/bind_unary_addr.cpp b/test/bind_unary_addr.cpp
new file mode 100644
index 0000000..b211f0f
--- /dev/null
+++ b/test/bind_unary_addr.cpp
@@ -0,0 +1,147 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_unary_addr.cpp
+//
+// Copyright (c) 2005 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)
+//
+
+#include <boost/bind.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+class X
+{
+private:
+
+ void operator& ();
+ void operator& () const;
+
+public:
+
+ void operator()()
+ {
+ }
+
+ void operator()() const
+ {
+ }
+
+ void operator()(int)
+ {
+ }
+
+ void operator()(int) const
+ {
+ }
+
+ void operator()(int, int)
+ {
+ }
+
+ void operator()(int, int) const
+ {
+ }
+
+ void operator()(int, int, int)
+ {
+ }
+
+ void operator()(int, int, int) const
+ {
+ }
+
+ void operator()(int, int, int, int)
+ {
+ }
+
+ void operator()(int, int, int, int) const
+ {
+ }
+
+ void operator()(int, int, int, int, int)
+ {
+ }
+
+ void operator()(int, int, int, int, int) const
+ {
+ }
+
+ void operator()(int, int, int, int, int, int)
+ {
+ }
+
+ void operator()(int, int, int, int, int, int) const
+ {
+ }
+
+ void operator()(int, int, int, int, int, int, int)
+ {
+ }
+
+ void operator()(int, int, int, int, int, int, int) const
+ {
+ }
+
+ void operator()(int, int, int, int, int, int, int, int)
+ {
+ }
+
+ void operator()(int, int, int, int, int, int, int, int) const
+ {
+ }
+
+ void operator()(int, int, int, int, int, int, int, int, int)
+ {
+ }
+
+ void operator()(int, int, int, int, int, int, int, int, int) const
+ {
+ }
+};
+
+template<class F> void test_const( F const & f )
+{
+ f();
+}
+
+template<class F> void test( F f )
+{
+ f();
+ test_const( f );
+}
+
+int main()
+{
+ test( boost::bind<void>( X() ) );
+ test( boost::bind<void>( X(), 1 ) );
+ test( boost::bind<void>( X(), 1, 2 ) );
+ test( boost::bind<void>( X(), 1, 2, 3 ) );
+ test( boost::bind<void>( X(), 1, 2, 3, 4 ) );
+ test( boost::bind<void>( X(), 1, 2, 3, 4, 5 ) );
+ test( boost::bind<void>( X(), 1, 2, 3, 4, 5, 6 ) );
+ test( boost::bind<void>( X(), 1, 2, 3, 4, 5, 6, 7 ) );
+ test( boost::bind<void>( X(), 1, 2, 3, 4, 5, 6, 7, 8 ) );
+ test( boost::bind<void>( X(), 1, 2, 3, 4, 5, 6, 7, 8, 9 ) );
+
+ return 0;
+}
diff --git a/test/bind_unique_ptr_test.cpp b/test/bind_unique_ptr_test.cpp
new file mode 100644
index 0000000..4e648f5
--- /dev/null
+++ b/test/bind_unique_ptr_test.cpp
@@ -0,0 +1,207 @@
+#include <boost/config.hpp>
+
+#if defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) || defined( BOOST_NO_CXX11_SMART_PTR )
+
+int main()
+{
+}
+
+#else
+
+//
+// bind_unique_ptr_test.cpp
+//
+// Copyright (c) 2015 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
+//
+
+#include <boost/bind.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <memory>
+
+//
+
+void fv1( std::unique_ptr<int> p1 )
+{
+ BOOST_TEST( *p1 == 1 );
+}
+
+void fv2( std::unique_ptr<int> p1, std::unique_ptr<int> p2 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+}
+
+void fv3( std::unique_ptr<int> p1, std::unique_ptr<int> p2, std::unique_ptr<int> p3 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+}
+
+void fv4( std::unique_ptr<int> p1, std::unique_ptr<int> p2, std::unique_ptr<int> p3, std::unique_ptr<int> p4 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+ BOOST_TEST( *p4 == 4 );
+}
+
+void fv5( std::unique_ptr<int> p1, std::unique_ptr<int> p2, std::unique_ptr<int> p3, std::unique_ptr<int> p4, std::unique_ptr<int> p5 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+ BOOST_TEST( *p4 == 4 );
+ BOOST_TEST( *p5 == 5 );
+}
+
+void fv6( std::unique_ptr<int> p1, std::unique_ptr<int> p2, std::unique_ptr<int> p3, std::unique_ptr<int> p4, std::unique_ptr<int> p5, std::unique_ptr<int> p6 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+ BOOST_TEST( *p4 == 4 );
+ BOOST_TEST( *p5 == 5 );
+ BOOST_TEST( *p6 == 6 );
+}
+
+void fv7( std::unique_ptr<int> p1, std::unique_ptr<int> p2, std::unique_ptr<int> p3, std::unique_ptr<int> p4, std::unique_ptr<int> p5, std::unique_ptr<int> p6, std::unique_ptr<int> p7 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+ BOOST_TEST( *p4 == 4 );
+ BOOST_TEST( *p5 == 5 );
+ BOOST_TEST( *p6 == 6 );
+ BOOST_TEST( *p7 == 7 );
+}
+
+void fv8( std::unique_ptr<int> p1, std::unique_ptr<int> p2, std::unique_ptr<int> p3, std::unique_ptr<int> p4, std::unique_ptr<int> p5, std::unique_ptr<int> p6, std::unique_ptr<int> p7, std::unique_ptr<int> p8 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+ BOOST_TEST( *p4 == 4 );
+ BOOST_TEST( *p5 == 5 );
+ BOOST_TEST( *p6 == 6 );
+ BOOST_TEST( *p7 == 7 );
+ BOOST_TEST( *p8 == 8 );
+}
+
+void fv9( std::unique_ptr<int> p1, std::unique_ptr<int> p2, std::unique_ptr<int> p3, std::unique_ptr<int> p4, std::unique_ptr<int> p5, std::unique_ptr<int> p6, std::unique_ptr<int> p7, std::unique_ptr<int> p8, std::unique_ptr<int> p9 )
+{
+ BOOST_TEST( *p1 == 1 );
+ BOOST_TEST( *p2 == 2 );
+ BOOST_TEST( *p3 == 3 );
+ BOOST_TEST( *p4 == 4 );
+ BOOST_TEST( *p5 == 5 );
+ BOOST_TEST( *p6 == 6 );
+ BOOST_TEST( *p7 == 7 );
+ BOOST_TEST( *p8 == 8 );
+ BOOST_TEST( *p9 == 9 );
+}
+
+void test()
+{
+ {
+ std::unique_ptr<int> p1( new int(1) );
+
+ boost::bind( fv1, _1 )( std::move( p1 ) );
+ }
+
+ {
+ std::unique_ptr<int> p1( new int(1) );
+ std::unique_ptr<int> p2( new int(2) );
+
+ boost::bind( fv2, _1, _2 )( std::move( p1 ), std::move( p2 ) );
+ }
+
+ {
+ std::unique_ptr<int> p1( new int(1) );
+ std::unique_ptr<int> p2( new int(2) );
+ std::unique_ptr<int> p3( new int(3) );
+
+ boost::bind( fv3, _1, _2, _3 )( std::move( p1 ), std::move( p2 ), std::move( p3 ) );
+ }
+
+ {
+ std::unique_ptr<int> p1( new int(1) );
+ std::unique_ptr<int> p2( new int(2) );
+ std::unique_ptr<int> p3( new int(3) );
+ std::unique_ptr<int> p4( new int(4) );
+
+ boost::bind( fv4, _1, _2, _3, _4 )( std::move( p1 ), std::move( p2 ), std::move( p3 ), std::move( p4 ) );
+ }
+
+ {
+ std::unique_ptr<int> p1( new int(1) );
+ std::unique_ptr<int> p2( new int(2) );
+ std::unique_ptr<int> p3( new int(3) );
+ std::unique_ptr<int> p4( new int(4) );
+ std::unique_ptr<int> p5( new int(5) );
+
+ boost::bind( fv5, _1, _2, _3, _4, _5 )( std::move( p1 ), std::move( p2 ), std::move( p3 ), std::move( p4 ), std::move( p5 ) );
+ }
+
+ {
+ std::unique_ptr<int> p1( new int(1) );
+ std::unique_ptr<int> p2( new int(2) );
+ std::unique_ptr<int> p3( new int(3) );
+ std::unique_ptr<int> p4( new int(4) );
+ std::unique_ptr<int> p5( new int(5) );
+ std::unique_ptr<int> p6( new int(6) );
+
+ boost::bind( fv6, _1, _2, _3, _4, _5, _6 )( std::move( p1 ), std::move( p2 ), std::move( p3 ), std::move( p4 ), std::move( p5 ), std::move( p6 ) );
+ }
+
+ {
+ std::unique_ptr<int> p1( new int(1) );
+ std::unique_ptr<int> p2( new int(2) );
+ std::unique_ptr<int> p3( new int(3) );
+ std::unique_ptr<int> p4( new int(4) );
+ std::unique_ptr<int> p5( new int(5) );
+ std::unique_ptr<int> p6( new int(6) );
+ std::unique_ptr<int> p7( new int(7) );
+
+ boost::bind( fv7, _1, _2, _3, _4, _5, _6, _7 )( std::move( p1 ), std::move( p2 ), std::move( p3 ), std::move( p4 ), std::move( p5 ), std::move( p6 ), std::move( p7 ) );
+ }
+
+ {
+ std::unique_ptr<int> p1( new int(1) );
+ std::unique_ptr<int> p2( new int(2) );
+ std::unique_ptr<int> p3( new int(3) );
+ std::unique_ptr<int> p4( new int(4) );
+ std::unique_ptr<int> p5( new int(5) );
+ std::unique_ptr<int> p6( new int(6) );
+ std::unique_ptr<int> p7( new int(7) );
+ std::unique_ptr<int> p8( new int(8) );
+
+ boost::bind( fv8, _1, _2, _3, _4, _5, _6, _7, _8 )( std::move( p1 ), std::move( p2 ), std::move( p3 ), std::move( p4 ), std::move( p5 ), std::move( p6 ), std::move( p7 ), std::move( p8 ) );
+ }
+
+ {
+ std::unique_ptr<int> p1( new int(1) );
+ std::unique_ptr<int> p2( new int(2) );
+ std::unique_ptr<int> p3( new int(3) );
+ std::unique_ptr<int> p4( new int(4) );
+ std::unique_ptr<int> p5( new int(5) );
+ std::unique_ptr<int> p6( new int(6) );
+ std::unique_ptr<int> p7( new int(7) );
+ std::unique_ptr<int> p8( new int(8) );
+ std::unique_ptr<int> p9( new int(9) );
+
+ boost::bind( fv9, _1, _2, _3, _4, _5, _6, _7, _8, _9 )( std::move( p1 ), std::move( p2 ), std::move( p3 ), std::move( p4 ), std::move( p5 ), std::move( p6 ), std::move( p7 ), std::move( p8 ), std::move( p9 ) );
+ }
+}
+
+int main()
+{
+ test();
+ return boost::report_errors();
+}
+
+#endif // #if defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) || defined( BOOST_NO_CXX11_SMART_PTR )
diff --git a/test/bind_visit_test.cpp b/test/bind_visit_test.cpp
new file mode 100644
index 0000000..16299dd
--- /dev/null
+++ b/test/bind_visit_test.cpp
@@ -0,0 +1,68 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+# pragma warning(disable: 4786) // identifier truncated in debug info
+# pragma warning(disable: 4710) // function not inlined
+# pragma warning(disable: 4711) // function selected for automatic inline expansion
+# pragma warning(disable: 4514) // unreferenced inline removed
+# pragma warning(disable: 4100) // unreferenced formal parameter (it is referenced!)
+#endif
+
+// Copyright (c) 2006 Douglas Gregor <doug.gregor@gmail.com>
+// Copyright (c) 2006 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)
+
+#include <boost/bind.hpp>
+#include <boost/visit_each.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+# pragma warning(push, 3)
+#endif
+
+#include <iostream>
+#include <typeinfo>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+# pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct visitor
+{
+ int hash;
+
+ visitor(): hash( 0 )
+ {
+ }
+
+ template<typename T> void operator()( T const & t )
+ {
+ std::cout << "visitor::operator()( T ): " << typeid( t ).name() << std::endl;
+ }
+
+ void operator()( int const & t )
+ {
+ std::cout << "visitor::operator()( int ): " << t << std::endl;
+ hash = hash * 10 + t;
+ }
+};
+
+int f( int x, int y, int z )
+{
+ return x + y + z;
+}
+
+int main()
+{
+ visitor vis;
+
+ boost::visit_each( vis, boost::bind( f, 3, _1, 4 ) );
+
+ BOOST_TEST( vis.hash == 34 );
+
+ return boost::report_errors();
+}
diff --git a/test/bind_void_dm_test.cpp b/test/bind_void_dm_test.cpp
new file mode 100644
index 0000000..ffa60f9
--- /dev/null
+++ b/test/bind_void_dm_test.cpp
@@ -0,0 +1,72 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_void_mf_test.cpp - test for bind<void> with member functions
+//
+// Copyright (c) 2008 Peter Dimov
+// Copyright (c) 2014 Agustin Berge
+//
+// 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/bind.hpp>
+#include <boost/ref.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+struct Z
+{
+ int m;
+};
+
+void member_data_test()
+{
+ Z z = { 17041 };
+ Z * pz = &z;
+
+ boost::bind<void>( &Z::m, _1 )( z );
+ boost::bind<void>( &Z::m, _1 )( pz );
+
+ boost::bind<void>( &Z::m, z )();
+ boost::bind<void>( &Z::m, pz )();
+ boost::bind<void>( &Z::m, boost::ref(z) )();
+
+
+ Z const cz = z;
+ Z const * pcz = &cz;
+
+ boost::bind<void>( &Z::m, _1 )( cz );
+ boost::bind<void>( &Z::m, _1 )( pcz );
+
+ boost::bind<void>( &Z::m, cz )();
+ boost::bind<void>( &Z::m, pcz )();
+ boost::bind<void>( &Z::m, boost::ref(cz) )();
+}
+
+int main()
+{
+ member_data_test();
+
+ return boost::report_errors();
+}
diff --git a/test/bind_void_mf_test.cpp b/test/bind_void_mf_test.cpp
new file mode 100644
index 0000000..e66a9c8
--- /dev/null
+++ b/test/bind_void_mf_test.cpp
@@ -0,0 +1,198 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_void_mf_test.cpp - test for bind<void> with member functions
+//
+// Copyright (c) 2008 Peter Dimov
+// Copyright (c) 2014 Agustin Berge
+//
+// 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/bind.hpp>
+#include <boost/ref.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+long global_result;
+
+//
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ int f0() { f1(17); return 0; }
+ int g0() const { g1(17); return 0; }
+ void h0() { h1(17); }
+
+ int f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+ void h1(int a1) { hash = (hash * 17041 + a1 * 2) % 32768; }
+
+ int f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
+ int g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
+ void h2(int a1, int a2) { h1(a1); h1(a2); }
+
+ int f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
+ int g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
+ void h3(int a1, int a2, int a3) { h2(a1, a2); h1(a3); }
+
+ int f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
+ int g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
+ void h4(int a1, int a2, int a3, int a4) { h3(a1, a2, a3); h1(a4); }
+
+ int f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
+ void h5(int a1, int a2, int a3, int a4, int a5) { h4(a1, a2, a3, a4); h1(a5); }
+
+ int f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+ void h6(int a1, int a2, int a3, int a4, int a5, int a6) { h5(a1, a2, a3, a4, a5); h1(a6); }
+
+ int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+ void h7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { h6(a1, a2, a3, a4, a5, a6); h1(a7); }
+
+ int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+ void h8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { h7(a1, a2, a3, a4, a5, a6, a7); h1(a8); }
+};
+
+void member_function_test()
+{
+ using namespace boost;
+
+ X x;
+
+ // 0
+
+ bind<void>(&X::f0, &x)();
+ bind<void>(&X::f0, ref(x))();
+
+ bind<void>(&X::g0, &x)();
+ bind<void>(&X::g0, x)();
+ bind<void>(&X::g0, ref(x))();
+
+ bind<void>(&X::h0, x)();
+
+ // 1
+
+ bind<void>(&X::f1, &x, 1)();
+ bind<void>(&X::f1, ref(x), 1)();
+
+ bind<void>(&X::g1, &x, 1)();
+ bind<void>(&X::g1, x, 1)();
+ bind<void>(&X::g1, ref(x), 1)();
+
+ bind<void>(&X::h1, x, 1)();
+
+ // 2
+
+ bind<void>(&X::f2, &x, 1, 2)();
+ bind<void>(&X::f2, ref(x), 1, 2)();
+
+ bind<void>(&X::g2, &x, 1, 2)();
+ bind<void>(&X::g2, x, 1, 2)();
+ bind<void>(&X::g2, ref(x), 1, 2)();
+
+ bind<void>(&X::h2, x, 1, 2)();
+
+ // 3
+
+ bind<void>(&X::f3, &x, 1, 2, 3)();
+ bind<void>(&X::f3, ref(x), 1, 2, 3)();
+
+ bind<void>(&X::g3, &x, 1, 2, 3)();
+ bind<void>(&X::g3, x, 1, 2, 3)();
+ bind<void>(&X::g3, ref(x), 1, 2, 3)();
+
+ bind<void>(&X::h3, x, 1, 2, 3)();
+
+ // 4
+
+ bind<void>(&X::f4, &x, 1, 2, 3, 4)();
+ bind<void>(&X::f4, ref(x), 1, 2, 3, 4)();
+
+ bind<void>(&X::g4, &x, 1, 2, 3, 4)();
+ bind<void>(&X::g4, x, 1, 2, 3, 4)();
+ bind<void>(&X::g4, ref(x), 1, 2, 3, 4)();
+
+ bind<void>(&X::h4, x, 1, 2, 3, 4)();
+
+ // 5
+
+ bind<void>(&X::f5, &x, 1, 2, 3, 4, 5)();
+ bind<void>(&X::f5, ref(x), 1, 2, 3, 4, 5)();
+
+ bind<void>(&X::g5, &x, 1, 2, 3, 4, 5)();
+ bind<void>(&X::g5, x, 1, 2, 3, 4, 5)();
+ bind<void>(&X::g5, ref(x), 1, 2, 3, 4, 5)();
+
+ bind<void>(&X::h5, x, 1, 2, 3, 4, 5)();
+
+ // 6
+
+ bind<void>(&X::f6, &x, 1, 2, 3, 4, 5, 6)();
+ bind<void>(&X::f6, ref(x), 1, 2, 3, 4, 5, 6)();
+
+ bind<void>(&X::g6, &x, 1, 2, 3, 4, 5, 6)();
+ bind<void>(&X::g6, x, 1, 2, 3, 4, 5, 6)();
+ bind<void>(&X::g6, ref(x), 1, 2, 3, 4, 5, 6)();
+
+ bind<void>(&X::h6, x, 1, 2, 3, 4, 5, 6)();
+
+ // 7
+
+ bind<void>(&X::f7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind<void>(&X::f7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ bind<void>(&X::g7, &x, 1, 2, 3, 4, 5, 6, 7)();
+ bind<void>(&X::g7, x, 1, 2, 3, 4, 5, 6, 7)();
+ bind<void>(&X::g7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
+
+ bind<void>(&X::h7, x, 1, 2, 3, 4, 5, 6, 7)();
+
+ // 8
+
+ bind<void>(&X::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind<void>(&X::f8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ bind<void>(&X::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind<void>(&X::g8, x, 1, 2, 3, 4, 5, 6, 7, 8)();
+ bind<void>(&X::g8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ bind<void>(&X::h8, x, 1, 2, 3, 4, 5, 6, 7, 8)();
+
+ BOOST_TEST( x.hash == 23558 );
+}
+
+int main()
+{
+ member_function_test();
+
+ return boost::report_errors();
+}
diff --git a/test/bind_void_test.cpp b/test/bind_void_test.cpp
new file mode 100644
index 0000000..bb1e80d
--- /dev/null
+++ b/test/bind_void_test.cpp
@@ -0,0 +1,139 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// bind_void_test.cpp - test for bind<void>
+//
+// Copyright (c) 2008 Peter Dimov
+// Copyright (c) 2014 Agustin Berge
+//
+// 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/bind.hpp>
+#include <boost/ref.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+//
+
+long global_result;
+
+long f_0()
+{
+ return global_result = 17041L;
+}
+
+long f_1(long a)
+{
+ return global_result = a;
+}
+
+long f_2(long a, long b)
+{
+ return global_result = a + 10 * b;
+}
+
+long f_3(long a, long b, long c)
+{
+ return global_result = a + 10 * b + 100 * c;
+}
+
+long f_4(long a, long b, long c, long d)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d;
+}
+
+long f_5(long a, long b, long c, long d, long e)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e;
+}
+
+long f_6(long a, long b, long c, long d, long e, long f)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
+}
+
+long f_7(long a, long b, long c, long d, long e, long f, long g)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
+}
+
+long f_8(long a, long b, long c, long d, long e, long f, long g, long h)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
+}
+
+long f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
+{
+ return global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
+}
+
+void function_test()
+{
+ using namespace boost;
+
+ int const i = 1;
+
+ BOOST_TEST( (bind<void>(f_0)(i), (global_result == 17041L)) );
+ BOOST_TEST( (bind<void>(f_1, _1)(i), (global_result == 1L)) );
+ BOOST_TEST( (bind<void>(f_2, _1, 2)(i), (global_result == 21L)) );
+ BOOST_TEST( (bind<void>(f_3, _1, 2, 3)(i), (global_result == 321L)) );
+ BOOST_TEST( (bind<void>(f_4, _1, 2, 3, 4)(i), (global_result == 4321L)) );
+ BOOST_TEST( (bind<void>(f_5, _1, 2, 3, 4, 5)(i), (global_result == 54321L)) );
+ BOOST_TEST( (bind<void>(f_6, _1, 2, 3, 4, 5, 6)(i), (global_result == 654321L)) );
+ BOOST_TEST( (bind<void>(f_7, _1, 2, 3, 4, 5, 6, 7)(i), (global_result == 7654321L)) );
+ BOOST_TEST( (bind<void>(f_8, _1, 2, 3, 4, 5, 6, 7, 8)(i), (global_result == 87654321L)) );
+ BOOST_TEST( (bind<void>(f_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i), (global_result == 987654321L)) );
+}
+
+//
+
+struct Y
+{
+ short operator()(short & r) const { return global_result = ++r; }
+ int operator()(int a, int b) const { return global_result = a + 10 * b; }
+ long operator() (long a, long b, long c) const { return global_result = a + 10 * b + 100 * c; }
+ void operator() (long a, long b, long c, long d) const { global_result = a + 10 * b + 100 * c + 1000 * d; }
+};
+
+void function_object_test()
+{
+ using namespace boost;
+
+ short i(6);
+
+ int const k = 3;
+
+ BOOST_TEST( (bind<void>(Y(), ref(i))(), (global_result == 7)) );
+ BOOST_TEST( (bind<void>(Y(), ref(i))(), (global_result == 8)) );
+ BOOST_TEST( (bind<void>(Y(), i, _1)(k), (global_result == 38)) );
+ BOOST_TEST( (bind<void>(Y(), i, _1, 9)(k), (global_result == 938)) );
+ BOOST_TEST( (bind<void>(Y(), i, _1, 9, 4)(k), (global_result == 4938)) );
+}
+
+int main()
+{
+ function_test();
+ function_object_test();
+
+ return boost::report_errors();
+}
diff --git a/test/mem_fn_cdecl_test.cpp b/test/mem_fn_cdecl_test.cpp
new file mode 100644
index 0000000..ed5a47c
--- /dev/null
+++ b/test/mem_fn_cdecl_test.cpp
@@ -0,0 +1,196 @@
+#include <boost/config.hpp>
+
+#ifndef BOOST_MSVC
+
+int main()
+{
+}
+
+#else
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// mem_fn_cdecl_test.cpp - a test for mem_fn.hpp + __cdecl
+//
+// Copyright (c) 2005 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)
+//
+
+#define BOOST_MEM_FN_ENABLE_CDECL
+
+#include <boost/mem_fn.hpp>
+#include <boost/shared_ptr.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ int __cdecl f0() { f1(17); return 0; }
+ int __cdecl g0() const { g1(17); return 0; }
+
+ int __cdecl f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int __cdecl g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+
+ int __cdecl f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
+ int __cdecl g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
+
+ int __cdecl f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
+ int __cdecl g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
+
+ int __cdecl f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
+ int __cdecl g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
+
+ int __cdecl f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int __cdecl g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
+
+ int __cdecl f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int __cdecl g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+
+ int __cdecl f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int __cdecl g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+
+ int __cdecl f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int __cdecl g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+};
+
+int detect_errors(bool x)
+{
+ if(x)
+ {
+ std::cerr << "no errors detected.\n";
+ return 0;
+ }
+ else
+ {
+ std::cerr << "test failed.\n";
+ return 1;
+ }
+}
+
+int main()
+{
+ using boost::mem_fn;
+
+ X x;
+
+ X const & rcx = x;
+ X const * pcx = &x;
+
+ boost::shared_ptr<X> sp(new X);
+
+ mem_fn(&X::f0)(x);
+ mem_fn(&X::f0)(&x);
+ mem_fn(&X::f0)(sp);
+
+ mem_fn(&X::g0)(x);
+ mem_fn(&X::g0)(rcx);
+ mem_fn(&X::g0)(&x);
+ mem_fn(&X::g0)(pcx);
+ mem_fn(&X::g0)(sp);
+
+ mem_fn(&X::f1)(x, 1);
+ mem_fn(&X::f1)(&x, 1);
+ mem_fn(&X::f1)(sp, 1);
+
+ mem_fn(&X::g1)(x, 1);
+ mem_fn(&X::g1)(rcx, 1);
+ mem_fn(&X::g1)(&x, 1);
+ mem_fn(&X::g1)(pcx, 1);
+ mem_fn(&X::g1)(sp, 1);
+
+ mem_fn(&X::f2)(x, 1, 2);
+ mem_fn(&X::f2)(&x, 1, 2);
+ mem_fn(&X::f2)(sp, 1, 2);
+
+ mem_fn(&X::g2)(x, 1, 2);
+ mem_fn(&X::g2)(rcx, 1, 2);
+ mem_fn(&X::g2)(&x, 1, 2);
+ mem_fn(&X::g2)(pcx, 1, 2);
+ mem_fn(&X::g2)(sp, 1, 2);
+
+ mem_fn(&X::f3)(x, 1, 2, 3);
+ mem_fn(&X::f3)(&x, 1, 2, 3);
+ mem_fn(&X::f3)(sp, 1, 2, 3);
+
+ mem_fn(&X::g3)(x, 1, 2, 3);
+ mem_fn(&X::g3)(rcx, 1, 2, 3);
+ mem_fn(&X::g3)(&x, 1, 2, 3);
+ mem_fn(&X::g3)(pcx, 1, 2, 3);
+ mem_fn(&X::g3)(sp, 1, 2, 3);
+
+ mem_fn(&X::f4)(x, 1, 2, 3, 4);
+ mem_fn(&X::f4)(&x, 1, 2, 3, 4);
+ mem_fn(&X::f4)(sp, 1, 2, 3, 4);
+
+ mem_fn(&X::g4)(x, 1, 2, 3, 4);
+ mem_fn(&X::g4)(rcx, 1, 2, 3, 4);
+ mem_fn(&X::g4)(&x, 1, 2, 3, 4);
+ mem_fn(&X::g4)(pcx, 1, 2, 3, 4);
+ mem_fn(&X::g4)(sp, 1, 2, 3, 4);
+
+ mem_fn(&X::f5)(x, 1, 2, 3, 4, 5);
+ mem_fn(&X::f5)(&x, 1, 2, 3, 4, 5);
+ mem_fn(&X::f5)(sp, 1, 2, 3, 4, 5);
+
+ mem_fn(&X::g5)(x, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(rcx, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(&x, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(pcx, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(sp, 1, 2, 3, 4, 5);
+
+ mem_fn(&X::f6)(x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::f6)(&x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::f6)(sp, 1, 2, 3, 4, 5, 6);
+
+ mem_fn(&X::g6)(x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(rcx, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(&x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(pcx, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(sp, 1, 2, 3, 4, 5, 6);
+
+ mem_fn(&X::f7)(x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::f7)(&x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::f7)(sp, 1, 2, 3, 4, 5, 6, 7);
+
+ mem_fn(&X::g7)(x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(rcx, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(&x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(pcx, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(sp, 1, 2, 3, 4, 5, 6, 7);
+
+ mem_fn(&X::f8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::f8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::f8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
+
+ mem_fn(&X::g8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(rcx, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(pcx, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
+
+ return detect_errors(x.hash == 17610 && sp->hash == 2155);
+}
+
+#endif
diff --git a/test/mem_fn_derived_test.cpp b/test/mem_fn_derived_test.cpp
new file mode 100644
index 0000000..f8aa0e9
--- /dev/null
+++ b/test/mem_fn_derived_test.cpp
@@ -0,0 +1,188 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// mem_fn_derived_test.cpp - tests mem_fn.hpp with derived objects
+//
+// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+//
+// 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/mem_fn.hpp>
+#include <boost/shared_ptr.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+
+struct B
+{
+ mutable unsigned int hash;
+
+ B(): hash(0) {}
+
+ int f0() { f1(17); return 0; }
+ int g0() const { g1(17); return 0; }
+
+ int f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+
+ int f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
+ int g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
+
+ int f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
+ int g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
+
+ int f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
+ int g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
+
+ int f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
+
+ int f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+
+ int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+
+ int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+};
+
+struct X: public B
+{
+};
+
+int detect_errors(bool x)
+{
+ if(x)
+ {
+ std::cerr << "no errors detected.\n";
+ return 0;
+ }
+ else
+ {
+ std::cerr << "test failed.\n";
+ return 1;
+ }
+}
+
+int main()
+{
+ using boost::mem_fn;
+
+ X x;
+
+ X const & rcx = x;
+ X const * pcx = &x;
+
+ boost::shared_ptr<X> sp(new X);
+
+ mem_fn(&X::f0)(x);
+ mem_fn(&X::f0)(&x);
+ mem_fn(&X::f0)(sp);
+
+ mem_fn(&X::g0)(x);
+ mem_fn(&X::g0)(rcx);
+ mem_fn(&X::g0)(&x);
+ mem_fn(&X::g0)(pcx);
+ mem_fn(&X::g0)(sp);
+
+ mem_fn(&X::f1)(x, 1);
+ mem_fn(&X::f1)(&x, 1);
+ mem_fn(&X::f1)(sp, 1);
+
+ mem_fn(&X::g1)(x, 1);
+ mem_fn(&X::g1)(rcx, 1);
+ mem_fn(&X::g1)(&x, 1);
+ mem_fn(&X::g1)(pcx, 1);
+ mem_fn(&X::g1)(sp, 1);
+
+ mem_fn(&X::f2)(x, 1, 2);
+ mem_fn(&X::f2)(&x, 1, 2);
+ mem_fn(&X::f2)(sp, 1, 2);
+
+ mem_fn(&X::g2)(x, 1, 2);
+ mem_fn(&X::g2)(rcx, 1, 2);
+ mem_fn(&X::g2)(&x, 1, 2);
+ mem_fn(&X::g2)(pcx, 1, 2);
+ mem_fn(&X::g2)(sp, 1, 2);
+
+ mem_fn(&X::f3)(x, 1, 2, 3);
+ mem_fn(&X::f3)(&x, 1, 2, 3);
+ mem_fn(&X::f3)(sp, 1, 2, 3);
+
+ mem_fn(&X::g3)(x, 1, 2, 3);
+ mem_fn(&X::g3)(rcx, 1, 2, 3);
+ mem_fn(&X::g3)(&x, 1, 2, 3);
+ mem_fn(&X::g3)(pcx, 1, 2, 3);
+ mem_fn(&X::g3)(sp, 1, 2, 3);
+
+ mem_fn(&X::f4)(x, 1, 2, 3, 4);
+ mem_fn(&X::f4)(&x, 1, 2, 3, 4);
+ mem_fn(&X::f4)(sp, 1, 2, 3, 4);
+
+ mem_fn(&X::g4)(x, 1, 2, 3, 4);
+ mem_fn(&X::g4)(rcx, 1, 2, 3, 4);
+ mem_fn(&X::g4)(&x, 1, 2, 3, 4);
+ mem_fn(&X::g4)(pcx, 1, 2, 3, 4);
+ mem_fn(&X::g4)(sp, 1, 2, 3, 4);
+
+ mem_fn(&X::f5)(x, 1, 2, 3, 4, 5);
+ mem_fn(&X::f5)(&x, 1, 2, 3, 4, 5);
+ mem_fn(&X::f5)(sp, 1, 2, 3, 4, 5);
+
+ mem_fn(&X::g5)(x, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(rcx, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(&x, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(pcx, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(sp, 1, 2, 3, 4, 5);
+
+ mem_fn(&X::f6)(x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::f6)(&x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::f6)(sp, 1, 2, 3, 4, 5, 6);
+
+ mem_fn(&X::g6)(x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(rcx, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(&x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(pcx, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(sp, 1, 2, 3, 4, 5, 6);
+
+ mem_fn(&X::f7)(x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::f7)(&x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::f7)(sp, 1, 2, 3, 4, 5, 6, 7);
+
+ mem_fn(&X::g7)(x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(rcx, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(&x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(pcx, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(sp, 1, 2, 3, 4, 5, 6, 7);
+
+ mem_fn(&X::f8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::f8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::f8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
+
+ mem_fn(&X::g8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(rcx, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(pcx, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
+
+ return detect_errors(mem_fn(&X::hash)(x) == 17610 && mem_fn(&X::hash)(sp) == 2155);
+}
diff --git a/test/mem_fn_dm_test.cpp b/test/mem_fn_dm_test.cpp
new file mode 100644
index 0000000..88fe428
--- /dev/null
+++ b/test/mem_fn_dm_test.cpp
@@ -0,0 +1,67 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// mem_fn_dm_test.cpp - data members
+//
+// Copyright (c) 2005 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)
+//
+
+#include <boost/mem_fn.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ int m;
+};
+
+int main()
+{
+ X x = { 0 };
+
+ boost::mem_fn( &X::m )( x ) = 401;
+
+ BOOST_TEST( x.m == 401 );
+ BOOST_TEST( boost::mem_fn( &X::m )( x ) == 401 );
+
+ boost::mem_fn( &X::m )( &x ) = 502;
+
+ BOOST_TEST( x.m == 502 );
+ BOOST_TEST( boost::mem_fn( &X::m )( &x ) == 502 );
+
+ X * px = &x;
+
+ boost::mem_fn( &X::m )( px ) = 603;
+
+ BOOST_TEST( x.m == 603 );
+ BOOST_TEST( boost::mem_fn( &X::m )( px ) == 603 );
+
+ X const & cx = x;
+ X const * pcx = &x;
+
+ BOOST_TEST( boost::mem_fn( &X::m )( cx ) == 603 );
+ BOOST_TEST( boost::mem_fn( &X::m )( pcx ) == 603 );
+
+ return boost::report_errors();
+}
diff --git a/test/mem_fn_eq_test.cpp b/test/mem_fn_eq_test.cpp
new file mode 100644
index 0000000..544d6ff
--- /dev/null
+++ b/test/mem_fn_eq_test.cpp
@@ -0,0 +1,300 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// mem_fn_eq_test.cpp - boost::mem_fn equality operator
+//
+// Copyright (c) 2004 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)
+//
+
+#include <boost/mem_fn.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ int dm_1;
+ int dm_2;
+
+ // 0
+
+ int mf0_1() { return 0; }
+ int mf0_2() { return 1; }
+
+ int cmf0_1() const { return 0; }
+ int cmf0_2() const { return 1; }
+
+ void mf0v_1() {}
+ void mf0v_2() { static int x; ++x; }
+
+ void cmf0v_1() const {}
+ void cmf0v_2() const { static int x; ++x; }
+
+ // 1
+
+ int mf1_1(int) { return 0; }
+ int mf1_2(int) { return 1; }
+
+ int cmf1_1(int) const { return 0; }
+ int cmf1_2(int) const { return 1; }
+
+ void mf1v_1(int) {}
+ void mf1v_2(int) { static int x; ++x; }
+
+ void cmf1v_1(int) const {}
+ void cmf1v_2(int) const { static int x; ++x; }
+
+ // 2
+
+ int mf2_1(int, int) { return 0; }
+ int mf2_2(int, int) { return 1; }
+
+ int cmf2_1(int, int) const { return 0; }
+ int cmf2_2(int, int) const { return 1; }
+
+ void mf2v_1(int, int) {}
+ void mf2v_2(int, int) { static int x; ++x; }
+
+ void cmf2v_1(int, int) const {}
+ void cmf2v_2(int, int) const { static int x; ++x; }
+
+ // 3
+
+ int mf3_1(int, int, int) { return 0; }
+ int mf3_2(int, int, int) { return 1; }
+
+ int cmf3_1(int, int, int) const { return 0; }
+ int cmf3_2(int, int, int) const { return 1; }
+
+ void mf3v_1(int, int, int) {}
+ void mf3v_2(int, int, int) { static int x; ++x; }
+
+ void cmf3v_1(int, int, int) const {}
+ void cmf3v_2(int, int, int) const { static int x; ++x; }
+
+ // 4
+
+ int mf4_1(int, int, int, int) { return 0; }
+ int mf4_2(int, int, int, int) { return 1; }
+
+ int cmf4_1(int, int, int, int) const { return 0; }
+ int cmf4_2(int, int, int, int) const { return 1; }
+
+ void mf4v_1(int, int, int, int) {}
+ void mf4v_2(int, int, int, int) { static int x; ++x; }
+
+ void cmf4v_1(int, int, int, int) const {}
+ void cmf4v_2(int, int, int, int) const { static int x; ++x; }
+
+ // 5
+
+ int mf5_1(int, int, int, int, int) { return 0; }
+ int mf5_2(int, int, int, int, int) { return 1; }
+
+ int cmf5_1(int, int, int, int, int) const { return 0; }
+ int cmf5_2(int, int, int, int, int) const { return 1; }
+
+ void mf5v_1(int, int, int, int, int) {}
+ void mf5v_2(int, int, int, int, int) { static int x; ++x; }
+
+ void cmf5v_1(int, int, int, int, int) const {}
+ void cmf5v_2(int, int, int, int, int) const { static int x; ++x; }
+
+ // 6
+
+ int mf6_1(int, int, int, int, int, int) { return 0; }
+ int mf6_2(int, int, int, int, int, int) { return 1; }
+
+ int cmf6_1(int, int, int, int, int, int) const { return 0; }
+ int cmf6_2(int, int, int, int, int, int) const { return 1; }
+
+ void mf6v_1(int, int, int, int, int, int) {}
+ void mf6v_2(int, int, int, int, int, int) { static int x; ++x; }
+
+ void cmf6v_1(int, int, int, int, int, int) const {}
+ void cmf6v_2(int, int, int, int, int, int) const { static int x; ++x; }
+
+ // 7
+
+ int mf7_1(int, int, int, int, int, int, int) { return 0; }
+ int mf7_2(int, int, int, int, int, int, int) { return 1; }
+
+ int cmf7_1(int, int, int, int, int, int, int) const { return 0; }
+ int cmf7_2(int, int, int, int, int, int, int) const { return 1; }
+
+ void mf7v_1(int, int, int, int, int, int, int) {}
+ void mf7v_2(int, int, int, int, int, int, int) { static int x; ++x; }
+
+ void cmf7v_1(int, int, int, int, int, int, int) const {}
+ void cmf7v_2(int, int, int, int, int, int, int) const { static int x; ++x; }
+
+ // 8
+
+ int mf8_1(int, int, int, int, int, int, int, int) { return 0; }
+ int mf8_2(int, int, int, int, int, int, int, int) { return 1; }
+
+ int cmf8_1(int, int, int, int, int, int, int, int) const { return 0; }
+ int cmf8_2(int, int, int, int, int, int, int, int) const { return 1; }
+
+ void mf8v_1(int, int, int, int, int, int, int, int) {}
+ void mf8v_2(int, int, int, int, int, int, int, int) { static int x; ++x; }
+
+ void cmf8v_1(int, int, int, int, int, int, int, int) const {}
+ void cmf8v_2(int, int, int, int, int, int, int, int) const { static int x; ++x; }
+
+};
+
+int main()
+{
+ BOOST_TEST( boost::mem_fn(&X::dm_1) == boost::mem_fn(&X::dm_1) );
+ BOOST_TEST( boost::mem_fn(&X::dm_1) != boost::mem_fn(&X::dm_2) );
+
+ // 0
+
+ BOOST_TEST( boost::mem_fn(&X::mf0_1) == boost::mem_fn(&X::mf0_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf0_1) != boost::mem_fn(&X::mf0_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf0_1) == boost::mem_fn(&X::cmf0_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf0_1) != boost::mem_fn(&X::cmf0_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::mf0v_1) == boost::mem_fn(&X::mf0v_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf0v_1) != boost::mem_fn(&X::mf0v_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf0v_1) == boost::mem_fn(&X::cmf0v_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf0v_1) != boost::mem_fn(&X::cmf0v_2) );
+
+ // 1
+
+ BOOST_TEST( boost::mem_fn(&X::mf1_1) == boost::mem_fn(&X::mf1_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf1_1) != boost::mem_fn(&X::mf1_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf1_1) == boost::mem_fn(&X::cmf1_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf1_1) != boost::mem_fn(&X::cmf1_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::mf1v_1) == boost::mem_fn(&X::mf1v_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf1v_1) != boost::mem_fn(&X::mf1v_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf1v_1) == boost::mem_fn(&X::cmf1v_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf1v_1) != boost::mem_fn(&X::cmf1v_2) );
+
+ // 2
+
+ BOOST_TEST( boost::mem_fn(&X::mf2_1) == boost::mem_fn(&X::mf2_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf2_1) != boost::mem_fn(&X::mf2_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf2_1) == boost::mem_fn(&X::cmf2_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf2_1) != boost::mem_fn(&X::cmf2_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::mf2v_1) == boost::mem_fn(&X::mf2v_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf2v_1) != boost::mem_fn(&X::mf2v_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf2v_1) == boost::mem_fn(&X::cmf2v_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf2v_1) != boost::mem_fn(&X::cmf2v_2) );
+
+ // 3
+
+ BOOST_TEST( boost::mem_fn(&X::mf3_1) == boost::mem_fn(&X::mf3_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf3_1) != boost::mem_fn(&X::mf3_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf3_1) == boost::mem_fn(&X::cmf3_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf3_1) != boost::mem_fn(&X::cmf3_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::mf3v_1) == boost::mem_fn(&X::mf3v_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf3v_1) != boost::mem_fn(&X::mf3v_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf3v_1) == boost::mem_fn(&X::cmf3v_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf3v_1) != boost::mem_fn(&X::cmf3v_2) );
+
+ // 4
+
+ BOOST_TEST( boost::mem_fn(&X::mf4_1) == boost::mem_fn(&X::mf4_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf4_1) != boost::mem_fn(&X::mf4_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf4_1) == boost::mem_fn(&X::cmf4_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf4_1) != boost::mem_fn(&X::cmf4_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::mf4v_1) == boost::mem_fn(&X::mf4v_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf4v_1) != boost::mem_fn(&X::mf4v_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf4v_1) == boost::mem_fn(&X::cmf4v_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf4v_1) != boost::mem_fn(&X::cmf4v_2) );
+
+ // 5
+
+ BOOST_TEST( boost::mem_fn(&X::mf5_1) == boost::mem_fn(&X::mf5_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf5_1) != boost::mem_fn(&X::mf5_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf5_1) == boost::mem_fn(&X::cmf5_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf5_1) != boost::mem_fn(&X::cmf5_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::mf5v_1) == boost::mem_fn(&X::mf5v_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf5v_1) != boost::mem_fn(&X::mf5v_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf5v_1) == boost::mem_fn(&X::cmf5v_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf5v_1) != boost::mem_fn(&X::cmf5v_2) );
+
+ // 6
+
+ BOOST_TEST( boost::mem_fn(&X::mf6_1) == boost::mem_fn(&X::mf6_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf6_1) != boost::mem_fn(&X::mf6_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf6_1) == boost::mem_fn(&X::cmf6_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf6_1) != boost::mem_fn(&X::cmf6_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::mf6v_1) == boost::mem_fn(&X::mf6v_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf6v_1) != boost::mem_fn(&X::mf6v_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf6v_1) == boost::mem_fn(&X::cmf6v_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf6v_1) != boost::mem_fn(&X::cmf6v_2) );
+
+ // 7
+
+ BOOST_TEST( boost::mem_fn(&X::mf7_1) == boost::mem_fn(&X::mf7_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf7_1) != boost::mem_fn(&X::mf7_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf7_1) == boost::mem_fn(&X::cmf7_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf7_1) != boost::mem_fn(&X::cmf7_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::mf7v_1) == boost::mem_fn(&X::mf7v_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf7v_1) != boost::mem_fn(&X::mf7v_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf7v_1) == boost::mem_fn(&X::cmf7v_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf7v_1) != boost::mem_fn(&X::cmf7v_2) );
+
+ // 8
+
+ BOOST_TEST( boost::mem_fn(&X::mf8_1) == boost::mem_fn(&X::mf8_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf8_1) != boost::mem_fn(&X::mf8_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf8_1) == boost::mem_fn(&X::cmf8_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf8_1) != boost::mem_fn(&X::cmf8_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::mf8v_1) == boost::mem_fn(&X::mf8v_1) );
+ BOOST_TEST( boost::mem_fn(&X::mf8v_1) != boost::mem_fn(&X::mf8v_2) );
+
+ BOOST_TEST( boost::mem_fn(&X::cmf8v_1) == boost::mem_fn(&X::cmf8v_1) );
+ BOOST_TEST( boost::mem_fn(&X::cmf8v_1) != boost::mem_fn(&X::cmf8v_2) );
+
+
+ return boost::report_errors();
+}
diff --git a/test/mem_fn_fastcall_test.cpp b/test/mem_fn_fastcall_test.cpp
new file mode 100644
index 0000000..b7a6ab3
--- /dev/null
+++ b/test/mem_fn_fastcall_test.cpp
@@ -0,0 +1,196 @@
+#include <boost/config.hpp>
+
+#ifndef BOOST_MSVC
+
+int main()
+{
+}
+
+#else
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// mem_fn_fastcall_test.cpp - a test for mem_fn.hpp + __fastcall
+//
+// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
+//
+// 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)
+//
+
+#define BOOST_MEM_FN_ENABLE_FASTCALL
+
+#include <boost/mem_fn.hpp>
+#include <boost/shared_ptr.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ void __fastcall f0() { f1(17); }
+ void __fastcall g0() const { g1(17); }
+
+ void __fastcall f1(int a1) { hash = (hash * 17041 + a1) % 32768; }
+ void __fastcall g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; }
+
+ void __fastcall f2(int a1, int a2) { f1(a1); f1(a2); }
+ void __fastcall g2(int a1, int a2) const { g1(a1); g1(a2); }
+
+ void __fastcall f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); }
+ void __fastcall g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); }
+
+ void __fastcall f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); }
+ void __fastcall g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); }
+
+ void __fastcall f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); }
+ void __fastcall g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); }
+
+ void __fastcall f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); }
+ void __fastcall g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); }
+
+ void __fastcall f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); }
+ void __fastcall g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); }
+
+ void __fastcall f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); }
+ void __fastcall g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); }
+};
+
+int detect_errors(bool x)
+{
+ if(x)
+ {
+ std::cerr << "no errors detected.\n";
+ return 0;
+ }
+ else
+ {
+ std::cerr << "test failed.\n";
+ return 1;
+ }
+}
+
+int main()
+{
+ using boost::mem_fn;
+
+ X x;
+
+ X const & rcx = x;
+ X const * pcx = &x;
+
+ boost::shared_ptr<X> sp(new X);
+
+ mem_fn(&X::f0)(x);
+ mem_fn(&X::f0)(&x);
+ mem_fn(&X::f0)(sp);
+
+ mem_fn(&X::g0)(x);
+ mem_fn(&X::g0)(rcx);
+ mem_fn(&X::g0)(&x);
+ mem_fn(&X::g0)(pcx);
+ mem_fn(&X::g0)(sp);
+
+ mem_fn(&X::f1)(x, 1);
+ mem_fn(&X::f1)(&x, 1);
+ mem_fn(&X::f1)(sp, 1);
+
+ mem_fn(&X::g1)(x, 1);
+ mem_fn(&X::g1)(rcx, 1);
+ mem_fn(&X::g1)(&x, 1);
+ mem_fn(&X::g1)(pcx, 1);
+ mem_fn(&X::g1)(sp, 1);
+
+ mem_fn(&X::f2)(x, 1, 2);
+ mem_fn(&X::f2)(&x, 1, 2);
+ mem_fn(&X::f2)(sp, 1, 2);
+
+ mem_fn(&X::g2)(x, 1, 2);
+ mem_fn(&X::g2)(rcx, 1, 2);
+ mem_fn(&X::g2)(&x, 1, 2);
+ mem_fn(&X::g2)(pcx, 1, 2);
+ mem_fn(&X::g2)(sp, 1, 2);
+
+ mem_fn(&X::f3)(x, 1, 2, 3);
+ mem_fn(&X::f3)(&x, 1, 2, 3);
+ mem_fn(&X::f3)(sp, 1, 2, 3);
+
+ mem_fn(&X::g3)(x, 1, 2, 3);
+ mem_fn(&X::g3)(rcx, 1, 2, 3);
+ mem_fn(&X::g3)(&x, 1, 2, 3);
+ mem_fn(&X::g3)(pcx, 1, 2, 3);
+ mem_fn(&X::g3)(sp, 1, 2, 3);
+
+ mem_fn(&X::f4)(x, 1, 2, 3, 4);
+ mem_fn(&X::f4)(&x, 1, 2, 3, 4);
+ mem_fn(&X::f4)(sp, 1, 2, 3, 4);
+
+ mem_fn(&X::g4)(x, 1, 2, 3, 4);
+ mem_fn(&X::g4)(rcx, 1, 2, 3, 4);
+ mem_fn(&X::g4)(&x, 1, 2, 3, 4);
+ mem_fn(&X::g4)(pcx, 1, 2, 3, 4);
+ mem_fn(&X::g4)(sp, 1, 2, 3, 4);
+
+ mem_fn(&X::f5)(x, 1, 2, 3, 4, 5);
+ mem_fn(&X::f5)(&x, 1, 2, 3, 4, 5);
+ mem_fn(&X::f5)(sp, 1, 2, 3, 4, 5);
+
+ mem_fn(&X::g5)(x, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(rcx, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(&x, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(pcx, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(sp, 1, 2, 3, 4, 5);
+
+ mem_fn(&X::f6)(x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::f6)(&x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::f6)(sp, 1, 2, 3, 4, 5, 6);
+
+ mem_fn(&X::g6)(x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(rcx, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(&x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(pcx, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(sp, 1, 2, 3, 4, 5, 6);
+
+ mem_fn(&X::f7)(x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::f7)(&x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::f7)(sp, 1, 2, 3, 4, 5, 6, 7);
+
+ mem_fn(&X::g7)(x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(rcx, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(&x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(pcx, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(sp, 1, 2, 3, 4, 5, 6, 7);
+
+ mem_fn(&X::f8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::f8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::f8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
+
+ mem_fn(&X::g8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(rcx, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(pcx, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
+
+ return detect_errors(x.hash == 17610 && sp->hash == 2155);
+}
+
+#endif
diff --git a/test/mem_fn_ref_test.cpp b/test/mem_fn_ref_test.cpp
new file mode 100644
index 0000000..be98941
--- /dev/null
+++ b/test/mem_fn_ref_test.cpp
@@ -0,0 +1,36 @@
+//
+// mem_fn_ref_test.cpp - reference_wrapper
+//
+// Copyright (c) 2009 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
+//
+
+#include <boost/mem_fn.hpp>
+#include <boost/ref.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+struct X
+{
+ int f()
+ {
+ return 1;
+ }
+
+ int g() const
+ {
+ return 2;
+ }
+};
+
+int main()
+{
+ X x;
+
+ BOOST_TEST( boost::mem_fn( &X::f )( boost::ref( x ) ) == 1 );
+ BOOST_TEST( boost::mem_fn( &X::g )( boost::cref( x ) ) == 2 );
+
+ return boost::report_errors();
+}
diff --git a/test/mem_fn_rv_test.cpp b/test/mem_fn_rv_test.cpp
new file mode 100644
index 0000000..4147105
--- /dev/null
+++ b/test/mem_fn_rv_test.cpp
@@ -0,0 +1,117 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// mem_fn_test.cpp - mem_fn.hpp with rvalues
+//
+// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+// Copyright (c) 2005 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)
+//
+
+#include <boost/mem_fn.hpp>
+#include <boost/shared_ptr.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+unsigned int hash = 0;
+
+struct X
+{
+ int f0() { f1(17); return 0; }
+ int g0() const { g1(17); return 0; }
+
+ int f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+
+ int f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
+ int g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
+
+ int f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
+ int g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
+
+ int f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
+ int g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
+
+ int f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
+
+ int f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+
+ int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+
+ int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+};
+
+int detect_errors(bool x)
+{
+ if( x )
+ {
+ std::cerr << "no errors detected.\n";
+ return 0;
+ }
+ else
+ {
+ std::cerr << "test failed.\n";
+ return 1;
+ }
+}
+
+boost::shared_ptr<X> make()
+{
+ return boost::shared_ptr<X>( new X );
+}
+
+int main()
+{
+ using boost::mem_fn;
+
+ mem_fn(&X::f0)( make() );
+ mem_fn(&X::g0)( make() );
+
+ mem_fn(&X::f1)( make(), 1 );
+ mem_fn(&X::g1)( make(), 1 );
+
+ mem_fn(&X::f2)( make(), 1, 2 );
+ mem_fn(&X::g2)( make(), 1, 2 );
+
+ mem_fn(&X::f3)( make(), 1, 2, 3 );
+ mem_fn(&X::g3)( make(), 1, 2, 3 );
+
+ mem_fn(&X::f4)( make(), 1, 2, 3, 4 );
+ mem_fn(&X::g4)( make(), 1, 2, 3, 4 );
+
+ mem_fn(&X::f5)( make(), 1, 2, 3, 4, 5 );
+ mem_fn(&X::g5)( make(), 1, 2, 3, 4, 5 );
+
+ mem_fn(&X::f6)( make(), 1, 2, 3, 4, 5, 6 );
+ mem_fn(&X::g6)( make(), 1, 2, 3, 4, 5, 6 );
+
+ mem_fn(&X::f7)( make(), 1, 2, 3, 4, 5, 6, 7 );
+ mem_fn(&X::g7)( make(), 1, 2, 3, 4, 5, 6, 7 );
+
+ mem_fn(&X::f8)( make(), 1, 2, 3, 4, 5, 6, 7, 8 );
+ mem_fn(&X::g8)( make(), 1, 2, 3, 4, 5, 6, 7, 8 );
+
+ return detect_errors( hash == 2155 );
+}
diff --git a/test/mem_fn_stdcall_test.cpp b/test/mem_fn_stdcall_test.cpp
new file mode 100644
index 0000000..7f5645f
--- /dev/null
+++ b/test/mem_fn_stdcall_test.cpp
@@ -0,0 +1,196 @@
+#include <boost/config.hpp>
+
+#ifndef BOOST_MSVC
+
+int main()
+{
+}
+
+#else
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// mem_fn_stdcall_test.cpp - a test for mem_fn.hpp + __stdcall
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+//
+// 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)
+//
+
+#define BOOST_MEM_FN_ENABLE_STDCALL
+
+#include <boost/mem_fn.hpp>
+#include <boost/shared_ptr.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ int __stdcall f0() { f1(17); return 0; }
+ int __stdcall g0() const { g1(17); return 0; }
+
+ int __stdcall f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int __stdcall g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+
+ int __stdcall f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
+ int __stdcall g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
+
+ int __stdcall f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
+ int __stdcall g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
+
+ int __stdcall f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
+ int __stdcall g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
+
+ int __stdcall f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int __stdcall g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
+
+ int __stdcall f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int __stdcall g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+
+ int __stdcall f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int __stdcall g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+
+ int __stdcall f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int __stdcall g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+};
+
+int detect_errors(bool x)
+{
+ if(x)
+ {
+ std::cerr << "no errors detected.\n";
+ return 0;
+ }
+ else
+ {
+ std::cerr << "test failed.\n";
+ return 1;
+ }
+}
+
+int main()
+{
+ using boost::mem_fn;
+
+ X x;
+
+ X const & rcx = x;
+ X const * pcx = &x;
+
+ boost::shared_ptr<X> sp(new X);
+
+ mem_fn(&X::f0)(x);
+ mem_fn(&X::f0)(&x);
+ mem_fn(&X::f0)(sp);
+
+ mem_fn(&X::g0)(x);
+ mem_fn(&X::g0)(rcx);
+ mem_fn(&X::g0)(&x);
+ mem_fn(&X::g0)(pcx);
+ mem_fn(&X::g0)(sp);
+
+ mem_fn(&X::f1)(x, 1);
+ mem_fn(&X::f1)(&x, 1);
+ mem_fn(&X::f1)(sp, 1);
+
+ mem_fn(&X::g1)(x, 1);
+ mem_fn(&X::g1)(rcx, 1);
+ mem_fn(&X::g1)(&x, 1);
+ mem_fn(&X::g1)(pcx, 1);
+ mem_fn(&X::g1)(sp, 1);
+
+ mem_fn(&X::f2)(x, 1, 2);
+ mem_fn(&X::f2)(&x, 1, 2);
+ mem_fn(&X::f2)(sp, 1, 2);
+
+ mem_fn(&X::g2)(x, 1, 2);
+ mem_fn(&X::g2)(rcx, 1, 2);
+ mem_fn(&X::g2)(&x, 1, 2);
+ mem_fn(&X::g2)(pcx, 1, 2);
+ mem_fn(&X::g2)(sp, 1, 2);
+
+ mem_fn(&X::f3)(x, 1, 2, 3);
+ mem_fn(&X::f3)(&x, 1, 2, 3);
+ mem_fn(&X::f3)(sp, 1, 2, 3);
+
+ mem_fn(&X::g3)(x, 1, 2, 3);
+ mem_fn(&X::g3)(rcx, 1, 2, 3);
+ mem_fn(&X::g3)(&x, 1, 2, 3);
+ mem_fn(&X::g3)(pcx, 1, 2, 3);
+ mem_fn(&X::g3)(sp, 1, 2, 3);
+
+ mem_fn(&X::f4)(x, 1, 2, 3, 4);
+ mem_fn(&X::f4)(&x, 1, 2, 3, 4);
+ mem_fn(&X::f4)(sp, 1, 2, 3, 4);
+
+ mem_fn(&X::g4)(x, 1, 2, 3, 4);
+ mem_fn(&X::g4)(rcx, 1, 2, 3, 4);
+ mem_fn(&X::g4)(&x, 1, 2, 3, 4);
+ mem_fn(&X::g4)(pcx, 1, 2, 3, 4);
+ mem_fn(&X::g4)(sp, 1, 2, 3, 4);
+
+ mem_fn(&X::f5)(x, 1, 2, 3, 4, 5);
+ mem_fn(&X::f5)(&x, 1, 2, 3, 4, 5);
+ mem_fn(&X::f5)(sp, 1, 2, 3, 4, 5);
+
+ mem_fn(&X::g5)(x, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(rcx, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(&x, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(pcx, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(sp, 1, 2, 3, 4, 5);
+
+ mem_fn(&X::f6)(x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::f6)(&x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::f6)(sp, 1, 2, 3, 4, 5, 6);
+
+ mem_fn(&X::g6)(x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(rcx, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(&x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(pcx, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(sp, 1, 2, 3, 4, 5, 6);
+
+ mem_fn(&X::f7)(x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::f7)(&x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::f7)(sp, 1, 2, 3, 4, 5, 6, 7);
+
+ mem_fn(&X::g7)(x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(rcx, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(&x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(pcx, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(sp, 1, 2, 3, 4, 5, 6, 7);
+
+ mem_fn(&X::f8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::f8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::f8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
+
+ mem_fn(&X::g8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(rcx, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(pcx, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
+
+ return detect_errors(x.hash == 17610 && sp->hash == 2155);
+}
+
+#endif
diff --git a/test/mem_fn_test.cpp b/test/mem_fn_test.cpp
new file mode 100644
index 0000000..960a828
--- /dev/null
+++ b/test/mem_fn_test.cpp
@@ -0,0 +1,184 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// mem_fn_test.cpp - a test for mem_fn.hpp
+//
+// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
+//
+// 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/mem_fn.hpp>
+#include <boost/shared_ptr.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ int f0() { f1(17); return 0; }
+ int g0() const { g1(17); return 0; }
+
+ int f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+
+ int f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
+ int g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
+
+ int f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
+ int g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
+
+ int f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
+ int g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
+
+ int f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
+
+ int f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+
+ int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+
+ int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+};
+
+int detect_errors(bool x)
+{
+ if(x)
+ {
+ std::cerr << "no errors detected.\n";
+ return 0;
+ }
+ else
+ {
+ std::cerr << "test failed.\n";
+ return 1;
+ }
+}
+
+int main()
+{
+ using boost::mem_fn;
+
+ X x;
+
+ X const & rcx = x;
+ X const * pcx = &x;
+
+ boost::shared_ptr<X> sp(new X);
+
+ mem_fn(&X::f0)(x);
+ mem_fn(&X::f0)(&x);
+ mem_fn(&X::f0)(sp);
+
+ mem_fn(&X::g0)(x);
+ mem_fn(&X::g0)(rcx);
+ mem_fn(&X::g0)(&x);
+ mem_fn(&X::g0)(pcx);
+ mem_fn(&X::g0)(sp);
+
+ mem_fn(&X::f1)(x, 1);
+ mem_fn(&X::f1)(&x, 1);
+ mem_fn(&X::f1)(sp, 1);
+
+ mem_fn(&X::g1)(x, 1);
+ mem_fn(&X::g1)(rcx, 1);
+ mem_fn(&X::g1)(&x, 1);
+ mem_fn(&X::g1)(pcx, 1);
+ mem_fn(&X::g1)(sp, 1);
+
+ mem_fn(&X::f2)(x, 1, 2);
+ mem_fn(&X::f2)(&x, 1, 2);
+ mem_fn(&X::f2)(sp, 1, 2);
+
+ mem_fn(&X::g2)(x, 1, 2);
+ mem_fn(&X::g2)(rcx, 1, 2);
+ mem_fn(&X::g2)(&x, 1, 2);
+ mem_fn(&X::g2)(pcx, 1, 2);
+ mem_fn(&X::g2)(sp, 1, 2);
+
+ mem_fn(&X::f3)(x, 1, 2, 3);
+ mem_fn(&X::f3)(&x, 1, 2, 3);
+ mem_fn(&X::f3)(sp, 1, 2, 3);
+
+ mem_fn(&X::g3)(x, 1, 2, 3);
+ mem_fn(&X::g3)(rcx, 1, 2, 3);
+ mem_fn(&X::g3)(&x, 1, 2, 3);
+ mem_fn(&X::g3)(pcx, 1, 2, 3);
+ mem_fn(&X::g3)(sp, 1, 2, 3);
+
+ mem_fn(&X::f4)(x, 1, 2, 3, 4);
+ mem_fn(&X::f4)(&x, 1, 2, 3, 4);
+ mem_fn(&X::f4)(sp, 1, 2, 3, 4);
+
+ mem_fn(&X::g4)(x, 1, 2, 3, 4);
+ mem_fn(&X::g4)(rcx, 1, 2, 3, 4);
+ mem_fn(&X::g4)(&x, 1, 2, 3, 4);
+ mem_fn(&X::g4)(pcx, 1, 2, 3, 4);
+ mem_fn(&X::g4)(sp, 1, 2, 3, 4);
+
+ mem_fn(&X::f5)(x, 1, 2, 3, 4, 5);
+ mem_fn(&X::f5)(&x, 1, 2, 3, 4, 5);
+ mem_fn(&X::f5)(sp, 1, 2, 3, 4, 5);
+
+ mem_fn(&X::g5)(x, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(rcx, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(&x, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(pcx, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(sp, 1, 2, 3, 4, 5);
+
+ mem_fn(&X::f6)(x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::f6)(&x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::f6)(sp, 1, 2, 3, 4, 5, 6);
+
+ mem_fn(&X::g6)(x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(rcx, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(&x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(pcx, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(sp, 1, 2, 3, 4, 5, 6);
+
+ mem_fn(&X::f7)(x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::f7)(&x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::f7)(sp, 1, 2, 3, 4, 5, 6, 7);
+
+ mem_fn(&X::g7)(x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(rcx, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(&x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(pcx, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(sp, 1, 2, 3, 4, 5, 6, 7);
+
+ mem_fn(&X::f8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::f8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::f8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
+
+ mem_fn(&X::g8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(rcx, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(pcx, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
+
+ return detect_errors(mem_fn(&X::hash)(x) == 17610 && mem_fn(&X::hash)(sp) == 2155);
+}
diff --git a/test/mem_fn_unary_addr_test.cpp b/test/mem_fn_unary_addr_test.cpp
new file mode 100644
index 0000000..61e9160
--- /dev/null
+++ b/test/mem_fn_unary_addr_test.cpp
@@ -0,0 +1,151 @@
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// mem_fn_unary_addr_test.cpp - poisoned operator& test
+//
+// Copyright (c) 2009 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
+//
+
+#include <boost/mem_fn.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+unsigned int hash = 0;
+
+struct X
+{
+ int f0() { f1(17); return 0; }
+ int g0() const { g1(17); return 0; }
+
+ int f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
+ int g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
+
+ int f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
+ int g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
+
+ int f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
+ int g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
+
+ int f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
+ int g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
+
+ int f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
+ int g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
+
+ int f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
+ int g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
+
+ int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
+ int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
+
+ int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
+ int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
+};
+
+template<class T> class Y
+{
+private:
+
+ T * pt_;
+
+ void operator& ();
+ void operator& () const;
+
+public:
+
+ explicit Y( T * pt ): pt_( pt )
+ {
+ }
+
+ T * get() const
+ {
+ return pt_;
+ }
+};
+
+#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x620 ) )
+namespace boost
+{
+#endif
+
+template<class T> T * get_pointer( Y< T > const & y )
+{
+ return y.get();
+}
+
+#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x620 ) )
+} // namespace boost
+#endif
+
+int detect_errors(bool x)
+{
+ if( x )
+ {
+ std::cerr << "no errors detected.\n";
+ return 0;
+ }
+ else
+ {
+ std::cerr << "test failed.\n";
+ return 1;
+ }
+}
+
+int main()
+{
+ using boost::mem_fn;
+
+ X x;
+
+ Y<X> px( &x );
+ Y<X const> pcx( &x );
+
+ mem_fn(&X::f0)( px );
+ mem_fn(&X::g0)( pcx );
+
+ mem_fn(&X::f1)( px, 1 );
+ mem_fn(&X::g1)( pcx, 1 );
+
+ mem_fn(&X::f2)( px, 1, 2 );
+ mem_fn(&X::g2)( pcx, 1, 2 );
+
+ mem_fn(&X::f3)( px, 1, 2, 3 );
+ mem_fn(&X::g3)( pcx, 1, 2, 3 );
+
+ mem_fn(&X::f4)( px, 1, 2, 3, 4 );
+ mem_fn(&X::g4)( pcx, 1, 2, 3, 4 );
+
+ mem_fn(&X::f5)( px, 1, 2, 3, 4, 5 );
+ mem_fn(&X::g5)( pcx, 1, 2, 3, 4, 5 );
+
+ mem_fn(&X::f6)( px, 1, 2, 3, 4, 5, 6 );
+ mem_fn(&X::g6)( pcx, 1, 2, 3, 4, 5, 6 );
+
+ mem_fn(&X::f7)( px, 1, 2, 3, 4, 5, 6, 7 );
+ mem_fn(&X::g7)( pcx, 1, 2, 3, 4, 5, 6, 7 );
+
+ mem_fn(&X::f8)( px, 1, 2, 3, 4, 5, 6, 7, 8 );
+ mem_fn(&X::g8)( pcx, 1, 2, 3, 4, 5, 6, 7, 8 );
+
+ return detect_errors( hash == 2155 );
+}
diff --git a/test/mem_fn_void_test.cpp b/test/mem_fn_void_test.cpp
new file mode 100644
index 0000000..9f52ccf
--- /dev/null
+++ b/test/mem_fn_void_test.cpp
@@ -0,0 +1,184 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+//
+// mem_fn_void_test.cpp - a test for mem_fn.hpp + void returns
+//
+// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
+//
+// 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/mem_fn.hpp>
+#include <boost/shared_ptr.hpp>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(push, 3)
+#endif
+
+#include <iostream>
+
+#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
+#pragma warning(pop)
+#endif
+
+
+struct X
+{
+ mutable unsigned int hash;
+
+ X(): hash(0) {}
+
+ void f0() { f1(17); }
+ void g0() const { g1(17); }
+
+ void f1(int a1) { hash = (hash * 17041 + a1) % 32768; }
+ void g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; }
+
+ void f2(int a1, int a2) { f1(a1); f1(a2); }
+ void g2(int a1, int a2) const { g1(a1); g1(a2); }
+
+ void f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); }
+ void g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); }
+
+ void f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); }
+ void g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); }
+
+ void f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); }
+ void g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); }
+
+ void f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); }
+ void g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); }
+
+ void f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); }
+ void g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); }
+
+ void f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); }
+ void g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); }
+};
+
+int detect_errors(bool x)
+{
+ if(x)
+ {
+ std::cerr << "no errors detected.\n";
+ return 0;
+ }
+ else
+ {
+ std::cerr << "test failed.\n";
+ return 1;
+ }
+}
+
+int main()
+{
+ using boost::mem_fn;
+
+ X x;
+
+ X const & rcx = x;
+ X const * pcx = &x;
+
+ boost::shared_ptr<X> sp(new X);
+
+ mem_fn(&X::f0)(x);
+ mem_fn(&X::f0)(&x);
+ mem_fn(&X::f0)(sp);
+
+ mem_fn(&X::g0)(x);
+ mem_fn(&X::g0)(rcx);
+ mem_fn(&X::g0)(&x);
+ mem_fn(&X::g0)(pcx);
+ mem_fn(&X::g0)(sp);
+
+ mem_fn(&X::f1)(x, 1);
+ mem_fn(&X::f1)(&x, 1);
+ mem_fn(&X::f1)(sp, 1);
+
+ mem_fn(&X::g1)(x, 1);
+ mem_fn(&X::g1)(rcx, 1);
+ mem_fn(&X::g1)(&x, 1);
+ mem_fn(&X::g1)(pcx, 1);
+ mem_fn(&X::g1)(sp, 1);
+
+ mem_fn(&X::f2)(x, 1, 2);
+ mem_fn(&X::f2)(&x, 1, 2);
+ mem_fn(&X::f2)(sp, 1, 2);
+
+ mem_fn(&X::g2)(x, 1, 2);
+ mem_fn(&X::g2)(rcx, 1, 2);
+ mem_fn(&X::g2)(&x, 1, 2);
+ mem_fn(&X::g2)(pcx, 1, 2);
+ mem_fn(&X::g2)(sp, 1, 2);
+
+ mem_fn(&X::f3)(x, 1, 2, 3);
+ mem_fn(&X::f3)(&x, 1, 2, 3);
+ mem_fn(&X::f3)(sp, 1, 2, 3);
+
+ mem_fn(&X::g3)(x, 1, 2, 3);
+ mem_fn(&X::g3)(rcx, 1, 2, 3);
+ mem_fn(&X::g3)(&x, 1, 2, 3);
+ mem_fn(&X::g3)(pcx, 1, 2, 3);
+ mem_fn(&X::g3)(sp, 1, 2, 3);
+
+ mem_fn(&X::f4)(x, 1, 2, 3, 4);
+ mem_fn(&X::f4)(&x, 1, 2, 3, 4);
+ mem_fn(&X::f4)(sp, 1, 2, 3, 4);
+
+ mem_fn(&X::g4)(x, 1, 2, 3, 4);
+ mem_fn(&X::g4)(rcx, 1, 2, 3, 4);
+ mem_fn(&X::g4)(&x, 1, 2, 3, 4);
+ mem_fn(&X::g4)(pcx, 1, 2, 3, 4);
+ mem_fn(&X::g4)(sp, 1, 2, 3, 4);
+
+ mem_fn(&X::f5)(x, 1, 2, 3, 4, 5);
+ mem_fn(&X::f5)(&x, 1, 2, 3, 4, 5);
+ mem_fn(&X::f5)(sp, 1, 2, 3, 4, 5);
+
+ mem_fn(&X::g5)(x, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(rcx, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(&x, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(pcx, 1, 2, 3, 4, 5);
+ mem_fn(&X::g5)(sp, 1, 2, 3, 4, 5);
+
+ mem_fn(&X::f6)(x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::f6)(&x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::f6)(sp, 1, 2, 3, 4, 5, 6);
+
+ mem_fn(&X::g6)(x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(rcx, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(&x, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(pcx, 1, 2, 3, 4, 5, 6);
+ mem_fn(&X::g6)(sp, 1, 2, 3, 4, 5, 6);
+
+ mem_fn(&X::f7)(x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::f7)(&x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::f7)(sp, 1, 2, 3, 4, 5, 6, 7);
+
+ mem_fn(&X::g7)(x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(rcx, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(&x, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(pcx, 1, 2, 3, 4, 5, 6, 7);
+ mem_fn(&X::g7)(sp, 1, 2, 3, 4, 5, 6, 7);
+
+ mem_fn(&X::f8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::f8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::f8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
+
+ mem_fn(&X::g8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(rcx, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(pcx, 1, 2, 3, 4, 5, 6, 7, 8);
+ mem_fn(&X::g8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
+
+ return detect_errors(x.hash == 17610 && sp->hash == 2155);
+}
diff --git a/test/placeholder_const_ref_test.cpp b/test/placeholder_const_ref_test.cpp
new file mode 100644
index 0000000..f0835b0
--- /dev/null
+++ b/test/placeholder_const_ref_test.cpp
@@ -0,0 +1,37 @@
+//
+// placeholder_const_ref_test.cpp - forming a const& to _1
+//
+// Copyright 2015 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
+//
+
+#include <boost/bind/placeholders.hpp>
+#include <boost/is_placeholder.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+//
+
+template<class T> void test( T const &, int i )
+{
+ BOOST_TEST_EQ( boost::is_placeholder<T>::value, i );
+}
+
+int main()
+{
+ using namespace boost::placeholders;
+
+ test( _1, 1 );
+ test( _2, 2 );
+ test( _3, 3 );
+ test( _4, 4 );
+ test( _5, 5 );
+ test( _6, 6 );
+ test( _7, 7 );
+ test( _8, 8 );
+ test( _9, 9 );
+
+ return boost::report_errors();
+}
diff --git a/test/placeholder_std_bind_test.cpp b/test/placeholder_std_bind_test.cpp
new file mode 100644
index 0000000..3034b8e
--- /dev/null
+++ b/test/placeholder_std_bind_test.cpp
@@ -0,0 +1,46 @@
+//
+// placeholder_std_bind_test.cpp - std::bind with Boost's _1
+//
+// Copyright 2016 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
+//
+
+#include <boost/config.hpp>
+
+#if defined( BOOST_NO_CXX11_HDR_FUNCTIONAL )
+
+int main()
+{
+}
+
+#else
+
+#include <boost/bind.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <functional>
+
+namespace std
+{
+
+template<int N> struct is_placeholder< boost::arg<N> >: public integral_constant<int, N> {};
+
+} // namespace std
+
+int foo( int i )
+{
+ return i;
+}
+
+int main()
+{
+ BOOST_TEST_EQ( std::bind( foo, _1 )( 1 ), 1 );
+ BOOST_TEST_EQ( std::bind( foo, _2 )( 1, 2 ), 2 );
+ BOOST_TEST_EQ( std::bind( foo, _3 )( 1, 2, 3 ), 3 );
+
+ return boost::report_errors();
+}
+
+#endif
diff --git a/test/protect_test.cpp b/test/protect_test.cpp
new file mode 100644
index 0000000..0da7d51
--- /dev/null
+++ b/test/protect_test.cpp
@@ -0,0 +1,281 @@
+// protect_test.cpp
+//
+// Copyright (c) 2009 Steven Watanabe
+//
+// 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/bind/protect.hpp>
+#include <boost/bind.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+
+int f(int x)
+{
+ return x;
+}
+
+int& g(int& x)
+{
+ return x;
+}
+
+template<class T>
+const T& constify(const T& arg)
+{
+ return arg;
+}
+
+int main()
+{
+ int i[9] = {0,1,2,3,4,5,6,7,8};
+
+ // non-const
+
+ // test nullary
+ BOOST_TEST(boost::protect(boost::bind(f, 1))() == 1);
+
+ // test lvalues
+
+ BOOST_TEST(&boost::protect(boost::bind(g, _1))(i[0]) == &i[0]);
+
+ BOOST_TEST(&boost::protect(boost::bind(g, _1))(i[0], i[1]) == &i[0]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _2))(i[0], i[1]) == &i[1]);
+
+ BOOST_TEST(&boost::protect(boost::bind(g, _1))(i[0], i[1], i[2]) == &i[0]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _2))(i[0], i[1], i[2]) == &i[1]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _3))(i[0], i[1], i[2]) == &i[2]);
+
+ BOOST_TEST(&boost::protect(boost::bind(g, _1))(i[0], i[1], i[2], i[3]) == &i[0]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _2))(i[0], i[1], i[2], i[3]) == &i[1]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _3))(i[0], i[1], i[2], i[3]) == &i[2]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _4))(i[0], i[1], i[2], i[3]) == &i[3]);
+
+ BOOST_TEST(&boost::protect(boost::bind(g, _1))(i[0], i[1], i[2], i[3], i[4]) == &i[0]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _2))(i[0], i[1], i[2], i[3], i[4]) == &i[1]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _3))(i[0], i[1], i[2], i[3], i[4]) == &i[2]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _4))(i[0], i[1], i[2], i[3], i[4]) == &i[3]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _5))(i[0], i[1], i[2], i[3], i[4]) == &i[4]);
+
+ BOOST_TEST(&boost::protect(boost::bind(g, _1))(i[0], i[1], i[2], i[3], i[4], i[5]) == &i[0]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _2))(i[0], i[1], i[2], i[3], i[4], i[5]) == &i[1]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _3))(i[0], i[1], i[2], i[3], i[4], i[5]) == &i[2]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _4))(i[0], i[1], i[2], i[3], i[4], i[5]) == &i[3]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _5))(i[0], i[1], i[2], i[3], i[4], i[5]) == &i[4]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _6))(i[0], i[1], i[2], i[3], i[4], i[5]) == &i[5]);
+
+ BOOST_TEST(&boost::protect(boost::bind(g, _1))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[0]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _2))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[1]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _3))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[2]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _4))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[3]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _5))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[4]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _6))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[5]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _7))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[6]);
+
+ BOOST_TEST(&boost::protect(boost::bind(g, _1))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[0]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _2))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[1]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _3))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[2]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _4))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[3]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _5))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[4]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _6))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[5]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _7))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[6]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _8))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[7]);
+
+ BOOST_TEST(&boost::protect(boost::bind(g, _1))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[0]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _2))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[1]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _3))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[2]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _4))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[3]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _5))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[4]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _6))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[5]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _7))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[6]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _8))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[7]);
+ BOOST_TEST(&boost::protect(boost::bind(g, _9))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[8]);
+
+ // test rvalues
+
+ BOOST_TEST(boost::protect(boost::bind(f, _1))(0) == 0);
+
+ BOOST_TEST(boost::protect(boost::bind(f, _1))(0, 1) == 0);
+ BOOST_TEST(boost::protect(boost::bind(f, _2))(0, 1) == 1);
+
+ BOOST_TEST(boost::protect(boost::bind(f, _1))(0, 1, 2) == 0);
+ BOOST_TEST(boost::protect(boost::bind(f, _2))(0, 1, 2) == 1);
+ BOOST_TEST(boost::protect(boost::bind(f, _3))(0, 1, 2) == 2);
+
+ BOOST_TEST(boost::protect(boost::bind(f, _1))(0, 1, 2, 3) == 0);
+ BOOST_TEST(boost::protect(boost::bind(f, _2))(0, 1, 2, 3) == 1);
+ BOOST_TEST(boost::protect(boost::bind(f, _3))(0, 1, 2, 3) == 2);
+ BOOST_TEST(boost::protect(boost::bind(f, _4))(0, 1, 2, 3) == 3);
+
+ BOOST_TEST(boost::protect(boost::bind(f, _1))(0, 1, 2, 3, 4) == 0);
+ BOOST_TEST(boost::protect(boost::bind(f, _2))(0, 1, 2, 3, 4) == 1);
+ BOOST_TEST(boost::protect(boost::bind(f, _3))(0, 1, 2, 3, 4) == 2);
+ BOOST_TEST(boost::protect(boost::bind(f, _4))(0, 1, 2, 3, 4) == 3);
+ BOOST_TEST(boost::protect(boost::bind(f, _5))(0, 1, 2, 3, 4) == 4);
+
+ BOOST_TEST(boost::protect(boost::bind(f, _1))(0, 1, 2, 3, 4, 5) == 0);
+ BOOST_TEST(boost::protect(boost::bind(f, _2))(0, 1, 2, 3, 4, 5) == 1);
+ BOOST_TEST(boost::protect(boost::bind(f, _3))(0, 1, 2, 3, 4, 5) == 2);
+ BOOST_TEST(boost::protect(boost::bind(f, _4))(0, 1, 2, 3, 4, 5) == 3);
+ BOOST_TEST(boost::protect(boost::bind(f, _5))(0, 1, 2, 3, 4, 5) == 4);
+ BOOST_TEST(boost::protect(boost::bind(f, _6))(0, 1, 2, 3, 4, 5) == 5);
+
+ BOOST_TEST(boost::protect(boost::bind(f, _1))(0, 1, 2, 3, 4, 5, 6) == 0);
+ BOOST_TEST(boost::protect(boost::bind(f, _2))(0, 1, 2, 3, 4, 5, 6) == 1);
+ BOOST_TEST(boost::protect(boost::bind(f, _3))(0, 1, 2, 3, 4, 5, 6) == 2);
+ BOOST_TEST(boost::protect(boost::bind(f, _4))(0, 1, 2, 3, 4, 5, 6) == 3);
+ BOOST_TEST(boost::protect(boost::bind(f, _5))(0, 1, 2, 3, 4, 5, 6) == 4);
+ BOOST_TEST(boost::protect(boost::bind(f, _6))(0, 1, 2, 3, 4, 5, 6) == 5);
+ BOOST_TEST(boost::protect(boost::bind(f, _7))(0, 1, 2, 3, 4, 5, 6) == 6);
+
+ BOOST_TEST(boost::protect(boost::bind(f, _1))(0, 1, 2, 3, 4, 5, 6, 7) == 0);
+ BOOST_TEST(boost::protect(boost::bind(f, _2))(0, 1, 2, 3, 4, 5, 6, 7) == 1);
+ BOOST_TEST(boost::protect(boost::bind(f, _3))(0, 1, 2, 3, 4, 5, 6, 7) == 2);
+ BOOST_TEST(boost::protect(boost::bind(f, _4))(0, 1, 2, 3, 4, 5, 6, 7) == 3);
+ BOOST_TEST(boost::protect(boost::bind(f, _5))(0, 1, 2, 3, 4, 5, 6, 7) == 4);
+ BOOST_TEST(boost::protect(boost::bind(f, _6))(0, 1, 2, 3, 4, 5, 6, 7) == 5);
+ BOOST_TEST(boost::protect(boost::bind(f, _7))(0, 1, 2, 3, 4, 5, 6, 7) == 6);
+ BOOST_TEST(boost::protect(boost::bind(f, _8))(0, 1, 2, 3, 4, 5, 6, 7) == 7);
+
+ BOOST_TEST(boost::protect(boost::bind(f, _1))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 0);
+ BOOST_TEST(boost::protect(boost::bind(f, _2))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 1);
+ BOOST_TEST(boost::protect(boost::bind(f, _3))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 2);
+ BOOST_TEST(boost::protect(boost::bind(f, _4))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 3);
+ BOOST_TEST(boost::protect(boost::bind(f, _5))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 4);
+ BOOST_TEST(boost::protect(boost::bind(f, _6))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 5);
+ BOOST_TEST(boost::protect(boost::bind(f, _7))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 6);
+ BOOST_TEST(boost::protect(boost::bind(f, _8))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 7);
+ BOOST_TEST(boost::protect(boost::bind(f, _9))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 8);
+
+ // test mixed perfect forwarding
+ BOOST_TEST(boost::protect(boost::bind(f, _1))(i[0], 1) == 0);
+ BOOST_TEST(boost::protect(boost::bind(f, _2))(i[0], 1) == 1);
+ BOOST_TEST(boost::protect(boost::bind(f, _1))(0, i[1]) == 0);
+ BOOST_TEST(boost::protect(boost::bind(f, _2))(0, i[1]) == 1);
+
+ // const
+
+ // test nullary
+ BOOST_TEST(constify(constify(boost::protect(boost::bind(f, 1))))() == 1);
+
+ // test lvalues
+ BOOST_TEST(&constify(constify(boost::protect(boost::bind(g, _1))))(i[0]) == &i[0]);
+
+ BOOST_TEST(&constify(constify(boost::protect(boost::bind(g, _1))))(i[0], i[1]) == &i[0]);
+ BOOST_TEST(&constify(constify(boost::protect(boost::bind(g, _2))))(i[0], i[1]) == &i[1]);
+
+ BOOST_TEST(&constify(constify(boost::protect(boost::bind(g, _1))))(i[0], i[1], i[2]) == &i[0]);
+ BOOST_TEST(&constify(constify(boost::protect(boost::bind(g, _2))))(i[0], i[1], i[2]) == &i[1]);
+ BOOST_TEST(&constify(constify(boost::protect(boost::bind(g, _3))))(i[0], i[1], i[2]) == &i[2]);
+
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _1)))(i[0], i[1], i[2], i[3]) == &i[0]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _2)))(i[0], i[1], i[2], i[3]) == &i[1]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _3)))(i[0], i[1], i[2], i[3]) == &i[2]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _4)))(i[0], i[1], i[2], i[3]) == &i[3]);
+
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _1)))(i[0], i[1], i[2], i[3], i[4]) == &i[0]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _2)))(i[0], i[1], i[2], i[3], i[4]) == &i[1]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _3)))(i[0], i[1], i[2], i[3], i[4]) == &i[2]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _4)))(i[0], i[1], i[2], i[3], i[4]) == &i[3]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _5)))(i[0], i[1], i[2], i[3], i[4]) == &i[4]);
+
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _1)))(i[0], i[1], i[2], i[3], i[4], i[5]) == &i[0]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _2)))(i[0], i[1], i[2], i[3], i[4], i[5]) == &i[1]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _3)))(i[0], i[1], i[2], i[3], i[4], i[5]) == &i[2]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _4)))(i[0], i[1], i[2], i[3], i[4], i[5]) == &i[3]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _5)))(i[0], i[1], i[2], i[3], i[4], i[5]) == &i[4]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _6)))(i[0], i[1], i[2], i[3], i[4], i[5]) == &i[5]);
+
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _1)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[0]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _2)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[1]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _3)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[2]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _4)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[3]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _5)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[4]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _6)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[5]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _7)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6]) == &i[6]);
+
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _1)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[0]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _2)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[1]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _3)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[2]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _4)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[3]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _5)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[4]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _6)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[5]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _7)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[6]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _8)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]) == &i[7]);
+
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _1)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[0]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _2)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[1]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _3)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[2]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _4)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[3]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _5)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[4]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _6)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[5]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _7)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[6]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _8)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[7]);
+ BOOST_TEST(&constify(boost::protect(boost::bind(g, _9)))(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], i[8]) == &i[8]);
+
+ // test rvalues
+
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _1)))(0) == 0);
+
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _1)))(0, 1) == 0);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _2)))(0, 1) == 1);
+
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _1)))(0, 1, 2) == 0);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _2)))(0, 1, 2) == 1);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _3)))(0, 1, 2) == 2);
+
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _1)))(0, 1, 2, 3) == 0);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _2)))(0, 1, 2, 3) == 1);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _3)))(0, 1, 2, 3) == 2);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _4)))(0, 1, 2, 3) == 3);
+
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _1)))(0, 1, 2, 3, 4) == 0);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _2)))(0, 1, 2, 3, 4) == 1);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _3)))(0, 1, 2, 3, 4) == 2);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _4)))(0, 1, 2, 3, 4) == 3);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _5)))(0, 1, 2, 3, 4) == 4);
+
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _1)))(0, 1, 2, 3, 4, 5) == 0);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _2)))(0, 1, 2, 3, 4, 5) == 1);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _3)))(0, 1, 2, 3, 4, 5) == 2);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _4)))(0, 1, 2, 3, 4, 5) == 3);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _5)))(0, 1, 2, 3, 4, 5) == 4);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _6)))(0, 1, 2, 3, 4, 5) == 5);
+
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _1)))(0, 1, 2, 3, 4, 5, 6) == 0);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _2)))(0, 1, 2, 3, 4, 5, 6) == 1);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _3)))(0, 1, 2, 3, 4, 5, 6) == 2);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _4)))(0, 1, 2, 3, 4, 5, 6) == 3);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _5)))(0, 1, 2, 3, 4, 5, 6) == 4);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _6)))(0, 1, 2, 3, 4, 5, 6) == 5);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _7)))(0, 1, 2, 3, 4, 5, 6) == 6);
+
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _1)))(0, 1, 2, 3, 4, 5, 6, 7) == 0);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _2)))(0, 1, 2, 3, 4, 5, 6, 7) == 1);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _3)))(0, 1, 2, 3, 4, 5, 6, 7) == 2);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _4)))(0, 1, 2, 3, 4, 5, 6, 7) == 3);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _5)))(0, 1, 2, 3, 4, 5, 6, 7) == 4);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _6)))(0, 1, 2, 3, 4, 5, 6, 7) == 5);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _7)))(0, 1, 2, 3, 4, 5, 6, 7) == 6);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _8)))(0, 1, 2, 3, 4, 5, 6, 7) == 7);
+
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _1)))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 0);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _2)))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 1);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _3)))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 2);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _4)))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 3);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _5)))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 4);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _6)))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 5);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _7)))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 6);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _8)))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 7);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _9)))(0, 1, 2, 3, 4, 5, 6, 7, 8) == 8);
+
+ // test mixed perfect forwarding
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _1)))(i[0], 1) == 0);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _2)))(i[0], 1) == 1);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _1)))(0, i[1]) == 0);
+ BOOST_TEST(constify(boost::protect(boost::bind(f, _2)))(0, i[1]) == 1);
+
+ return boost::report_errors();
+}
diff --git a/test/quick.cpp b/test/quick.cpp
new file mode 100644
index 0000000..9aa215c
--- /dev/null
+++ b/test/quick.cpp
@@ -0,0 +1,27 @@
+//
+// quick.cpp - a quick test for boost/bind.hpp
+//
+// Copyright 2017 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
+//
+
+#include <boost/bind.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+int f( int a, int b, int c )
+{
+ return a + 10 * b + 100 * c;
+}
+
+int main()
+{
+ int const i = 1;
+
+ BOOST_TEST_EQ( boost::bind( f, _1, 2, 3 )( i ), 321 );
+
+ return boost::report_errors();
+}
diff --git a/test/ref_fn_test.cpp b/test/ref_fn_test.cpp
new file mode 100644
index 0000000..aec54e8
--- /dev/null
+++ b/test/ref_fn_test.cpp
@@ -0,0 +1,81 @@
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(disable: 4786) // identifier truncated in debug info
+#pragma warning(disable: 4710) // function not inlined
+#pragma warning(disable: 4711) // function selected for automatic inline expansion
+#pragma warning(disable: 4514) // unreferenced inline removed
+#endif
+
+// ref_fn_test.cpp: ref( f )
+//
+// Copyright (c) 2008 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
+
+#include <boost/ref.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+
+void f0()
+{
+}
+
+void f1(int)
+{
+}
+
+void f2(int, int)
+{
+}
+
+void f3(int, int, int)
+{
+}
+
+void f4(int, int, int, int)
+{
+}
+
+void f5(int, int, int, int, int)
+{
+}
+
+void f6(int, int, int, int, int, int)
+{
+}
+
+void f7(int, int, int, int, int, int, int)
+{
+}
+
+void f8(int, int, int, int, int, int, int, int)
+{
+}
+
+void f9(int, int, int, int, int, int, int, int, int)
+{
+}
+
+#define BOOST_TEST_REF( f ) BOOST_TEST( &boost::ref( f ).get() == &f )
+
+int main()
+{
+ int v = 0;
+ BOOST_TEST_REF( v );
+
+ BOOST_TEST_REF( f0 );
+ BOOST_TEST_REF( f1 );
+ BOOST_TEST_REF( f2 );
+ BOOST_TEST_REF( f3 );
+ BOOST_TEST_REF( f4 );
+ BOOST_TEST_REF( f5 );
+ BOOST_TEST_REF( f6 );
+ BOOST_TEST_REF( f7 );
+ BOOST_TEST_REF( f8 );
+ BOOST_TEST_REF( f9 );
+
+ return boost::report_errors();
+}