prog.cpp: In lambda function:
prog.cpp:12:37: error: 'start' is not captured
[](const int val) { return val != start; });
^
prog.cpp:12:4: note: the lambda has no capture-default
[](const int val) { return val != start; });
^
prog.cpp:8:6: note: 'int start' declared here
int start = 2;
^
In file included from /usr/include/c++/5/algorithm:62:0,
from prog.cpp:1:
/usr/include/c++/5/bits/stl_algo.h: In instantiation of '_OIter std::copy_if(_IIter, _IIter, _OIter, _Predicate) [with _IIter = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _OIter = std::ostream_iterator<int>; _Predicate = main()::<lambda(int)>]':
prog.cpp:12:45: required from here
/usr/include/c++/5/bits/stl_algo.h:746:12: error: could not convert '__pred.main()::<lambda(int)>(((int)__first.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*<const int*, std::vector<int> >()))' from 'void' to 'bool'
if (__pred(*__first))
^