От: | Аноним | ||
Дата: | 31.07.08 08:35 | ||
Оценка: |
class B1{public:
void f1(std::string &s){ std::cout<<s<< std::endl; };
void f2(std::string s) { std::cout<<s<< std::endl; };
void f3(std::string *s){ std::cout<<*s<< std::endl;
};
};
int main(){
B1 b1;
boost::bind(&B1::f1, b1, std::string("b111"))(); //связал
boost::bind(&B1::f1, &b1, std::string("b222"))(); //связал
//boost::bind(&B1::f1, &b1,_1) (&std::string("b333")); //error
//boost::bind(&B1::f1, b1,_1) (*std::string("b444")); //error
//boost::bind(&B1::f1, b1,_1) (std::string("b555")); //error
boost::bind(&B1::f2, b1, std::string("b999"))(); //связал
boost::bind(&B1::f2, b1,_1)( std::string("bAAA")); //связал
boost::bind(&B1::f2, _1, _2)( b1,std::string("bBBB")); //связал
boost::bind(&B1::f3, &b1, &std::string("b666"))(); //связал
boost::bind(&B1::f3, &b1,_1)( &std::string("b777")); //связал
boost::bind(&B1::f3,_1,_2) ( &b1, &std::string("b888"));//связал
return 0;
}
: error C2664: 'R boost::_mfi::mf1<R,T,A1>::operator ()<B1>(const U &,A1) const' :
cannot convert parameter 2 from 'std::basic_string<_Elem,_Traits,_Ax> ' to
'std::basic_string<_Elem,_Traits,_Ax> '