Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #12857 > unrolled thread

Why the iterator_traits is needed?

Started byizhak <iz.hak@mail.ru>
First post2011-12-29 16:55 +0000
Last post2012-01-07 23:19 -0800
Articles 5 — 3 participants

Back to article view | Back to comp.lang.c++


Contents

  Why the iterator_traits is needed? izhak <iz.hak@mail.ru> - 2011-12-29 16:55 +0000
    Re: Why the iterator_traits is needed? "Bo Persson" <bop@gmb.dk> - 2011-12-29 17:58 +0100
      Re: Why the iterator_traits is needed? izhak <iz.hak@mail.ru> - 2011-12-29 17:10 +0000
    Re: Why the iterator_traits is needed? 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-29 16:42 -0800
      Re: Why the iterator_traits is needed? 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-07 23:19 -0800

#12857 — Why the iterator_traits is needed?

Fromizhak <iz.hak@mail.ru>
Date2011-12-29 16:55 +0000
SubjectWhy the iterator_traits is needed?
Message-ID<jdi623$8s6$1@speranza.aioe.org>
Why do we need the iterator_traits if it's just a simple redefinition of 
some of the Iterator concept's members?

[toc] | [next] | [standalone]


#12858

From"Bo Persson" <bop@gmb.dk>
Date2011-12-29 17:58 +0100
Message-ID<9m3kgvF7qfU1@mid.individual.net>
In reply to#12857
izhak wrote:
> Why do we need the iterator_traits if it's just a simple
> redefinition of some of the Iterator concept's members?

It's not just that.

There is also a specialization for pointer, which doesn't have the 
concept members.

Pointers are also iterators!


Bo Persson

[toc] | [prev] | [next] | [standalone]


#12859

Fromizhak <iz.hak@mail.ru>
Date2011-12-29 17:10 +0000
Message-ID<jdi6u6$brl$1@speranza.aioe.org>
In reply to#12858
On Thu, 29 Dec 2011 17:58:14 +0100, Bo Persson wrote:

> There is also a specialization for pointer, which doesn't have the
> concept members.
> 
> Pointers are also iterators!
> 
> 
> Bo Persson

Yes, now I understand... And for any other type, we my just specialize 
it, to make that type usable in stl. Clear, thanks.

[toc] | [prev] | [next] | [standalone]


#12869

From88888 Dihedral <dihedral88888@googlemail.com>
Date2011-12-29 16:42 -0800
Message-ID<28877841.460.1325205752939.JavaMail.geo-discussion-forums@prgi2>
In reply to#12857
izhak於 2011年12月30日星期五UTC+8上午12時55分31秒寫道:
> Why do we need the iterator_traits if it's just a simple redefinition of 
> some of the Iterator concept's members?

I think to understand an iterator is important.

There are implementations of iterators. 

Iterators are different from recursions in implementations.

In the abstract level the two does not differ too much. 


 

[toc] | [prev] | [next] | [standalone]


#13170

From88888 Dihedral <dihedral88888@googlemail.com>
Date2012-01-07 23:19 -0800
Message-ID<15697836.1161.1326007163127.JavaMail.geo-discussion-forums@prlh23>
In reply to#12869
88888 Dihedral於 2011年12月30日星期五UTC+8上午8時42分32秒寫道:
> izhak於 2011年12月30日星期五UTC+8上午12時55分31秒寫道:
> > Why do we need the iterator_traits if it's just a simple redefinition of 
> > some of the Iterator concept's members?
> 
> I think to understand an iterator is important.
> 
> There are implementations of iterators. 
> 
> Iterators are different from recursions in implementations.
> 
> In the abstract level the two does not differ too much.

But iterator in STL is more powerful. For example, there could be many 
instances of timers in different classes of objects. 

Each timer is defined clearly for the actions to be triggered in objects
that can access the timer in the next timer update event. 

Thinking in the iterator way and the message driven mechanism is 
better than the MS call back mechanism.  

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web