when compiling with mingw32-g++, there is error: no matching function for call to 'for_each(int [9], int*, main()::Output)', but can do well in vs2005?
#include <iostream>
#include <algorithm>
int main() {
struct Output {
void operator () (int v) {
std::cout << v << std::endl;
}
};
int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
std::for_each(a, a + sizeof(a)/sizeof(a[0]), Output());
return 0;
}