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