I try this code:
int a=1;
std::function<int (int, int)> getM = a?
[](int x, int y) {
return (x+y);
} :
[](int x, int y) {
return (x*y);
};
cout<<getM(1,2);
In visual studio it gives an error: error C2446: ':' : no conversion from 'wmain::' to 'wmain::' 1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
In GCC it's compiled. I suppose that GCC is the correct behaviour, but I'm not sure. What are other options to make this on VS2013?
Aucun commentaire:
Enregistrer un commentaire