Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Why the iterator_traits is needed?

Reply
Thread Tools

Why the iterator_traits is needed?

 
 
izhak
Guest
Posts: n/a
 
      12-29-2011
Why do we need the iterator_traits if it's just a simple redefinition of
some of the Iterator concept's members?
 
Reply With Quote
 
 
 
 
Bo Persson
Guest
Posts: n/a
 
      12-29-2011
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


 
Reply With Quote
 
 
 
 
izhak
Guest
Posts: n/a
 
      12-29-2011
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.
 
Reply With Quote
 
88888 Dihedral
Guest
Posts: n/a
 
      12-30-2011
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.



 
Reply With Quote
 
88888 Dihedral
Guest
Posts: n/a
 
      01-08-2012
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
typename iterator_traits::pointer Ioannis Vranos C++ 10 01-25-2008 12:25 AM
help on std::iterator_traits? Jess C++ 3 06-28-2007 03:01 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Purpose of iterator_traits::value_type chris C++ 8 12-10-2004 04:02 PM
iterator_traits Lieven C++ 3 12-03-2004 06:33 AM



Advertisments