Ben Bacarisse has given you the correct answer. Unless you create a
local variable, in a member function a lambda expression only captures
the 'this' pointer of the object of which the function is a member and
not its other members. So with C++11, in the lambda expression you
have to address object members through the this pointer if you don't
create local copies.
C++14 does have a simplification (?) for this, if you happen to use
gcc-4.9 or clang-3.4 (-std=c++14 or -std=c++1y), in the sense that it
makes it easier to create the local variable. Possibly gcc-4.8 also
supports it (I haven't tested). The syntax for this in C++14 is as
follows:
auto non_matching_foo = [m_val=this->m_val](Foo f){
return (f.m_val != m_val);
};
Of course, where the member 'm_val' is expensive to copy, you may be
better to stick to the C++11 approach and address the member through
the this pointer.
Chris