bind函数在头文件functional中定义。
调用bind的常见格式如下:
autonewcallable=bind(callable,arg_list );
arg_list参数可以包含形式类似于_n的名称。 其中n是整数。 这些参数是占位符。
其中一个例子是:
autocheck6=bind(check_size,_ 1,6 );
bind将复制参数,因此无法复制ostream。 如果想在不复制她的情况下将对象传递给bind,则必须使用标准库中的ref函数。
for_each(word.begin )、word.end )、bind(print,ref )、_1,' ');
其中操作系统是ostream对象。