Boost logo

Boost :

Subject: Re: [boost] [ boost ] [ Trie ]
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2015-04-09 02:51:25


2015-04-08 23:06 GMT+03:00 Cosmin Boaca <boost.cosmin.boaca_at_[hidden]>:

> It won't work. I need to do something like I am doing in the ++ operator
> implementation. Basically testing the iterator against end() means that I
> have finished the nodes at the current level and I need to go up in the
> trie.
> If I will test against begin I will ignore the first node from each level
> and I will go straight up.
>

I still can not see problem here:
operator ++() : *increment* the iterator and *compare* with end()
operator -- () : *compare* with begin() and if it is not on begin(), then
*decrement*. Otherwise go to parent

Let's take a look into different cases:
we are at the begin() + 1: in that case we'll get begin() and user will
work with begin()
we are at the begin() : in that case we detect that we are at the begin()
and just go to parent

-- 
Best regards,
Antony Polukhin

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk