#include<iostream>
using
namespace
std;
class
A
{
public
:
fun_3(
k,monospace!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; outline:0px!important; overflow:visible!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-size:1em!important; min-height:inherit!important">m)
{
cout<<k<<
""
<<m<<endl;
}
};
fun(
x,monospace!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; outline:0px!important; overflow:visible!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-size:1em!important; min-height:inherit!important">y,monospace!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; outline:0px!important; overflow:visible!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-size:1em!important; min-height:inherit!important">z)
@H_ 301_453@
{
cout<<x<<
<<y<<
<<z<<endl;
}
fun_2(
&a,monospace!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; outline:0px!important; overflow:visible!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-size:1em!important; min-height:inherit!important">&b)
{
a++;
b++;
cout<<a<<
<<b<<endl;
}
main(
argc,
const
char
*argv[])
{
auto
f1=bind(fun,1,2,3);
f1();
f2=bind(fun,placeholders::_1,placeholders::_2,3);
//表示绑定函数fun的第三个参数为3,而fun的第一,二个参数分别有调用f2的第一,二个参数指定
f2(1,2);
f3=bind(fun,3);
//表示绑定函数fun的第三个参数为3,而fun的第一,二个参数分别有调用f3的第二,一个参数指定
//注意:f2和f3的区别。
f3(1,0)!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; outline:0px!important; overflow:visible!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-size:1em!important; min-height:inherit!important">//print:213
n=2;
m=3;
f4=bind(fun_2,n,placeholders::_1);
f4(m);
cout<<m<<endl;
cout<<n<<endl;
Aa;
f5=bind(&A::fun_3,a,placeholders::_2);
f5(10,20);
,monospace!important; border:0px!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; outline:0px!important; overflow:visible!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-size:1em!important; min-height:inherit!important">)>fc=std::bind(&A::fun_3,std::placeholders::_1,std::placeholders::_2);
fc(10,0)!important; bottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.1em!important; outline:0px!important; overflow:visible!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-size:1em!important; min-height:inherit!important">//print:1020
return
0;
}
|