1
0
forked from boostorg/bind

Return type can now be omitted on adaptable function objects

[SVN r11401]
This commit is contained in:
Peter Dimov
2001-10-18 15:05:57 +00:00
parent b9bb33048f
commit c61d480cb6
3 changed files with 230 additions and 54 deletions

View File

@@ -17,7 +17,7 @@
<td align="center"> <td align="center">
<table border="0"> <table border="0">
<tr><td nowrap><h1>bind.hpp</h1></td></tr> <tr><td nowrap><h1>bind.hpp</h1></td></tr>
<tr><td align="right" nowrap><small>&nbsp;1.01.0001 (2001-09-02)</small></td></tr> <tr><td align="right" nowrap><small>&nbsp;1.02.0001 (2001-10-18)</small></td></tr>
</table> </table>
</td> </td>
</tr> </tr>
@@ -108,6 +108,14 @@ bind(g, _3, _3, _3)(x, y, z); // g(z, z, z)
bind(g, _1, _1, _1)(x, y, z); // g(x, x, x) bind(g, _1, _1, _1)(x, y, z); // g(x, x, x)
</pre> </pre>
<p>
Note that, in the last example, the function object produced by
<tt>bind(g, _1, _1, _1)</tt> does not contain references to any arguments
beyond the first, but it can still be used with more than one argument.
Any extra arguments are silently ignored, just like the first and the second
argument are ignored in the third example.
</p>
<p> <p>
The arguments that <b>bind</b> takes are copied and held internally by The arguments that <b>bind</b> takes are copied and held internally by
the returned function object. For example, in the following code: the returned function object. For example, in the following code:
@@ -135,10 +143,10 @@ bind(f, ref(i), _1);
<h3>Using bind with function objects</h3> <h3>Using bind with function objects</h3>
<p> <p>
Any function object can be passed as a first argument to <b>bind</b>, but the <b>bind</b> is not limited to functions; it accepts arbitrary function objects.
syntax is a bit different. The return type of the generated function object's In the general case, the return type of the generated function object's
<b>operator()</b> has to be specified explicitly (without a <b>typeof</b> <b>operator()</b> has to be specified explicitly (without a <b>typeof</b>
operator the return type cannot be inferred in the general case): operator the return type cannot be inferred):
</p> </p>
<pre> <pre>
@@ -156,11 +164,18 @@ bind&lt;int&gt;(f, _1, _1)(x); // f(x, x), i.e. zero
</pre> </pre>
<p> <p>
[Note: when, hopefully, When the function object exposes a nested type named <b>result_type</b>,
<a href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#226"> the explicit return type can be omitted:
function template default arguments</a> become part of C++, </p>
<b>bind</b> will no longer require the explicit specification of the return type
when the function object defines <b>result_type</b>.] <pre>
int x = 8;
bind(std::less&lt;int&gt;, _1, 9)(x); // x < 9
</pre>
<p>
[Note: the ability to omit the return type is not available on all compilers.]
</p> </p>
<h3>Using bind with member function pointers</h3> <h3>Using bind with member function pointers</h3>
@@ -392,12 +407,16 @@ namespace boost
template&lt;class R, class F&gt; <i>implementation-defined-1</i> <a href="#bind_1">bind</a>(F f); template&lt;class R, class F&gt; <i>implementation-defined-1</i> <a href="#bind_1">bind</a>(F f);
template&lt;class F&gt; <i>implementation-defined-1-1</i> <a href="#bind_1_1">bind</a>(F f);
template&lt;class R&gt; <i>implementation-defined-2</i> <a href="#bind_2">bind</a>(R (*f) ()); template&lt;class R&gt; <i>implementation-defined-2</i> <a href="#bind_2">bind</a>(R (*f) ());
// one argument // one argument
template&lt;class R, class F, class A1&gt; <i>implementation-defined-3</i> <a href="#bind_3">bind</a>(F f, A1 a1); template&lt;class R, class F, class A1&gt; <i>implementation-defined-3</i> <a href="#bind_3">bind</a>(F f, A1 a1);
template&lt;class F, class A1&gt; <i>implementation-defined-3-1</i> <a href="#bind_3_1">bind</a>(F f, A1 a1);
template&lt;class R, class B1, class A1&gt; <i>implementation-defined-4</i> <a href="#bind_4">bind</a>(R (*f) (B1), A1 a1); template&lt;class R, class B1, class A1&gt; <i>implementation-defined-4</i> <a href="#bind_4">bind</a>(R (*f) (B1), A1 a1);
template&lt;class R, class T, class A1&gt; <i>implementation-defined-5</i> <a href="#bind_5">bind</a>(R (T::*f) (), A1 a1); template&lt;class R, class T, class A1&gt; <i>implementation-defined-5</i> <a href="#bind_5">bind</a>(R (T::*f) (), A1 a1);
@@ -408,6 +427,8 @@ template&lt;class R, class T, class A1&gt; <i>implementation-defined-6</i> <a hr
template&lt;class R, class F, class A1, class A2&gt; <i>implementation-defined-7</i> <a href="#bind_7">bind</a>(F f, A1 a1, A2 a2); template&lt;class R, class F, class A1, class A2&gt; <i>implementation-defined-7</i> <a href="#bind_7">bind</a>(F f, A1 a1, A2 a2);
template&lt;class F, class A1, class A2&gt; <i>implementation-defined-7-1</i> <a href="#bind_7_1">bind</a>(F f, A1 a1, A2 a2);
template&lt;class R, class B1, class B2, class A1, class A2&gt; <i>implementation-defined-8</i> <a href="#bind_8">bind</a>(R (*f) (B1, B2), A1 a1, A2 a2); template&lt;class R, class B1, class B2, class A1, class A2&gt; <i>implementation-defined-8</i> <a href="#bind_8">bind</a>(R (*f) (B1, B2), A1 a1, A2 a2);
template&lt;class R, class T, class B1, class A1, class A2&gt; <i>implementation-defined-9</i> <a href="#bind_9">bind</a>(R (T::*f) (B1), A1 a1, A2 a2); template&lt;class R, class T, class B1, class A1, class A2&gt; <i>implementation-defined-9</i> <a href="#bind_9">bind</a>(R (T::*f) (B1), A1 a1, A2 a2);
@@ -474,6 +495,12 @@ implicitly converted to <b>R</b>.
<b>Throws:</b> Nothing unless the copy constructor of <b>F</b> throws an exception. <b>Throws:</b> Nothing unless the copy constructor of <b>F</b> throws an exception.
</p> </p>
<h4><a name="bind_1_1">template&lt;class F&gt; <i>implementation-defined-1-1</i> bind(F f)</a></h4>
<p>
<b>Effects:</b> equivalent to <tt>bind&lt;typename F::result_type, F&gt;(f);</tt>
</p>
<h4><a name="bind_2">template&lt;class R&gt; <i>implementation-defined-2</i> bind(R (*f) ())</a></h4> <h4><a name="bind_2">template&lt;class R&gt; <i>implementation-defined-2</i> bind(R (*f) ())</a></h4>
<p> <p>
@@ -496,6 +523,12 @@ implicitly converted to <b>R</b>.
<b>Throws:</b> Nothing unless the copy constructors of <b>F</b> and <b>A1</b> throw an exception. <b>Throws:</b> Nothing unless the copy constructors of <b>F</b> and <b>A1</b> throw an exception.
</p> </p>
<h4><a name="bind_3_1">template&lt;class F, class A1&gt; <i>implementation-defined-3-1</i> bind(F f, A1 a1)</a></h4>
<p>
<b>Effects:</b> equivalent to <tt>bind&lt;typename F::result_type, F, A1&gt;(f, a1);</tt>
</p>
<h4><a name="bind_4">template&lt;class R, class B1, class A1&gt; <i>implementation-defined-4</i> bind(R (*f) (B1), A1 a1)</a></h4> <h4><a name="bind_4">template&lt;class R, class B1, class A1&gt; <i>implementation-defined-4</i> bind(R (*f) (B1), A1 a1)</a></h4>
<p> <p>
@@ -531,6 +564,12 @@ implicitly converted to <b>R</b>.
<b>Throws:</b> Nothing unless the copy constructors of <b>F</b>, <b>A1</b> and <b>A2</b> throw an exception. <b>Throws:</b> Nothing unless the copy constructors of <b>F</b>, <b>A1</b> and <b>A2</b> throw an exception.
</p> </p>
<h4><a name="bind_7_1">template&lt;class F, class A1, class A2&gt; <i>implementation-defined-7-1</i> bind(F f, A1 a1, A2 a2)</a></h4>
<p>
<b>Effects:</b> equivalent to <tt>bind&lt;typename F::result_type, F, A1, A2&gt;(f, a1, a2);</tt>
</p>
<h4><a name="bind_8">template&lt;class R, class B1, class B2, class A1, class A2&gt; <i>implementation-defined-8</i> bind(R (*f) (B1, B2), A1 a1, A2 a2)</a></h4> <h4><a name="bind_8">template&lt;class R, class B1, class B2, class A1, class A2&gt; <i>implementation-defined-8</i> bind(R (*f) (B1, B2), A1 a1, A2 a2)</a></h4>
<p> <p>
@@ -693,6 +732,11 @@ was Darin Adler.
The precise semantics of <b>bind</b> were refined in discussions with Jaakko J&auml;rvi. The precise semantics of <b>bind</b> were refined in discussions with Jaakko J&auml;rvi.
</p> </p>
<p>
Dave Abrahams fixed a MSVC-specific conflict between <b>bind</b> and the
<a href="../utility\iterator_adaptors.htm">iterator adaptors library</a>.
</p>
<p><br><br><br><small>Copyright &copy; 2001 by Peter Dimov and Multi Media <p><br><br><br><small>Copyright &copy; 2001 by Peter Dimov and Multi Media
Ltd. Permission to copy, use, modify, sell and distribute this document is Ltd. Permission to copy, use, modify, sell and distribute this document is
granted provided this copyright notice appears in all copies. This document granted provided this copyright notice appears in all copies. This document

View File

@@ -120,6 +120,23 @@ void function_object_test()
// //
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
struct Z
{
typedef int result_type;
int operator()(int a, int b) const { return a + 10 * b; }
};
void adaptable_function_object_test()
{
BOOST_TEST( boost::bind(Z(), 7, 4)() == 47 );
}
#endif
//
struct X struct X
{ {
mutable unsigned int hash; mutable unsigned int hash;
@@ -262,6 +279,9 @@ int test_main(int, char * [])
{ {
function_test(); function_test();
function_object_test(); function_object_test();
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
adaptable_function_object_test();
#endif
member_function_test(); member_function_test();
nested_bind_test(); nested_bind_test();

View File

@@ -8,7 +8,7 @@
// //
// bind.hpp - binds function objects to arguments // bind.hpp - binds function objects to arguments
// //
// Version 1.01.0001 (2001-08-29) // Version 1.02.0001 (2001-10-18)
// //
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. // Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
// //
@@ -512,144 +512,170 @@ private:
list9 & operator= (list9 const &); list9 & operator= (list9 const &);
}; };
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
// unspecified
struct unspecified {};
template<class R, class F> struct result_traits
{
typedef R type;
};
template<class F> struct result_traits<unspecified, F>
{
typedef typename F::result_type type;
};
#endif
// bind_t // bind_t
template<class R, class F, class L> class bind_t template<class R, class F, class L> class bind_t
{ {
public: public:
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
typedef typename result_traits<R, F>::type result_type;
#else
typedef R result_type; typedef R result_type;
#endif
bind_t(F f, L const & l): f_(f), l_(l) {} bind_t(F f, L const & l): f_(f), l_(l) {}
R operator()() result_type operator()()
{ {
list0 a; list0 a;
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
R operator()() const result_type operator()() const
{ {
list0 a; list0 a;
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1> R operator()(A1 & a1) template<class A1> result_type operator()(A1 & a1)
{ {
list1<A1 &> a(a1); list1<A1 &> a(a1);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1> R operator()(A1 & a1) const template<class A1> result_type operator()(A1 & a1) const
{ {
list1<A1 &> a(a1); list1<A1 &> a(a1);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3, class A4> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3, class A4> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3, class A4, class A5> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3, class A4, class A5> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3, class A4, class A5, class A6> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3, class A4, class A5, class A6> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> R 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);
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A> R eval(A & a) template<class A> result_type eval(A & a)
{ {
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class A> R eval(A & a) const template<class A> result_type eval(A & a) const
{ {
return l_(type<R>(), f_, a); return l_(type<result_type>(), f_, a);
} }
template<class V> void accept(V & v) const template<class V> void accept(V & v) const
@@ -915,6 +941,92 @@ template<class R, class F, class A1, class A2, class A3, class A4, class A5, cla
return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
} }
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
// adaptable function objects
template<class F>
_bi::bind_t<_bi::unspecified, F, _bi::list0>
BOOST_BIND(F f)
{
typedef _bi::list0 list_type;
return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type());
}
template<class F, class A1>
_bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1<A1>::type>
BOOST_BIND(F f, A1 a1)
{
typedef typename _bi::list_av_1<A1>::type list_type;
return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1));
}
template<class F, class A1, class A2>
_bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2<A1, A2>::type>
BOOST_BIND(F f, A1 a1, A2 a2)
{
typedef typename _bi::list_av_2<A1, A2>::type list_type;
return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2));
}
template<class F, class A1, class A2, class A3>
_bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3<A1, A2, A3>::type>
BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
{
typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3));
}
template<class F, class A1, class A2, class A3, class A4>
_bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
{
typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4));
}
template<class F, class A1, class A2, class A3, class A4, class A5>
_bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
{
typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
}
template<class F, class A1, class A2, class A3, class A4, class A5, class A6>
_bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
{
typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
}
template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
_bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
{
typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
}
template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
_bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
{
typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
}
template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
_bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
{
typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
}
#endif
// function pointers // function pointers
template<class R> template<class R>