Are you sure?... and with C++0x
Isn't that equivalent to this?
If so, it doesn't work!Code:#include <string> #include <numeric> int Function(int count, char value) { return value ? 0 : ++count; } int main() { char data[] = {0, 1, 2, 3, 0, 0, 4 ,5 ,0, 0, 0, 6, 7}; std::string dataStream(data, data + 13); int largest = std::accumulate(dataStream.begin(), dataStream.end(), int(0), Function); }




Reply With Quote