mirror of
https://github.com/boostorg/bind.git
synced 2026-04-16 14:45:49 +02:00
Compare commits
1 Commits
boost-1.56
...
boost-1.50
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7724c67ac4 |
@@ -272,7 +272,7 @@ bind(&X::f, p, _1)(i); // (<i>internal copy of p</i>)->f(i)
|
||||
</p>
|
||||
<P>This feature of <b>bind</b> can be used to perform function composition. See <A href="bind_as_compose.cpp">
|
||||
bind_as_compose.cpp</A> for an example that demonstrates how to use <b>bind</b>
|
||||
to achieve similar functionality to <A href="http://www.boost.org/doc/libs/1_31_0/libs/compose/index.htm">Boost.Compose</A>.
|
||||
to achieve similar functionality to <A href="../compose/index.htm">Boost.Compose</A>.
|
||||
</P>
|
||||
<p>Note that the first argument - the bound function object - is not evaluated,
|
||||
even when it's a function object that is produced by <STRONG>bind</STRONG> or a
|
||||
@@ -390,7 +390,7 @@ void connect()
|
||||
<p>As a general rule, the function objects generated by <b>bind</b> take their
|
||||
arguments by reference and cannot, therefore, accept non-const temporaries or
|
||||
literal constants. This is an inherent limitation of the C++ language in its
|
||||
current (2003) incarnation, known as <A href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm">
|
||||
current (2003) incarnation, known as <A href="http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm">
|
||||
the forwarding problem</A>. (It will be fixed in the next standard, usually
|
||||
called C++0x.)</p>
|
||||
<p>The library uses signatures of the form
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/is_placeholder.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -34,7 +33,8 @@ template< int I > struct arg
|
||||
|
||||
template< class T > arg( T const & /* t */ )
|
||||
{
|
||||
BOOST_STATIC_ASSERT( I == is_placeholder<T>::value );
|
||||
// static assert I == is_placeholder<T>::value
|
||||
typedef char T_must_be_placeholder[ I == is_placeholder<T>::value? 1: -1 ];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost: mem_fn.hpp documentation</title>
|
||||
@@ -145,7 +146,7 @@ void k(std::vector<boost::shared_ptr<X> > const & v)
|
||||
<p>
|
||||
Yes. For simple uses, <b>mem_fn</b> provides additional functionality that the
|
||||
standard adaptors do not. Complicated expressions that use <b>std::bind1st</b>, <b>std::bind2nd</b>
|
||||
or <a href="http://www.boost.org/doc/libs/1_31_0/libs/compose/index.htm"><b>Boost.Compose</b></a> along with the
|
||||
or <a href="../compose/index.htm"><b>Boost.Compose</b></a> along with the
|
||||
standard adaptors can be rewritten using <a href="bind.html"><b>boost::bind</b></a>
|
||||
that automatically takes advantage of <b>mem_fn</b>.
|
||||
</p>
|
||||
|
||||
@@ -33,12 +33,6 @@
|
||||
|
||||
struct X
|
||||
{
|
||||
// SGI-related compilers have odd compiler-synthesized ctors dtors
|
||||
#ifdef __PATHSCALE__
|
||||
X() {}
|
||||
~X() {}
|
||||
#endif
|
||||
|
||||
int operator()()
|
||||
{
|
||||
return 17041;
|
||||
|
||||
@@ -43,11 +43,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
// SGI-related compilers have odd compiler-synthesized ctors and dtors
|
||||
#ifdef __PATHSCALE__
|
||||
~X() {}
|
||||
#endif
|
||||
|
||||
int state() const
|
||||
{
|
||||
return state_;
|
||||
|
||||
@@ -39,128 +39,128 @@ struct X
|
||||
// 0
|
||||
|
||||
int mf0_1() { return 0; }
|
||||
int mf0_2() { return 1; }
|
||||
int mf0_2() { return 0; }
|
||||
|
||||
int cmf0_1() const { return 0; }
|
||||
int cmf0_2() const { return 1; }
|
||||
int cmf0_2() const { return 0; }
|
||||
|
||||
void mf0v_1() {}
|
||||
void mf0v_2() { static int x; ++x; }
|
||||
void mf0v_2() {}
|
||||
|
||||
void cmf0v_1() const {}
|
||||
void cmf0v_2() const { static int x; ++x; }
|
||||
void cmf0v_2() const {}
|
||||
|
||||
// 1
|
||||
|
||||
int mf1_1(int) { return 0; }
|
||||
int mf1_2(int) { return 1; }
|
||||
int mf1_2(int) { return 0; }
|
||||
|
||||
int cmf1_1(int) const { return 0; }
|
||||
int cmf1_2(int) const { return 1; }
|
||||
int cmf1_2(int) const { return 0; }
|
||||
|
||||
void mf1v_1(int) {}
|
||||
void mf1v_2(int) { static int x; ++x; }
|
||||
void mf1v_2(int) {}
|
||||
|
||||
void cmf1v_1(int) const {}
|
||||
void cmf1v_2(int) const { static int x; ++x; }
|
||||
void cmf1v_2(int) const {}
|
||||
|
||||
// 2
|
||||
|
||||
int mf2_1(int, int) { return 0; }
|
||||
int mf2_2(int, int) { return 1; }
|
||||
int mf2_2(int, int) { return 0; }
|
||||
|
||||
int cmf2_1(int, int) const { return 0; }
|
||||
int cmf2_2(int, int) const { return 1; }
|
||||
int cmf2_2(int, int) const { return 0; }
|
||||
|
||||
void mf2v_1(int, int) {}
|
||||
void mf2v_2(int, int) { static int x; ++x; }
|
||||
void mf2v_2(int, int) {}
|
||||
|
||||
void cmf2v_1(int, int) const {}
|
||||
void cmf2v_2(int, int) const { static int x; ++x; }
|
||||
void cmf2v_2(int, int) const {}
|
||||
|
||||
// 3
|
||||
|
||||
int mf3_1(int, int, int) { return 0; }
|
||||
int mf3_2(int, int, int) { return 1; }
|
||||
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 1; }
|
||||
int cmf3_2(int, int, int) const { return 0; }
|
||||
|
||||
void mf3v_1(int, int, int) {}
|
||||
void mf3v_2(int, int, int) { static int x; ++x; }
|
||||
void mf3v_2(int, int, int) {}
|
||||
|
||||
void cmf3v_1(int, int, int) const {}
|
||||
void cmf3v_2(int, int, int) const { static int x; ++x; }
|
||||
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 1; }
|
||||
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 1; }
|
||||
int cmf4_2(int, int, int, int) const { return 0; }
|
||||
|
||||
void mf4v_1(int, int, int, int) {}
|
||||
void mf4v_2(int, int, int, int) { static int x; ++x; }
|
||||
void mf4v_2(int, int, int, int) {}
|
||||
|
||||
void cmf4v_1(int, int, int, int) const {}
|
||||
void cmf4v_2(int, int, int, int) const { static int x; ++x; }
|
||||
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 1; }
|
||||
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 1; }
|
||||
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) { static int x; ++x; }
|
||||
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 { static int x; ++x; }
|
||||
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 1; }
|
||||
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 1; }
|
||||
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) { static int x; ++x; }
|
||||
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 { static int x; ++x; }
|
||||
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 1; }
|
||||
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 1; }
|
||||
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) { static int x; ++x; }
|
||||
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 { static int x; ++x; }
|
||||
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 1; }
|
||||
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 1; }
|
||||
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) { static int x; ++x; }
|
||||
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 { static int x; ++x; }
|
||||
void cmf8v_2(int, int, int, int, int, int, int, int) const {}
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user