iterator traits

T

toton

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
 
J

John Harrison

toton said:
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
 
T

toton

size_type is not required.




T, const T& and const T*

john

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top