Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > iterator traits

Reply
Thread Tools

iterator traits

 
 
toton
Guest
Posts: n/a
 
      03-06-2007
Hi,
I am developing one container of my own, which has iterators.
the iterator is not derived from boost iterator facade (for some
other reason), instead it is manually designed.
Now when I am interfacing it with other boost libraries (like
permutation_iterator, sub_range etc), I get a few errors related to
iterator traits.
Now my question
1) What are the traits needed for iterator (and const iterator) ?
any addition/deletion from the list ?
1) size_type
2) reference
3) pointer
4) value_type
5) iterator_category
6) difference_type

2) For const_iterator what are the type of the following in a
iterator ?
1)value_type T or const T ?
2) reference T& or const T&
3) pointer T* or const T*

Thanks
abir

 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      03-06-2007
toton wrote:
> Hi,
> I am developing one container of my own, which has iterators.
> the iterator is not derived from boost iterator facade (for some
> other reason), instead it is manually designed.
> Now when I am interfacing it with other boost libraries (like
> permutation_iterator, sub_range etc), I get a few errors related to
> iterator traits.
> Now my question
> 1) What are the traits needed for iterator (and const iterator) ?
> any addition/deletion from the list ?
> 1) size_type
> 2) reference
> 3) pointer
> 4) value_type
> 5) iterator_category
> 6) difference_type


size_type is not required.

>
> 2) For const_iterator what are the type of the following in a
> iterator ?
> 1)value_type T or const T ?
> 2) reference T& or const T&
> 3) pointer T* or const T*


T, const T& and const T*

john


>
> Thanks
> abir
>

 
Reply With Quote
 
 
 
 
toton
Guest
Posts: n/a
 
      03-06-2007
On Mar 6, 1:39 pm, John Harrison <(E-Mail Removed)> wrote:
> toton wrote:
> > Hi,
> > I am developing one container of my own, which has iterators.
> > the iterator is not derived from boost iterator facade (for some
> > other reason), instead it is manually designed.
> > Now when I am interfacing it with other boost libraries (like
> > permutation_iterator, sub_range etc), I get a few errors related to
> > iterator traits.
> > Now my question
> > 1) What are the traits needed for iterator (and const iterator) ?
> > any addition/deletion from the list ?
> > 1) size_type
> > 2) reference
> > 3) pointer
> > 4) value_type
> > 5) iterator_category
> > 6) difference_type

>
> size_type is not required.
>
>
>
> > 2) For const_iterator what are the type of the following in a
> > iterator ?
> > 1)value_type T or const T ?
> > 2) reference T& or const T&
> > 3) pointer T* or const T*

>
> T, const T& and const T*
>
> john
>
>
>
> > Thanks
> > abir


Many thanks. ow it solved the problem, and the code's are working with
all of the boost library.

 
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
How to generate execute file that include enthought.traits.api ,enthought.traits.ui.api ? ray Python 1 06-04-2010 03:49 PM
What makes an iterator an iterator? Steven D'Aprano Python 28 04-20-2007 03:34 AM
Difference between Java iterator and iterator in Gang of Four Hendrik Maryns Java 18 12-22-2005 05:14 AM
How to convert from std::list<T*>::iterator to std::list<const T*>::iterator? PengYu.UT@gmail.com C++ 6 10-30-2005 03:31 AM
Iterator doubts, Decision on Iterator usage greg C++ 6 07-17-2003 01:26 PM



Advertisments