I have a std::list<double> foo;
I'm using
if (foo.size() >= 2){
double penultimate = *(--foo.rbegin());
}
but this always gives me an arbitrary value of penultimate.
What am I doing wrong?
I have a std::list<double> foo;
I'm using
if (foo.size() >= 2){
double penultimate = *(--foo.rbegin());
}
but this always gives me an arbitrary value of penultimate.
What am I doing wrong?