mardi 26 janvier 2016

std::bind doesn't work with string array

Is there a way to make this code compile?

#include <functional>
#include <vector>
#include <iostream>
using namespace std;
void f1(int x, int y){}
void f2(int x, vector<string> v) {}
int main ()
{
    f(2, {{"hello", "it's", "me"}});
    auto g1 = bind(f1, placeholders::_1, 3);
    auto g2 = bind(f2, placeholders::_1, {{"hello", "it's", "me"}});
    return 0;
}

g1 works fine, g2 gives some complicated compile error

Aucun commentaire:

Enregistrer un commentaire