Boost logo

Boost Users :

Subject: [Boost-users] [Unordered] Penultimate Iterator
From: Hossein Haeri (powerprogman_at_[hidden])
Date: 2010-09-10 10:39:58


Dear all,

What is the quickest way to get hold of the penultimate iterator in an unordered_map? I'm aware of this one -- which is O(n), where n == container_.size():

container_type::const_iterator i = container_.begin();
advance(i, container_.size() - 1);

Is there no O(1) solutions?

TIA,
--Hossein


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net