Re: list and iterators
From: Jeff F (not_at_anywhere.com)
Date: 06/06/04
- Previous message: Leon McCalla: "RpcServerUnregisterIfEx on win2K"
- In reply to: Nelson: "list and iterators"
- Next in thread: Nelson: "Re: list and iterators"
- Reply: Nelson: "Re: list and iterators"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 6 Jun 2004 15:41:13 -0400
"Nelson" <doomer999@hotmail.com> wrote in message
news:%23Nk%23N09SEHA.544@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> I tried to cast a reverse_iterator of list to an iterator, but it does not
> work.
> It's strange that an iterator can be cast to a reverse_iterator without
> problem.
You don't cast them. You call the base() method to get (ahem) the base
iterator that reverse_iterator adapts.
typedef std::list<MyType> tList;
tList MyList;
tList::reverse_iterator lRItr = MyList.rbegin();
tList::iterator lItr = lRItr.base();
assert( lItr == MyList.end() );
>
> Why is it so? Aren't iterators just pointers?
Nope.
Jeff F
- Previous message: Leon McCalla: "RpcServerUnregisterIfEx on win2K"
- In reply to: Nelson: "list and iterators"
- Next in thread: Nelson: "Re: list and iterators"
- Reply: Nelson: "Re: list and iterators"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|