This is quite a strange error to me. Check the code below:
void test(void){
vector<string> v;
v.push_back("hello");
auto fn=[=](){
v.push_back("world");
};
}
The first push_back method passed the compilation but the second failed, yielding the error:
Error:no matching member function for call to 'push_back'
The compiler note is:
**Note:(687, 36) candidate function not viable: 'this' argument has type 'const vector' (aka 'const vector, allocator > >')
But the method is not marked const**.
Well I am not using any const argument and I cannot figure what the compiler is trying to tell me. Could anybody help me?