|
Boost Users : |
Subject: Re: [Boost-users] [Filesystem] Reverse traversal of boost::filesystem::path::const_iterator?
From: Nat Linden (nat_at_[hidden])
Date: 2012-11-02 11:22:42
On Fri, Nov 2, 2012 at 8:43 AM, Sebastian Messerschmidt
<sebastian.messerschmidt_at_[hidden]> wrote:
> Bidirectional Iterators and rbegin/rend are not necessarily the same thing.
Understood. I mention rbegin()/rend() only to say that if
boost::filesystem::path supported them, my question about
boost::filesystem::path::end() would become moot because I would use
the rbegin()/rend() idiom instead.
> The bidirectional property only guarantees that the operator-- is supported [1] additionally to the ++ operator.
To be clear about my question, let me pose it as a syllogism, where
'container' is an instance of SomeContainer:
IF SomeContainer::end() is documented to return a bidirectional iterator,
AND container.end() != container.begin(),
THEN the following code is valid, and references the last item in container:
SomeContainer::const_iterator it = container.end();
--it;
SomeContainer::value_type const& last = *it;
Always true?
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