the error seems to be with std:: accumulate or the iterators, or am I accessing an invalid pointer?
I've tried the above code, but the program stops unexpectedly
int m = 0;
std::vector<int> v{4,-3,0,-5};
for(std::vector<int>::iterator i = v.begin(); i!=v.end(); i++)
{
for(std::vector<int>::iterator j = v.begin(); j!=v.end(); j++)
{
m = max( m, std::accumulate(i, j, 0) );
}
}
Aucun commentaire:
Enregistrer un commentaire