| 9 | void printVector(const std::vector<int>& v); // Print the contents of a vector to std::cout |
| 10 | |
| 11 | int main() |
| 12 | { |
| 13 | const size_t num_numbers{20}; |
| 14 | |
| 15 | const auto numbers{ fillSet_1toN(num_numbers) }; |
| 16 | |
| 17 | std::vector<int> odd_numbers; |
| 18 | std::copy_if(begin(numbers), end(numbers), back_inserter(odd_numbers), |
| 19 | [](int n) { return n % 2 == 1; }); |
| 20 | |
| 21 | printVector(odd_numbers); |
| 22 | } |
| 23 | |
| 24 | std::set<int> fillSet_1toN(size_t N) // Fill a set with 1, 2, ..., N |
| 25 | { |
nothing calls this directly
no test coverage detected