You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
869 B

#include <iostream>
#include <list>
#include <algorithm>
using namespace std;
bool bigger(int i) {
return i >12 ;
}
int main()
{
list<int> l{1,3,9,7,10,3,4};
l.push_back(666);
auto found = find( begin(l), l.end(), 9 );
list<int>::iterator iter = found;
if ( found != l.end() )
*found = 7;
found = find_if( begin(l), found, bigger );
if ( found != found ) {
cout << *found << " trouve\n" ;
}
found = find_if( begin(l), found, // Lambda ci dessous
[](int i){ return i%2 == 0;}
);
int min = 6;
found = find_if( begin(l), found, // Avec capture de min
[&min](int i){ return i < min == 0;}
);
if ( found != found ) {
cout << *found << " trouve\n" ;
}
cout << "Hello World!" << endl;
return 0;
}