Test std::find_if and std::find_if_not

This commit is contained in:
Daniel Marjamäki 2016-11-02 09:13:54 +01:00
parent 223ce04986
commit 6e762659c0
1 changed files with 12 additions and 0 deletions

View File

@ -3172,4 +3172,16 @@ void stdfind(const std::list<int> &ints1, const std::list<int> &ints2)
std::find(ints1.begin(), ints2.end(), 123);
// cppcheck-suppress mismatchingContainers
if (std::find(ints1.begin(), ints1.end(), 123) == ints2.end()) {}
// cppcheck-suppress mismatchingContainers
// cppcheck-suppress ignoredReturnValue
std::find_if(ints1.begin(), ints2.end(), [](int i){return i!=0;});
// cppcheck-suppress mismatchingContainers
if (std::find_if(ints1.begin(), ints1.end(), [](int i){return i!=0;}) == ints2.end()) {}
// cppcheck-suppress mismatchingContainers
// cppcheck-suppress ignoredReturnValue
std::find_if_not(ints1.begin(), ints2.end(), [](int i){return i!=0;});
// cppcheck-suppress mismatchingContainers
if (std::find_if_not(ints1.begin(), ints1.end(), [](int i){return i!=0;}) == ints2.end()) {}
}