Assuming you intend for checkFilePath
to be a member, replace the use of it in the for_each
algorithm with:
[&](std::string const& s){return checkFilePath(s);}
and it will capture this
and call the method. The above requires C++11, which you may not have. If you have C++03, you either have to use std::bind
or boost::bind
or write your own functor to capture this
or the state required to solve the checkFilePath
problem.
If your checkFilePath
does not depend on the state of this
, simply make the method static
and your existing code should compile. (Alternatively, make it a free function).