473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

iterator traits

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

Mar 6 '07 #1
2 2193
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
Mar 6 '07 #2
On Mar 6, 1:39 pm, John Harrison <john_androni...@hotmail.comwrote:
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.

Mar 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Donald 'Paddy' McCarthy | last post by:
Hi, I am having a few problems with a GUI. I am new to traits and wxGlade. I have used wxGlade to create a Form with an embedded space for a CustomWidget. I have the traits demo and would like...
5
by: Cagdas Ozgenc | last post by:
Greetings. Is there a convinient way to get the next iterator position without mutating the iterator for non-random access containers? For example, i + 1 instead of i++
12
by: Mark A. Gibbs | last post by:
Good day, What is the safest way to get a non-end of file value? char_traits<char_type>::eof() will get me eof, but how can I safely and consistently generate a value that is not eof? should i...
6
by: Jason S | last post by:
where is the behavior of list::iterator specified? I need to keep track of ranges of data, all I can figure out so far is that iterators are guaranteed to be valid unless you remove the elements...
3
by: Belebele | last post by:
I have an Element class which is abstract and I would like to have an object of the Iterator class to iterate over a range of elements. I would like to use std::for_each to instrument the...
22
by: =?gb2312?B?wNbA1rTzzOzKpg==?= | last post by:
windows xp, visual studio 2005 ---------------------------------------------------------------------------------------------------------------------------------- #include <iostream> #include <map>...
16
by: Juha Nieminen | last post by:
I'm actually not sure about this one: Does the standard guarantee that if there's at least one element in the data container, then "--container.end()" will work and give an iterator to the last...
3
by: cablepuff | last post by:
Alright, I am sort of confused on c++ iterators having both distance_type and size_type. On sgi and Microsoft compiler it uses distance_type for input iterator. For mingw and cygwin it uses...
2
by: Colin J. Williams | last post by:
Using >easy_install -v -f http://code.enthought.com/enstaller/eggs/source enthought.traits The result is: .... many lines ....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.