How can I get the penultimate element in a list? – stackoverflow.com

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 ...

from Hot Questions - Stack Exchange OnStackOverflow
via Blogspot

Share this

Artikel Terkait

0 Comment to "How can I get the penultimate element in a list? – stackoverflow.com"