// Method that takes an iterable input (possibly an array) // and returns all even numbers. public static IEnumerable<int> GetEven(IEnumerable<int> numbers) { foreach(int i in numbers) { if (i % 2 == 0) yield return i; } }
template<typename InputIterator> void printall(InputIterator first, InputIterator last) { for(; first != last; ++first) { std::cout << *first << std::endl; } }