mirror of
https://github.com/boostorg/bind.git
synced 2026-06-11 11:41:11 +02:00
Compare commits
98 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 95171f4463 | |||
| e22e641bbf | |||
| 224e9f5eec | |||
| 1943ac521b | |||
| 77d2c4bab1 | |||
| 41a2e80197 | |||
| 9ea5cf40da | |||
| 4d1f7d0411 | |||
| 967e9af0eb | |||
| c5396f02c6 | |||
| e8646fa260 | |||
| a87638486b | |||
| 472f9e6ebe | |||
| d43950f1a6 | |||
| f57cb48b9f | |||
| 03bb04bb85 | |||
| bba3d96bda | |||
| cb2cca146f | |||
| 3304c00da3 | |||
| 3e980f8c34 | |||
| 42efa96a2f | |||
| d90c96a7e4 | |||
| d28a5cc23a | |||
| 98daeb3ad5 | |||
| 35b98458a1 | |||
| 2d6ccb09a7 | |||
| a9deb8c577 | |||
| 840b39144c | |||
| e5a60bfe1c | |||
| 5fbb6558ec | |||
| 3b89e4215b | |||
| efc36ff07b | |||
| b85adc3a58 | |||
| 0c96dbe3f1 | |||
| 2a21f7df2c | |||
| 9cfe194f80 | |||
| 66ed4fc9e1 | |||
| 23b64e1358 | |||
| 0aa407e77d | |||
| 27d1cf539b | |||
| c7710aad38 | |||
| 4a1c4894c7 | |||
| 9f0a516068 | |||
| 6602068638 | |||
| c25b216898 | |||
| ed817c5b15 | |||
| 7b9a97a758 | |||
| b1f05e7268 | |||
| 28cb8f8206 | |||
| ccd0394b86 | |||
| ee5ab38a63 | |||
| 35a2d208d5 | |||
| 424480e55b | |||
| 094d43c6e8 | |||
| f01e59b682 | |||
| 9ffd0a08c5 | |||
| 4e287df40c | |||
| 5c53d7db2a | |||
| 0904a14c1a | |||
| 4377e763a5 | |||
| cc984fad42 | |||
| 53c2e449d1 | |||
| 74fae199f6 | |||
| 4a41a09d27 | |||
| 2244135e86 | |||
| 807bbfd434 | |||
| 6fbbcd0d3c | |||
| 21f1171900 | |||
| f8f4029628 | |||
| dbf6e0cf4b | |||
| 8f1bb7f13f | |||
| 6601553820 | |||
| b6a90777c8 | |||
| ea8c0ef25e | |||
| f91de70d8e | |||
| 4b97a70f64 | |||
| 7feefb7313 | |||
| 46ae046f41 | |||
| 673d6b0bf0 | |||
| 9ca672c10d | |||
| 016a3b8d96 | |||
| 6ed01de60f | |||
| 5f95e4d9de | |||
| 90069948ec | |||
| 367728cafe | |||
| 4be201beba | |||
| 04a438f5f4 | |||
| b06f6a6d89 | |||
| 81c8af90ec | |||
| c9db3c51ea | |||
| 8c09072ead | |||
| 4876b82a73 | |||
| 7b7784d470 | |||
| eca328b27c | |||
| ad46d513d7 | |||
| cc3ebc18b8 | |||
| 5a10daef4d | |||
| 51e4031aaf |
+6
-5
@@ -1,4 +1,6 @@
|
|||||||
#if defined(_MSC_VER) && !defined(__ICL)
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||||
#pragma warning(disable: 4710) // function not inlined
|
#pragma warning(disable: 4710) // function not inlined
|
||||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||||
@@ -12,10 +14,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
|||||||
+10
-39
@@ -1,4 +1,6 @@
|
|||||||
#if defined(_MSC_VER) && !defined(__ICL)
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||||
#pragma warning(disable: 4710) // function not inlined
|
#pragma warning(disable: 4710) // function not inlined
|
||||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||||
@@ -10,10 +12,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
@@ -30,32 +31,18 @@
|
|||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// default implementation of visit_each
|
//
|
||||||
|
|
||||||
namespace boost
|
|
||||||
{
|
|
||||||
template<class V, class T> void visit_each(V & v, T const & t, long)
|
|
||||||
{
|
|
||||||
v(t, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// visitor
|
|
||||||
|
|
||||||
int hash = 0;
|
|
||||||
|
|
||||||
struct visitor
|
struct visitor
|
||||||
{
|
{
|
||||||
template<class T> void operator()(boost::reference_wrapper<T> const & r, int) const
|
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";
|
std::cout << "Reference to " << typeid(T).name() << " @ " << &r.get() << " (with value " << r.get() << ")\n";
|
||||||
hash += r.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> void operator()(T const &, long) const
|
template<class T> void operator()( T const & t ) const
|
||||||
{
|
{
|
||||||
std::cout << "Value of type " << typeid(T).name() << '\n';
|
std::cout << "Value of type " << typeid(T).name() << " (with value " << t << ")\n";
|
||||||
++hash;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -69,26 +56,10 @@ int f(int & i, int & j, int)
|
|||||||
int x = 2;
|
int x = 2;
|
||||||
int y = 7;
|
int y = 7;
|
||||||
|
|
||||||
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()
|
int main()
|
||||||
{
|
{
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
|
|
||||||
visitor v;
|
visitor v;
|
||||||
visit_each(v, bind<int>(bind(f, ref(x), _1, 42), ref(y)), 0);
|
visit_each(v, bind<int>(bind(f, ref(x), _1, 42), ref(y)), 0);
|
||||||
|
|
||||||
return detect_errors(hash == 12);
|
|
||||||
}
|
}
|
||||||
|
|||||||
+240
@@ -0,0 +1,240 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
||||||
|
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
||||||
|
<library name="Ref" dirname="ref" id="ref" last-revision="$Date$">
|
||||||
|
<libraryinfo>
|
||||||
|
<author>
|
||||||
|
<firstname>Jaakko</firstname>
|
||||||
|
<surname>Järvi</surname>
|
||||||
|
</author>
|
||||||
|
<author>
|
||||||
|
<firstname>Peter</firstname>
|
||||||
|
<surname>Dimov</surname>
|
||||||
|
</author>
|
||||||
|
<author>
|
||||||
|
<firstname>Douglas</firstname>
|
||||||
|
<surname>Gregor</surname>
|
||||||
|
</author>
|
||||||
|
<author>
|
||||||
|
<firstname>Dave</firstname>
|
||||||
|
<surname>Abrahams</surname>
|
||||||
|
</author>
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
<year>1999</year>
|
||||||
|
<year>2000</year>
|
||||||
|
<holder>Jaakko Järvi</holder>
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
<year>2001</year>
|
||||||
|
<year>2002</year>
|
||||||
|
<holder>Peter Dimov</holder>
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
<year>2002</year>
|
||||||
|
<holder>David Abrahams</holder>
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<legalnotice>
|
||||||
|
<para>Subject to the Boost Software License, Version 1.0. See
|
||||||
|
accompanying file <filename>LICENSE_1_0.txt</filename> or copy at
|
||||||
|
<ulink url="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</ulink>.
|
||||||
|
</para>
|
||||||
|
</legalnotice>
|
||||||
|
|
||||||
|
<librarypurpose>A utility library for passing references to generic functions</librarypurpose>
|
||||||
|
<librarycategory name="category:higher-order"/>
|
||||||
|
</libraryinfo>
|
||||||
|
|
||||||
|
<title>Boost.Ref</title>
|
||||||
|
|
||||||
|
<section id="ref.intro">
|
||||||
|
<title>Introduction</title>
|
||||||
|
|
||||||
|
<using-namespace name="boost"/>
|
||||||
|
|
||||||
|
<para>The Ref library is a small library that is useful for passing
|
||||||
|
references to function templates (algorithms) that would usually
|
||||||
|
take copies of their arguments. It defines the class template
|
||||||
|
<code><classname>boost::reference_wrapper<T></classname></code>,
|
||||||
|
the two functions
|
||||||
|
<code><functionname>boost::ref</functionname></code> and
|
||||||
|
<code><functionname>boost::cref</functionname></code> that return
|
||||||
|
instances of <code>boost::reference_wrapper<T></code>, and the
|
||||||
|
two traits classes
|
||||||
|
<code><classname>boost::is_reference_wrapper<T></classname></code>
|
||||||
|
and
|
||||||
|
<code><classname>boost::unwrap_reference<T></classname></code>.</para>
|
||||||
|
|
||||||
|
<para>The purpose of
|
||||||
|
<code>boost::reference_wrapper<T></code> is to
|
||||||
|
contain a reference to an object of type T. It is primarily used to
|
||||||
|
"feed" references to function templates (algorithms) that take their
|
||||||
|
parameter by value.</para>
|
||||||
|
|
||||||
|
<para>To support this usage,
|
||||||
|
<code>boost::reference_wrapper<T></code> provides an implicit
|
||||||
|
conversion to <code>T&</code>. This usually allows the function
|
||||||
|
templates to work on references unmodified.</para>
|
||||||
|
|
||||||
|
<para><code>boost::reference_wrapper<T></code> is
|
||||||
|
both CopyConstructible and Assignable (ordinary references are not
|
||||||
|
Assignable).</para>
|
||||||
|
|
||||||
|
<para>The expression <code>boost::ref(x)</code>
|
||||||
|
returns a
|
||||||
|
<code>boost::reference_wrapper<X>(x)</code> where X
|
||||||
|
is the type of x. Similarly,
|
||||||
|
<code>boost::cref(x)</code> returns a
|
||||||
|
<code>boost::reference_wrapper<X const>(x)</code>.</para>
|
||||||
|
|
||||||
|
<para>The expression
|
||||||
|
<code>boost::is_reference_wrapper<T>::value</code>
|
||||||
|
is true if T is a <code>reference_wrapper</code>, and
|
||||||
|
false otherwise.</para>
|
||||||
|
|
||||||
|
<para>The type-expression
|
||||||
|
<code>boost::unwrap_reference<T>::type</code> is T::type if T
|
||||||
|
is a <code>reference_wrapper</code>, T otherwise.</para>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<library-reference>
|
||||||
|
<header name="boost/ref.hpp">
|
||||||
|
<namespace name="boost">
|
||||||
|
<class name="reference_wrapper">
|
||||||
|
<template>
|
||||||
|
<template-type-parameter name="T"/>
|
||||||
|
</template>
|
||||||
|
<purpose>
|
||||||
|
Contains a reference to an object of type
|
||||||
|
<computeroutput>T</computeroutput>.
|
||||||
|
</purpose>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
<para><computeroutput><classname>reference_wrapper</classname></computeroutput>
|
||||||
|
is primarily used to "feed" references to function templates
|
||||||
|
(algorithms) that take their parameter by value. It provides
|
||||||
|
an implicit conversion to
|
||||||
|
<computeroutput>T&</computeroutput>, which usually allows
|
||||||
|
the function templates to work on references
|
||||||
|
unmodified.</para>
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<typedef name="type"><type>T</type></typedef>
|
||||||
|
|
||||||
|
<constructor specifiers="explicit">
|
||||||
|
<parameter name="t">
|
||||||
|
<paramtype>T&</paramtype>
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
<effects><simpara>Constructs a
|
||||||
|
<computeroutput><classname>reference_wrapper</classname></computeroutput>
|
||||||
|
object that stores a reference to
|
||||||
|
<computeroutput>t</computeroutput>.</simpara></effects>
|
||||||
|
|
||||||
|
<throws><simpara>Does not throw.</simpara></throws>
|
||||||
|
</constructor>
|
||||||
|
|
||||||
|
<method-group name="access">
|
||||||
|
<method name="conversion-operator" cv="const">
|
||||||
|
<type>T&</type>
|
||||||
|
<returns><simpara>The stored reference.</simpara></returns>
|
||||||
|
<throws><simpara>Does not throw.</simpara></throws>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="get" cv="const">
|
||||||
|
<type>T&</type>
|
||||||
|
<returns><simpara>The stored reference.</simpara></returns>
|
||||||
|
<throws><simpara>Does not throw.</simpara></throws>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="get_pointer" cv="const">
|
||||||
|
<type>T*</type>
|
||||||
|
<returns><simpara>A pointer to the object referenced by the stored reference.</simpara></returns>
|
||||||
|
<throws><simpara>Does not throw.</simpara></throws>
|
||||||
|
</method>
|
||||||
|
</method-group>
|
||||||
|
|
||||||
|
<free-function-group name="constructors">
|
||||||
|
<function name="ref">
|
||||||
|
<type>reference_wrapper<T></type>
|
||||||
|
<parameter name="t">
|
||||||
|
<paramtype>T&</paramtype>
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
<returns><simpara><computeroutput><classname>reference_wrapper</classname><T>(t)</computeroutput></simpara></returns>
|
||||||
|
|
||||||
|
<throws><simpara>Does not throw.</simpara></throws>
|
||||||
|
</function>
|
||||||
|
|
||||||
|
<function name="cref">
|
||||||
|
<type>reference_wrapper<T const></type>
|
||||||
|
<parameter name="t">
|
||||||
|
<paramtype>T const&</paramtype>
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
<returns><simpara><computeroutput><classname>reference_wrapper</classname><T const>(t)</computeroutput></simpara></returns>
|
||||||
|
|
||||||
|
<throws><simpara>Does not throw.</simpara></throws>
|
||||||
|
</function>
|
||||||
|
</free-function-group>
|
||||||
|
</class>
|
||||||
|
|
||||||
|
<class name="is_reference_wrapper">
|
||||||
|
<template>
|
||||||
|
<template-type-parameter name="T"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<purpose>Determine if a type <computeroutput>T</computeroutput> is an instantiation of <computeroutput><classname>reference_wrapper</classname></computeroutput>.</purpose>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
<para>The <computeroutput>value</computeroutput> static
|
||||||
|
constant will be <computeroutput>true</computeroutput> iff the
|
||||||
|
type <computeroutput>T</computeroutput> is a specialization of
|
||||||
|
<computeroutput><classname>reference_wrapper</classname></computeroutput>.</para>
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<static-constant name="value">
|
||||||
|
<type>bool</type>
|
||||||
|
<default><emphasis>unspecified</emphasis></default>
|
||||||
|
</static-constant>
|
||||||
|
</class>
|
||||||
|
|
||||||
|
<class name="unwrap_reference">
|
||||||
|
<template>
|
||||||
|
<template-type-parameter name="T"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<purpose>Find the type in a <computeroutput><classname>reference_wrapper</classname></computeroutput>.</purpose>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
<para>The typedef <computeroutput>type</computeroutput> is
|
||||||
|
<computeroutput>T::type</computeroutput> if
|
||||||
|
<computeroutput>T</computeroutput> is a
|
||||||
|
<computeroutput><classname>reference_wrapper</classname></computeroutput>,
|
||||||
|
<computeroutput>T</computeroutput> otherwise.</para>
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<typedef name="type"><type><emphasis>unspecified</emphasis></type></typedef>
|
||||||
|
</class>
|
||||||
|
</namespace>
|
||||||
|
</header>
|
||||||
|
</library-reference>
|
||||||
|
|
||||||
|
<section id="ref.ack">
|
||||||
|
<title>Acknowledgements</title>
|
||||||
|
|
||||||
|
<using-namespace name="boost"/>
|
||||||
|
|
||||||
|
<para><functionname>ref</functionname> and <functionname>cref</functionname>
|
||||||
|
were originally part of the <libraryname>Tuple</libraryname> library
|
||||||
|
by Jaakko Järvi. They were "promoted to boost:: status" by
|
||||||
|
Peter Dimov because they are generally useful. Douglas Gregor and
|
||||||
|
Dave Abrahams contributed
|
||||||
|
<classname>is_reference_wrapper</classname> and
|
||||||
|
<classname>unwrap_reference</classname>.</para>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</library>
|
||||||
+871
-580
File diff suppressed because it is too large
Load Diff
@@ -4,12 +4,11 @@
|
|||||||
//
|
//
|
||||||
// apply.hpp
|
// apply.hpp
|
||||||
//
|
//
|
||||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
@@ -19,52 +18,52 @@ template<class R> struct apply
|
|||||||
{
|
{
|
||||||
typedef R result_type;
|
typedef R result_type;
|
||||||
|
|
||||||
template<class F> result_type operator()(F f) const
|
template<class F> result_type operator()(F & f) const
|
||||||
{
|
{
|
||||||
return f();
|
return f();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class F, class A1> result_type operator()(F f, A1 & a1) const
|
template<class F, class A1> result_type operator()(F & f, A1 & a1) const
|
||||||
{
|
{
|
||||||
return f(a1);
|
return f(a1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class F, class A1, class A2> result_type operator()(F f, A1 & a1, A2 & a2) const
|
template<class F, class A1, class A2> result_type operator()(F & f, A1 & a1, A2 & a2) const
|
||||||
{
|
{
|
||||||
return f(a1, a2);
|
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
|
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);
|
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
|
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);
|
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
|
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);
|
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
|
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);
|
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
|
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);
|
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
|
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);
|
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
|
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);
|
return f(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#ifndef BOOST_BIND_ARG_HPP_INCLUDED
|
#ifndef BOOST_BIND_ARG_HPP_INCLUDED
|
||||||
#define BOOST_BIND_ARG_HPP_INCLUDED
|
#define BOOST_BIND_ARG_HPP_INCLUDED
|
||||||
|
|
||||||
#if _MSC_VER >= 1020
|
// MS compatible compilers support #pragma once
|
||||||
#pragma once
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -10,21 +12,51 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
// See http://www.boost.org/libs/bind/bind.html for documentation.
|
// See http://www.boost.org/libs/bind/bind.html for documentation.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/is_placeholder.hpp>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
|
|
||||||
template<int I> class arg
|
template< int I > struct arg
|
||||||
{
|
{
|
||||||
|
arg()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template< class T > arg( T const & /* t */ )
|
||||||
|
{
|
||||||
|
// static assert I == is_placeholder<T>::value
|
||||||
|
typedef char T_must_be_placeholder[ I == is_placeholder<T>::value? 1: -1 ];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template< int I > 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
|
} // namespace boost
|
||||||
|
|
||||||
#endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED
|
#endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED
|
||||||
|
|||||||
@@ -5,10 +5,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
// See http://www.boost.org/libs/bind/bind.html for documentation.
|
// See http://www.boost.org/libs/bind/bind.html for documentation.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -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 R2, class R, class T,
|
||||||
|
class A1>
|
||||||
|
_bi::bind_t<R2, _mfi::BOOST_BIND_MF_NAME(mf0)<R, T>, typename _bi::list_av_1<A1>::type>
|
||||||
|
BOOST_BIND(boost::type<R2>, 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<R2, F, list_type>(F(f), list_type(a1));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class R2, class R, class T,
|
||||||
|
class A1>
|
||||||
|
_bi::bind_t<R2, _mfi::BOOST_BIND_MF_NAME(cmf0)<R, T>, typename _bi::list_av_1<A1>::type>
|
||||||
|
BOOST_BIND(boost::type<R2>, 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<R2, F, list_type>(F(f), list_type(a1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1
|
||||||
|
|
||||||
|
template<class R2, class R, class T,
|
||||||
|
class B1,
|
||||||
|
class A1, class A2>
|
||||||
|
_bi::bind_t<R2, _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type>
|
||||||
|
BOOST_BIND(boost::type<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class R2, class R, class T,
|
||||||
|
class B1,
|
||||||
|
class A1, class A2>
|
||||||
|
_bi::bind_t<R2, _mfi::BOOST_BIND_MF_NAME(cmf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type>
|
||||||
|
BOOST_BIND(boost::type<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2
|
||||||
|
|
||||||
|
template<class R2, class R, class T,
|
||||||
|
class B1, class B2,
|
||||||
|
class A1, class A2, class A3>
|
||||||
|
_bi::bind_t<R2, _mfi::BOOST_BIND_MF_NAME(mf2)<R, T, B1, B2>, typename _bi::list_av_3<A1, A2, A3>::type>
|
||||||
|
BOOST_BIND(boost::type<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class R2, class R, class T,
|
||||||
|
class B1, class B2,
|
||||||
|
class A1, class A2, class A3>
|
||||||
|
_bi::bind_t<R2, _mfi::BOOST_BIND_MF_NAME(cmf2)<R, T, B1, B2>, typename _bi::list_av_3<A1, A2, A3>::type>
|
||||||
|
BOOST_BIND(boost::type<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3
|
||||||
|
|
||||||
|
template<class R2, class R, class T,
|
||||||
|
class B1, class B2, class B3,
|
||||||
|
class A1, class A2, class A3, class A4>
|
||||||
|
_bi::bind_t<R2, _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<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3, a4));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class R2, class R, class T,
|
||||||
|
class B1, class B2, class B3,
|
||||||
|
class A1, class A2, class A3, class A4>
|
||||||
|
_bi::bind_t<R2, _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<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3, a4));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4
|
||||||
|
|
||||||
|
template<class R2, 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<R2, _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<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class R2, 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<R2, _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<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5
|
||||||
|
|
||||||
|
template<class R2, 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<R2, _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<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class R2, 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<R2, _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<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6
|
||||||
|
|
||||||
|
template<class R2, 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<R2, _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<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class R2, 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<R2, _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<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 7
|
||||||
|
|
||||||
|
template<class R2, 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<R2, _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<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class R2, 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<R2, _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<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 8
|
||||||
|
|
||||||
|
template<class R2, 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<R2, _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<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class R2, 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<R2, _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<R2>, 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<R2, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
|
||||||
|
}
|
||||||
@@ -5,10 +5,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
// See http://www.boost.org/libs/bind/bind.html for documentation.
|
// See http://www.boost.org/libs/bind/bind.html for documentation.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -3,12 +3,11 @@
|
|||||||
//
|
//
|
||||||
// Do not include this header directly.
|
// Do not include this header directly.
|
||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
// See http://www.boost.org/libs/bind/bind.html for documentation.
|
// See http://www.boost.org/libs/bind/bind.html for documentation.
|
||||||
//
|
//
|
||||||
@@ -18,139 +17,328 @@
|
|||||||
result_type operator()()
|
result_type operator()()
|
||||||
{
|
{
|
||||||
list0 a;
|
list0 a;
|
||||||
BOOST_BIND_EVALUATE;
|
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
result_type operator()() const
|
result_type operator()() const
|
||||||
{
|
{
|
||||||
list0 a;
|
list0 a;
|
||||||
BOOST_BIND_EVALUATE;
|
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class A1> result_type operator()(A1 & a1)
|
template<class A1> result_type operator()(A1 & a1)
|
||||||
{
|
{
|
||||||
list1<A1 &> a(a1);
|
list1<A1 &> a(a1);
|
||||||
BOOST_BIND_EVALUATE;
|
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class A1> result_type operator()(A1 & a1) const
|
template<class A1> result_type operator()(A1 & a1) const
|
||||||
{
|
{
|
||||||
list1<A1 &> a(a1);
|
list1<A1 &> a(a1);
|
||||||
BOOST_BIND_EVALUATE;
|
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)
|
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2)
|
||||||
{
|
{
|
||||||
list2<A1 &, A2 &> a(a1, a2);
|
list2<A1 &, A2 &> a(a1, a2);
|
||||||
BOOST_BIND_EVALUATE;
|
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) const
|
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) const
|
||||||
{
|
{
|
||||||
list2<A1 &, A2 &> a(a1, a2);
|
list2<A1 &, A2 &> a(a1, a2);
|
||||||
BOOST_BIND_EVALUATE;
|
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)
|
template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3)
|
||||||
{
|
{
|
||||||
list3<A1 &, A2 &, A3 &> a(a1, a2, a3);
|
list3<A1 &, A2 &, A3 &> a(a1, a2, a3);
|
||||||
BOOST_BIND_EVALUATE;
|
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
|
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);
|
list3<A1 &, A2 &, A3 &> a(a1, a2, a3);
|
||||||
BOOST_BIND_EVALUATE;
|
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)
|
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);
|
list4<A1 &, A2 &, A3 &, A4 &> a(a1, a2, a3, a4);
|
||||||
BOOST_BIND_EVALUATE;
|
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
|
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);
|
list4<A1 &, A2 &, A3 &, A4 &> a(a1, a2, a3, a4);
|
||||||
BOOST_BIND_EVALUATE;
|
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)
|
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);
|
list5<A1 &, A2 &, A3 &, A4 &, A5 &> a(a1, a2, a3, a4, a5);
|
||||||
BOOST_BIND_EVALUATE;
|
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
|
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);
|
list5<A1 &, A2 &, A3 &, A4 &, A5 &> a(a1, a2, a3, a4, a5);
|
||||||
BOOST_BIND_EVALUATE;
|
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)
|
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);
|
list6<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &> a(a1, a2, a3, a4, a5, a6);
|
||||||
BOOST_BIND_EVALUATE;
|
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
|
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);
|
list6<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &> a(a1, a2, a3, a4, a5, a6);
|
||||||
BOOST_BIND_EVALUATE;
|
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)
|
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);
|
list7<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &> a(a1, a2, a3, a4, a5, a6, a7);
|
||||||
BOOST_BIND_EVALUATE;
|
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
|
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);
|
list7<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &> a(a1, a2, a3, a4, a5, a6, a7);
|
||||||
BOOST_BIND_EVALUATE;
|
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)
|
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);
|
list8<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &> a(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
BOOST_BIND_EVALUATE;
|
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
|
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);
|
list8<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &> a(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||||
BOOST_BIND_EVALUATE;
|
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)
|
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);
|
list9<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &, A9 &> a(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||||
BOOST_BIND_EVALUATE;
|
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
|
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);
|
list9<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &, A9 &> a(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||||
BOOST_BIND_EVALUATE;
|
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)
|
template<class A> result_type eval(A & a)
|
||||||
{
|
{
|
||||||
BOOST_BIND_EVALUATE;
|
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class A> result_type eval(A & a) const
|
template<class A> result_type eval(A & a) const
|
||||||
{
|
{
|
||||||
BOOST_BIND_EVALUATE;
|
BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class V> void accept(V & v) const
|
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);
|
BOOST_BIND_VISIT_EACH(v, f_, 0);
|
||||||
l_.accept(v);
|
l_.accept(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool compare(this_type const & rhs) const
|
||||||
|
{
|
||||||
|
return ref_compare(f_, rhs.f_, 0) && l_ == rhs.l_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
F f_;
|
F f_;
|
||||||
|
|||||||
@@ -6,10 +6,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
@@ -18,10 +17,6 @@ namespace boost
|
|||||||
namespace _bi
|
namespace _bi
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class F> void instantiate(F)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class R, class F> class af0
|
template<class R, class F> class af0
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -37,6 +32,11 @@ public:
|
|||||||
return f_();
|
return f_();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result_type operator()() const
|
||||||
|
{
|
||||||
|
return f_();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
F f_;
|
F f_;
|
||||||
@@ -59,6 +59,11 @@ public:
|
|||||||
return f_(a1);
|
return f_(a1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result_type operator()(A1 a1) const
|
||||||
|
{
|
||||||
|
return f_(a1);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
F f_;
|
F f_;
|
||||||
@@ -83,6 +88,11 @@ public:
|
|||||||
return f_(a1, a2);
|
return f_(a1, a2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result_type operator()(A1 a1, A2 a2) const
|
||||||
|
{
|
||||||
|
return f_(a1, a2);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
F f_;
|
F f_;
|
||||||
@@ -106,6 +116,11 @@ public:
|
|||||||
return f_(a1, a2, a3);
|
return f_(a1, a2, a3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result_type operator()(A1 a1, A2 a2, A3 a3) const
|
||||||
|
{
|
||||||
|
return f_(a1, a2, a3);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
F f_;
|
F f_;
|
||||||
@@ -130,6 +145,11 @@ public:
|
|||||||
return f_(a1, a2, a3, 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:
|
private:
|
||||||
|
|
||||||
F f_;
|
F f_;
|
||||||
@@ -139,31 +159,26 @@ private:
|
|||||||
|
|
||||||
template<class R, class F> _bi::af0<R, F> make_adaptable(F f)
|
template<class R, class F> _bi::af0<R, F> make_adaptable(F f)
|
||||||
{
|
{
|
||||||
_bi::instantiate( &_bi::af0<R, F>::operator() ); // for early error detection
|
|
||||||
return _bi::af0<R, F>(f);
|
return _bi::af0<R, F>(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class R, class A1, class F> _bi::af1<R, A1, F> make_adaptable(F f)
|
template<class R, class A1, class F> _bi::af1<R, A1, F> make_adaptable(F f)
|
||||||
{
|
{
|
||||||
instantiate( &_bi::af1<R, A1, F>::operator() );
|
|
||||||
return _bi::af1<R, A1, 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)
|
template<class R, class A1, class A2, class F> _bi::af2<R, A1, A2, F> make_adaptable(F f)
|
||||||
{
|
{
|
||||||
instantiate( &_bi::af2<R, A1, A2, F>::operator() );
|
|
||||||
return _bi::af2<R, A1, A2, 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)
|
template<class R, class A1, class A2, class A3, class F> _bi::af3<R, A1, A2, A3, F> make_adaptable(F f)
|
||||||
{
|
{
|
||||||
instantiate( &_bi::af3<R, A1, A2, A3, F>::operator() );
|
|
||||||
return _bi::af3<R, A1, A2, A3, 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)
|
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)
|
||||||
{
|
{
|
||||||
instantiate( &_bi::af4<R, A1, A2, A3, A4, F>::operator() );
|
|
||||||
return _bi::af4<R, A1, A2, A3, A4, F>(f);
|
return _bi::af4<R, A1, A2, A3, A4, F>(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
|
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -5,14 +5,17 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
|
// 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
|
// mf0
|
||||||
|
|
||||||
template<class R, class T BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf0)
|
template<class R, class T BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf0)
|
||||||
@@ -51,10 +54,29 @@ public:
|
|||||||
BOOST_MEM_FN_RETURN call(u, &u);
|
BOOST_MEM_FN_RETURN call(u, &u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
|
||||||
|
|
||||||
|
template<class U> R operator()(U const & u) const
|
||||||
|
{
|
||||||
|
BOOST_MEM_FN_RETURN call(u, &u);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
R operator()(T & t) const
|
R operator()(T & t) const
|
||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)();
|
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
|
// cmf0
|
||||||
@@ -94,6 +116,16 @@ public:
|
|||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)();
|
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
|
// mf1
|
||||||
@@ -135,10 +167,29 @@ public:
|
|||||||
BOOST_MEM_FN_RETURN call(u, &u, a1);
|
BOOST_MEM_FN_RETURN call(u, &u, a1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
|
||||||
|
|
||||||
|
template<class U> R operator()(U const & u, A1 a1) const
|
||||||
|
{
|
||||||
|
BOOST_MEM_FN_RETURN call(u, &u, a1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
R operator()(T & t, A1 a1) const
|
R operator()(T & t, A1 a1) const
|
||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)(a1);
|
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
|
// cmf1
|
||||||
@@ -179,6 +230,16 @@ public:
|
|||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)(a1);
|
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
|
// mf2
|
||||||
@@ -218,10 +279,29 @@ public:
|
|||||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2);
|
BOOST_MEM_FN_RETURN call(u, &u, a1, a2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
|
||||||
|
|
||||||
|
template<class U> R operator()(U const & u, A1 a1, A2 a2) const
|
||||||
|
{
|
||||||
|
BOOST_MEM_FN_RETURN call(u, &u, a1, a2);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
R operator()(T & t, A1 a1, A2 a2) const
|
R operator()(T & t, A1 a1, A2 a2) const
|
||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2);
|
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
|
// cmf2
|
||||||
@@ -260,6 +340,16 @@ public:
|
|||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2);
|
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
|
// mf3
|
||||||
@@ -299,10 +389,29 @@ public:
|
|||||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3);
|
BOOST_MEM_FN_RETURN call(u, &u, 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
|
||||||
|
{
|
||||||
|
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
R operator()(T & t, A1 a1, A2 a2, A3 a3) const
|
R operator()(T & t, A1 a1, A2 a2, A3 a3) const
|
||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3);
|
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
|
// cmf3
|
||||||
@@ -341,6 +450,16 @@ public:
|
|||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3);
|
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
|
// mf4
|
||||||
@@ -380,10 +499,29 @@ public:
|
|||||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4);
|
BOOST_MEM_FN_RETURN call(u, &u, 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
|
||||||
|
{
|
||||||
|
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const
|
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const
|
||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4);
|
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
|
// cmf4
|
||||||
@@ -422,6 +560,16 @@ public:
|
|||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4);
|
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
|
// mf5
|
||||||
@@ -461,10 +609,29 @@ public:
|
|||||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5);
|
BOOST_MEM_FN_RETURN call(u, &u, 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
|
||||||
|
{
|
||||||
|
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
|
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);
|
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
|
// cmf5
|
||||||
@@ -503,6 +670,16 @@ public:
|
|||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5);
|
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
|
// mf6
|
||||||
@@ -542,10 +719,29 @@ public:
|
|||||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6);
|
BOOST_MEM_FN_RETURN call(u, &u, 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
|
||||||
|
{
|
||||||
|
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
|
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);
|
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
|
// cmf6
|
||||||
@@ -584,6 +780,16 @@ public:
|
|||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6);
|
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
|
// mf7
|
||||||
@@ -623,10 +829,29 @@ public:
|
|||||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7);
|
BOOST_MEM_FN_RETURN call(u, &u, 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
|
||||||
|
{
|
||||||
|
BOOST_MEM_FN_RETURN call(u, &u, 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
|
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);
|
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
|
// cmf7
|
||||||
@@ -665,6 +890,16 @@ public:
|
|||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7);
|
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
|
// mf8
|
||||||
@@ -704,10 +939,29 @@ public:
|
|||||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8);
|
BOOST_MEM_FN_RETURN call(u, &u, 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
|
||||||
|
{
|
||||||
|
BOOST_MEM_FN_RETURN call(u, &u, 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
|
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);
|
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
|
// cmf8
|
||||||
@@ -751,5 +1005,16 @@ public:
|
|||||||
{
|
{
|
||||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
|
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
|
||||||
|
|||||||
@@ -5,10 +5,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
|
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
|
#ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
|
||||||
#define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
|
#define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
|
||||||
|
|
||||||
#if _MSC_VER >= 1020
|
// MS compatible compilers support #pragma once
|
||||||
#pragma once
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -10,10 +12,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
// See http://www.boost.org/libs/bind/bind.html for documentation.
|
// See http://www.boost.org/libs/bind/bind.html for documentation.
|
||||||
//
|
//
|
||||||
@@ -24,7 +25,7 @@
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined(__BORLANDC__)
|
#if defined(__BORLANDC__) || defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ <= 400)
|
||||||
|
|
||||||
static inline boost::arg<1> _1() { return boost::arg<1>(); }
|
static inline boost::arg<1> _1() { return boost::arg<1>(); }
|
||||||
static inline boost::arg<2> _2() { return boost::arg<2>(); }
|
static inline boost::arg<2> _2() { return boost::arg<2>(); }
|
||||||
@@ -36,7 +37,7 @@ static inline boost::arg<7> _7() { return boost::arg<7>(); }
|
|||||||
static inline boost::arg<8> _8() { return boost::arg<8>(); }
|
static inline boost::arg<8> _8() { return boost::arg<8>(); }
|
||||||
static inline boost::arg<9> _9() { return boost::arg<9>(); }
|
static inline boost::arg<9> _9() { return boost::arg<9>(); }
|
||||||
|
|
||||||
#elif defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
#elif defined(BOOST_MSVC) || (defined(__DECCXX_VER) && __DECCXX_VER <= 60590031) || defined(__MWERKS__)
|
||||||
|
|
||||||
static boost::arg<1> _1;
|
static boost::arg<1> _1;
|
||||||
static boost::arg<2> _2;
|
static boost::arg<2> _2;
|
||||||
|
|||||||
@@ -6,10 +6,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
+86
-24
@@ -1,8 +1,10 @@
|
|||||||
#ifndef BOOST_MEM_FN_HPP_INCLUDED
|
#ifndef BOOST_MEM_FN_HPP_INCLUDED
|
||||||
#define BOOST_MEM_FN_HPP_INCLUDED
|
#define BOOST_MEM_FN_HPP_INCLUDED
|
||||||
|
|
||||||
#if _MSC_VER+0 >= 1020
|
// MS compatible compilers support #pragma once
|
||||||
#pragma once
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -10,29 +12,22 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||||
// Copyright (c) 2001 David Abrahams
|
// Copyright (c) 2001 David Abrahams
|
||||||
|
// Copyright (c) 2003-2005 Peter Dimov
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
|
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/get_pointer.hpp>
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
|
|
||||||
// get_pointer(p) extracts a ->* capable pointer from p
|
|
||||||
|
|
||||||
template<class T> T * get_pointer(T * p)
|
|
||||||
{
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get_pointer(shared_ptr<T> const & p) has been moved to shared_ptr.hpp
|
|
||||||
|
|
||||||
#if defined(BOOST_NO_VOID_RETURNS)
|
#if defined(BOOST_NO_VOID_RETURNS)
|
||||||
|
|
||||||
#define BOOST_MEM_FN_CLASS_F , class F
|
#define BOOST_MEM_FN_CLASS_F , class F
|
||||||
@@ -54,6 +49,18 @@ template<class V> struct mf
|
|||||||
#undef BOOST_MEM_FN_CC
|
#undef BOOST_MEM_FN_CC
|
||||||
#undef BOOST_MEM_FN_NAME
|
#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
|
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
||||||
|
|
||||||
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
|
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
|
||||||
@@ -95,6 +102,18 @@ template<> struct mf<void>
|
|||||||
#undef BOOST_MEM_FN_CC
|
#undef BOOST_MEM_FN_CC
|
||||||
#undef BOOST_MEM_FN_NAME
|
#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
|
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
||||||
|
|
||||||
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
|
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
|
||||||
@@ -136,6 +155,20 @@ template<> struct mf<void>
|
|||||||
#undef BOOST_MEM_FN_NAME2
|
#undef BOOST_MEM_FN_NAME2
|
||||||
#undef BOOST_MEM_FN_CC
|
#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
|
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
||||||
|
|
||||||
#define BOOST_MEM_FN_NAME(X) X##_stdcall
|
#define BOOST_MEM_FN_NAME(X) X##_stdcall
|
||||||
@@ -184,6 +217,18 @@ namespace _mfi
|
|||||||
#undef BOOST_MEM_FN_CC
|
#undef BOOST_MEM_FN_CC
|
||||||
#undef BOOST_MEM_FN_NAME
|
#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
|
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
||||||
|
|
||||||
#define BOOST_MEM_FN_NAME(X) X##_stdcall
|
#define BOOST_MEM_FN_NAME(X) X##_stdcall
|
||||||
@@ -225,6 +270,18 @@ namespace _mfi
|
|||||||
#undef BOOST_MEM_FN_NAME
|
#undef BOOST_MEM_FN_NAME
|
||||||
#undef BOOST_MEM_FN_CC
|
#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
|
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
||||||
|
|
||||||
#define BOOST_MEM_FN_NAME(X) X##_stdcall
|
#define BOOST_MEM_FN_NAME(X) X##_stdcall
|
||||||
@@ -271,11 +328,6 @@ private:
|
|||||||
return (u.*f_);
|
return (u.*f_);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class U> R & call(U & u, T *) const
|
|
||||||
{
|
|
||||||
return (u.*f_);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class U> R const & call(U & u, void const *) const
|
template<class U> R const & call(U & u, void const *) const
|
||||||
{
|
{
|
||||||
return (get_pointer(u)->*f_);
|
return (get_pointer(u)->*f_);
|
||||||
@@ -295,24 +347,34 @@ public:
|
|||||||
return (p->*f_);
|
return (p->*f_);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class U> R const & operator()(U & u) const
|
template<class U> R const & operator()(U const & u) const
|
||||||
{
|
{
|
||||||
return call(u, &u);
|
return call(u, &u);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1300)
|
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, < 0x3200)
|
||||||
|
|
||||||
R & operator()(T & t) const
|
R & operator()(T & t) const
|
||||||
{
|
{
|
||||||
return (t.*f_);
|
return (t.*f_);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
R const & operator()(T const & t) const
|
R const & operator()(T const & t) const
|
||||||
{
|
{
|
||||||
return (t.*f_);
|
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
|
} // namespace _mfi
|
||||||
|
|||||||
@@ -8,3 +8,9 @@ Automatic redirection failed, please go to
|
|||||||
<a href="mem_fn.html">mem_fn.html</a>.
|
<a href="mem_fn.html">mem_fn.html</a>.
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</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
|
||||||
|
-->
|
||||||
|
|||||||
+7
-2
@@ -4,6 +4,11 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
Automatic redirection failed, please go to
|
Automatic redirection failed, please go to
|
||||||
<a href="../bind/mem_fn.html">../bind/mem_fn.html</a>.
|
<a href="../bind/mem_fn.html">../bind/mem_fn.html</a>. <hr>
|
||||||
|
<p>© Copyright Beman Dawes, 2001</p>
|
||||||
|
<p>Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy
|
||||||
|
at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
|
||||||
|
<p> </p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,195 +1,15 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="refresh" content="0; URL=../../doc/html/ref.html">
|
||||||
<title>Boost: ref.hpp documentation</title>
|
</head>
|
||||||
</head>
|
<body>
|
||||||
<body bgcolor="White">
|
Automatic redirection failed, please go to
|
||||||
<table border="0" width="100%">
|
<a href="../../doc/html/ref.html">../../doc/html/ref.html</a>
|
||||||
<tr>
|
</body>
|
||||||
<td width="277">
|
|
||||||
<img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86">
|
|
||||||
</td>
|
|
||||||
<td align="center">
|
|
||||||
<table border="0">
|
|
||||||
<tr>
|
|
||||||
<td nowrap><h1>ref.hpp</h1>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align="right" nowrap><small> 1.00.0004 (2002-01-27)</small></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2" height="64"> </td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<h2>Files</h2>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="../../boost/ref.hpp">ref.hpp</a>
|
|
||||||
</ul>
|
|
||||||
<h2>Purpose</h2>
|
|
||||||
<p>
|
|
||||||
The header <a href="../../boost/ref.hpp">boost/ref.hpp</a> defines the class
|
|
||||||
template <b>boost::reference_wrapper<T></b>, the two functions <b>boost::ref</b>
|
|
||||||
and <b>boost::cref</b> that return instances of <b>boost::reference_wrapper<T></b>,
|
|
||||||
and the two traits classes <b>boost::is_reference_wrapper<T></b> and <b>boost::unwrap_reference<T></b>.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
The purpose of <b>boost::reference_wrapper<T></b> is to contain a
|
|
||||||
reference to an object of type <b>T</b>. It is primarily used to "feed"
|
|
||||||
references to function templates (algorithms) that take their parameter by
|
|
||||||
value.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
To support this usage, <b>boost::reference_wrapper<T></b> provides an
|
|
||||||
implicit conversion to <b>T &</b>. This usually allows the function
|
|
||||||
templates to work on references unmodified.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>boost::reference_wrapper<T></b> is both <b>CopyConstructible</b> and <b>Assignable</b>
|
|
||||||
(ordinary references are not <b>Assignable</b>).
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
The expression <b>boost::ref(x)</b> returns a <b>boost::reference_wrapper<X>(x)</b>
|
|
||||||
where <b>X</b> is the type of <b>x</b>. Similarly, <b>boost::cref(x)</b> returns
|
|
||||||
a <b>boost::reference_wrapper<X const>(x)</b>.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
The expression <b>boost::is_reference_wrapper<T>::value</b> is <b>true</b>
|
|
||||||
if <b>T</b> is a <b>reference_wrapper</b>, and <b>false</b>
|
|
||||||
otherwise.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
The type-expression <b>boost::unwrap_reference<T>::type</b> is <b>T::type</b>
|
|
||||||
if <b>T</b> is a <b>reference_wrapper</b>, <b>T</b> otherwise.
|
|
||||||
</p>
|
|
||||||
<h2>Interface</h2>
|
|
||||||
<h3>Synopsis</h3>
|
|
||||||
<pre>
|
|
||||||
namespace boost
|
|
||||||
{
|
|
||||||
template<class T> class <a href="#reference_wrapper">reference_wrapper</a>;
|
|
||||||
template<class T> reference_wrapper<T> <a href="#ref">ref</a>(T & t);
|
|
||||||
template<class T> reference_wrapper<T const> <a href="#cref">cref</a>(T const & t);
|
|
||||||
template<class T> class is_reference_wrapper<T const>;
|
|
||||||
template<class T> class unwrap_reference<T const>;
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
<h3><a name="reference_wrapper">reference_wrapper</a></h3>
|
|
||||||
<pre>
|
|
||||||
template<class T> class reference_wrapper
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef T type;
|
|
||||||
|
|
||||||
explicit <a href="#rt_construct">reference_wrapper</a>(T & t);
|
|
||||||
|
|
||||||
<a href="#rt_operator">operator T &</a> () const;
|
|
||||||
|
|
||||||
T & <a href="#rt_get">get</a>() const;
|
|
||||||
T* <a href="#rt_get_pointer">get_pointer</a>() const;
|
|
||||||
};
|
|
||||||
</pre>
|
|
||||||
<h4><a name="rt_construct">explicit reference_wrapper(T & t)</a></h4>
|
|
||||||
<blockquote>
|
|
||||||
<p>
|
|
||||||
<b>Effects:</b> Constructs a <b>reference_wrapper</b> object that stores a
|
|
||||||
reference to <b>t</b>.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>Throws:</b> Nothing.
|
|
||||||
</p>
|
|
||||||
</blockquote>
|
|
||||||
<h4><a name="rt_operator">operator T & () const</a></h4>
|
|
||||||
<blockquote>
|
|
||||||
<p>
|
|
||||||
<b>Returns:</b> the stored reference.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>Throws:</b> Nothing.
|
|
||||||
</p>
|
|
||||||
</blockquote>
|
|
||||||
<h4><a name="rt_get">T & get() const</a></h4>
|
|
||||||
<blockquote>
|
|
||||||
<p>
|
|
||||||
<b>Returns:</b> the stored reference.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>Throws:</b> Nothing.
|
|
||||||
</p>
|
|
||||||
</blockquote>
|
|
||||||
<h4><a name="rt_get_pointer">T* get_pointer() const</a></h4>
|
|
||||||
<blockquote>
|
|
||||||
<p>
|
|
||||||
<b>Returns:</b> a pointer to the stored object.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>Throws:</b> Nothing.
|
|
||||||
</p>
|
|
||||||
</blockquote>
|
|
||||||
<h3><a name="ref">ref</a></h3>
|
|
||||||
<pre>
|
|
||||||
template<class T> reference_wrapper<T> ref(T & t);
|
|
||||||
</pre>
|
|
||||||
<blockquote>
|
|
||||||
<p>
|
|
||||||
<b>Returns:</b> <tt>reference_wrapper<T>(t)</tt>.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>Throws:</b> Nothing.
|
|
||||||
</p>
|
|
||||||
</blockquote>
|
|
||||||
<h3><a name="cref">cref</a></h3>
|
|
||||||
<pre>
|
|
||||||
template<class T> reference_wrapper<T const> cref(T const & t);
|
|
||||||
</pre>
|
|
||||||
<blockquote>
|
|
||||||
<p>
|
|
||||||
<b>Returns:</b> <tt>reference_wrapper<T const>(t)</tt>.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<b>Throws:</b> Nothing.
|
|
||||||
</p>
|
|
||||||
</blockquote>
|
|
||||||
<h3><a name="is_reference_wrapper">is_reference_wrapper</a></h3>
|
|
||||||
<pre>
|
|
||||||
template<class T> class is_reference_wrapper<T const>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static bool value = <i>unspecified</i>;
|
|
||||||
};
|
|
||||||
</pre>
|
|
||||||
Value is <b>true</b> iff <tt>T</tt> is a specialization of <tt>reference_wrapper</tt>.
|
|
||||||
<h3><a name="unwrap_reference">unwrap_reference</a></h3>
|
|
||||||
<pre>
|
|
||||||
template<class T> class unwrap_reference<T const>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef <i>unspecified</i> type;
|
|
||||||
};
|
|
||||||
</pre>
|
|
||||||
<tt>type</tt> is equivalent to <tt>T::type</tt> if <tt>T</tt> is a
|
|
||||||
specialization of <tt>reference_wrapper</tt>. Otherwise <tt>type</tt> is
|
|
||||||
equivalent to <tt>T</tt>.
|
|
||||||
<h2>Acknowledgements</h2>
|
|
||||||
<p>
|
|
||||||
<b>ref</b> and <b>cref</b> were originally part of the Boost.Tuple library by <a href="../../people/jaakko_jarvi.htm">
|
|
||||||
Jaakko Järvi</a>. They were "promoted to <b>boost::</b> status" by <a href="../../people/peter_dimov.htm">
|
|
||||||
Peter Dimov</a> because they are generally useful. <a href="../../people/doug_gregor.html">
|
|
||||||
Douglas Gregor</a> and <a href="../../people/dave_abrahams.htm">Dave Abrahams</a>
|
|
||||||
contributed <tt>is_reference_wrapper</tt> and <tt>unwrap_reference</tt>.
|
|
||||||
</p>
|
|
||||||
<p><br>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<small>Copyright © 2001 by Peter Dimov and Multi Media Ltd. Permission to
|
|
||||||
copy, use, modify, sell and distribute this document is granted provided this
|
|
||||||
copyright notice appears in all copies. This document is provided "as
|
|
||||||
is" without express or implied warranty, and with no claim as to its
|
|
||||||
suitability for any purpose.</small></p>
|
|
||||||
</body>
|
|
||||||
</html>
|
</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
|
||||||
|
-->
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
# Boost.Bind Library test Jamfile
|
||||||
|
#
|
||||||
|
# Copyright (c) 2003-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)
|
||||||
|
|
||||||
|
# bring in rules for testing
|
||||||
|
import testing ;
|
||||||
|
|
||||||
|
test-suite "bind"
|
||||||
|
: [ 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 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 ]
|
||||||
|
;
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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_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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
#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
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#if defined(_MSC_VER) && !defined(__ICL)
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||||
#pragma warning(disable: 4710) // function not inlined
|
#pragma warning(disable: 4710) // function not inlined
|
||||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||||
@@ -10,10 +12,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#define BOOST_MEM_FN_ENABLE_FASTCALL
|
#define BOOST_MEM_FN_ENABLE_FASTCALL
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#if defined(_MSC_VER) && !defined(__ICL)
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||||
#pragma warning(disable: 4710) // function not inlined
|
#pragma warning(disable: 4710) // function not inlined
|
||||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||||
@@ -10,10 +12,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#define BOOST_BIND_ENABLE_FASTCALL
|
#define BOOST_BIND_ENABLE_FASTCALL
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
#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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#if defined(_MSC_VER) && !defined(__ICL)
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||||
#pragma warning(disable: 4710) // function not inlined
|
#pragma warning(disable: 4710) // function not inlined
|
||||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||||
@@ -10,10 +12,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#define BOOST_MEM_FN_ENABLE_STDCALL
|
#define BOOST_MEM_FN_ENABLE_STDCALL
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#if defined(_MSC_VER) && !defined(__ICL)
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||||
#pragma warning(disable: 4710) // function not inlined
|
#pragma warning(disable: 4710) // function not inlined
|
||||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||||
@@ -10,10 +12,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#define BOOST_BIND_ENABLE_STDCALL
|
#define BOOST_BIND_ENABLE_STDCALL
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#if defined(_MSC_VER) && !defined(__ICL) && !defined(__COMO__)
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||||
#pragma warning(disable: 4710) // function not inlined
|
#pragma warning(disable: 4710) // function not inlined
|
||||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||||
@@ -11,10 +13,9 @@
|
|||||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||||
// Copyright (c) 2001 David Abrahams
|
// Copyright (c) 2001 David Abrahams
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
@@ -188,14 +189,33 @@ void function_object_test()
|
|||||||
BOOST_TEST( bind<int>(Y(), i, _1)(k) == 38 );
|
BOOST_TEST( bind<int>(Y(), i, _1)(k) == 38 );
|
||||||
BOOST_TEST( bind<long>(Y(), i, _1, 9)(k) == 938 );
|
BOOST_TEST( bind<long>(Y(), i, _1, 9)(k) == 938 );
|
||||||
|
|
||||||
#if !defined(__MWERKS__) || (__MWERKS__ > 0x2406) // Fails for this version of the compiler.
|
#if !defined(__MWERKS__) || (__MWERKS__ > 0x2407) // Fails for this version of the compiler.
|
||||||
|
|
||||||
|
global_result = 0;
|
||||||
bind<void>(Y(), i, _1, 9, 4)(k);
|
bind<void>(Y(), i, _1, 9, 4)(k);
|
||||||
BOOST_TEST( global_result == 4938 );
|
BOOST_TEST( global_result == 4938 );
|
||||||
|
|
||||||
#endif
|
#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)
|
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||||
@@ -370,7 +390,7 @@ void member_function_test()
|
|||||||
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)();
|
bind(&X::g8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||||
|
|
||||||
BOOST_TEST( bind(&X::hash, _1)(x) == 23558 );
|
BOOST_TEST( x.hash == 23558 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void member_function_void_test()
|
void member_function_void_test()
|
||||||
@@ -460,7 +480,7 @@ void member_function_void_test()
|
|||||||
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)();
|
bind(&V::g8, ref(v), 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||||
|
|
||||||
BOOST_TEST( bind(&V::hash, _1)(v) == 23558 );
|
BOOST_TEST( v.hash == 23558 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void nested_bind_test()
|
void nested_bind_test()
|
||||||
@@ -487,6 +507,7 @@ int main()
|
|||||||
{
|
{
|
||||||
function_test();
|
function_test();
|
||||||
function_object_test();
|
function_object_test();
|
||||||
|
function_object_test2();
|
||||||
|
|
||||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||||
adaptable_function_object_test();
|
adaptable_function_object_test();
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
#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_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);
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#if defined(_MSC_VER) && !defined(__ICL)
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||||
#pragma warning(disable: 4710) // function not inlined
|
#pragma warning(disable: 4710) // function not inlined
|
||||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||||
@@ -10,10 +12,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/mem_fn.hpp>
|
#include <boost/mem_fn.hpp>
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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 0; }
|
||||||
|
|
||||||
|
int cmf0_1() const { return 0; }
|
||||||
|
int cmf0_2() const { return 0; }
|
||||||
|
|
||||||
|
void mf0v_1() {}
|
||||||
|
void mf0v_2() {}
|
||||||
|
|
||||||
|
void cmf0v_1() const {}
|
||||||
|
void cmf0v_2() const {}
|
||||||
|
|
||||||
|
// 1
|
||||||
|
|
||||||
|
int mf1_1(int) { return 0; }
|
||||||
|
int mf1_2(int) { return 0; }
|
||||||
|
|
||||||
|
int cmf1_1(int) const { return 0; }
|
||||||
|
int cmf1_2(int) const { return 0; }
|
||||||
|
|
||||||
|
void mf1v_1(int) {}
|
||||||
|
void mf1v_2(int) {}
|
||||||
|
|
||||||
|
void cmf1v_1(int) const {}
|
||||||
|
void cmf1v_2(int) const {}
|
||||||
|
|
||||||
|
// 2
|
||||||
|
|
||||||
|
int mf2_1(int, int) { return 0; }
|
||||||
|
int mf2_2(int, int) { return 0; }
|
||||||
|
|
||||||
|
int cmf2_1(int, int) const { return 0; }
|
||||||
|
int cmf2_2(int, int) const { return 0; }
|
||||||
|
|
||||||
|
void mf2v_1(int, int) {}
|
||||||
|
void mf2v_2(int, int) {}
|
||||||
|
|
||||||
|
void cmf2v_1(int, int) const {}
|
||||||
|
void cmf2v_2(int, int) const {}
|
||||||
|
|
||||||
|
// 3
|
||||||
|
|
||||||
|
int mf3_1(int, int, int) { return 0; }
|
||||||
|
int mf3_2(int, int, int) { return 0; }
|
||||||
|
|
||||||
|
int cmf3_1(int, int, int) const { return 0; }
|
||||||
|
int cmf3_2(int, int, int) const { return 0; }
|
||||||
|
|
||||||
|
void mf3v_1(int, int, int) {}
|
||||||
|
void mf3v_2(int, int, int) {}
|
||||||
|
|
||||||
|
void cmf3v_1(int, int, int) const {}
|
||||||
|
void cmf3v_2(int, int, int) const {}
|
||||||
|
|
||||||
|
// 4
|
||||||
|
|
||||||
|
int mf4_1(int, int, int, int) { return 0; }
|
||||||
|
int mf4_2(int, int, int, int) { return 0; }
|
||||||
|
|
||||||
|
int cmf4_1(int, int, int, int) const { return 0; }
|
||||||
|
int cmf4_2(int, int, int, int) const { return 0; }
|
||||||
|
|
||||||
|
void mf4v_1(int, int, int, int) {}
|
||||||
|
void mf4v_2(int, int, int, int) {}
|
||||||
|
|
||||||
|
void cmf4v_1(int, int, int, int) const {}
|
||||||
|
void cmf4v_2(int, int, int, int) const {}
|
||||||
|
|
||||||
|
// 5
|
||||||
|
|
||||||
|
int mf5_1(int, int, int, int, int) { return 0; }
|
||||||
|
int mf5_2(int, int, int, int, int) { return 0; }
|
||||||
|
|
||||||
|
int cmf5_1(int, int, int, int, int) const { return 0; }
|
||||||
|
int cmf5_2(int, int, int, int, int) const { return 0; }
|
||||||
|
|
||||||
|
void mf5v_1(int, int, int, int, int) {}
|
||||||
|
void mf5v_2(int, int, int, int, int) {}
|
||||||
|
|
||||||
|
void cmf5v_1(int, int, int, int, int) const {}
|
||||||
|
void cmf5v_2(int, int, int, int, int) const {}
|
||||||
|
|
||||||
|
// 6
|
||||||
|
|
||||||
|
int mf6_1(int, int, int, int, int, int) { return 0; }
|
||||||
|
int mf6_2(int, int, int, int, int, int) { return 0; }
|
||||||
|
|
||||||
|
int cmf6_1(int, int, int, int, int, int) const { return 0; }
|
||||||
|
int cmf6_2(int, int, int, int, int, int) const { return 0; }
|
||||||
|
|
||||||
|
void mf6v_1(int, int, int, int, int, int) {}
|
||||||
|
void mf6v_2(int, int, int, int, int, int) {}
|
||||||
|
|
||||||
|
void cmf6v_1(int, int, int, int, int, int) const {}
|
||||||
|
void cmf6v_2(int, int, int, int, int, int) const {}
|
||||||
|
|
||||||
|
// 7
|
||||||
|
|
||||||
|
int mf7_1(int, int, int, int, int, int, int) { return 0; }
|
||||||
|
int mf7_2(int, int, int, int, int, int, int) { return 0; }
|
||||||
|
|
||||||
|
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 0; }
|
||||||
|
|
||||||
|
void mf7v_1(int, int, int, int, int, int, int) {}
|
||||||
|
void mf7v_2(int, int, int, int, int, int, int) {}
|
||||||
|
|
||||||
|
void cmf7v_1(int, int, int, int, int, int, int) const {}
|
||||||
|
void cmf7v_2(int, int, int, int, int, int, int) const {}
|
||||||
|
|
||||||
|
// 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 0; }
|
||||||
|
|
||||||
|
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 0; }
|
||||||
|
|
||||||
|
void mf8v_1(int, int, int, int, int, int, int, int) {}
|
||||||
|
void mf8v_2(int, int, int, int, int, int, int, int) {}
|
||||||
|
|
||||||
|
void cmf8v_1(int, int, int, int, int, int, int, int) const {}
|
||||||
|
void cmf8v_2(int, int, int, int, int, int, int, int) const {}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#if defined(_MSC_VER) && !defined(__ICL)
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||||
#pragma warning(disable: 4710) // function not inlined
|
#pragma warning(disable: 4710) // function not inlined
|
||||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||||
@@ -10,10 +12,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#define BOOST_MEM_FN_ENABLE_FASTCALL
|
#define BOOST_MEM_FN_ENABLE_FASTCALL
|
||||||
@@ -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 );
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#if defined(_MSC_VER) && !defined(__ICL)
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||||
#pragma warning(disable: 4710) // function not inlined
|
#pragma warning(disable: 4710) // function not inlined
|
||||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||||
@@ -10,10 +12,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#define BOOST_MEM_FN_ENABLE_STDCALL
|
#define BOOST_MEM_FN_ENABLE_STDCALL
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#if defined(_MSC_VER) && !defined(__ICL)
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||||
#pragma warning(disable: 4710) // function not inlined
|
#pragma warning(disable: 4710) // function not inlined
|
||||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||||
@@ -10,10 +12,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/mem_fn.hpp>
|
#include <boost/mem_fn.hpp>
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#if defined(_MSC_VER) && !defined(__ICL)
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||||
#pragma warning(disable: 4710) // function not inlined
|
#pragma warning(disable: 4710) // function not inlined
|
||||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||||
@@ -10,10 +12,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||||
//
|
//
|
||||||
// Permission to copy, use, modify, sell and distribute this software
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// is granted provided this copyright notice appears in all copies.
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// This software is provided "as is" without express or implied
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/mem_fn.hpp>
|
#include <boost/mem_fn.hpp>
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user