I've got the following program:
#include<iostream>
#include<functional>
using namespace std;
using namespace std::placeholders;
int main(){
int i=0;
int j=0;
bind(&f,_1,i)();
bind(&f,j,_1)();
return 0;
}
clang --std=c++11 gives following error:
no matching function for call to object of type '__bind<void (*)(int &,
int &), std::__1::placeholders::__ph<1> &, int &>'
bind(&f,_1,i)();
I changed my program to
bind(&f,_1,ref(i))();
bind(&f,ref(j),_1)();
It still fails, how to fix it?
Aucun commentaire:
Enregistrer un commentaire