473,322 Members | 1,510 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,322 software developers and data experts.

Iterator Problem (Printing the address problem)... Help

1
Hello,

I am newbie to the topic of iterators. I need to know how many iterations the following "for loop" will execute. Iterators are used.

aend = m_SampleA.end();
for (aiter=m_SampleA.begin(), aiter!=aend, ++aiter)
{
...
}

The compile error comes up when I tried to print the address,
printf("address = %p\n", m_SampleA.begin())

Also, I have no idea what is the memory separation between iterator increments.. so I have difficulty finding the number of iterations...

Is there any special function that returns the address ?

Thank you
Nov 30 '07 #1
2 1930
Why do you use printf if you are in a OO environment?
printf can take only primitive types or char* arrays(that is strings) as argument;what is supposed to be in your container?
I want you to remember that in C/C++ the only type designated to store addresses is the pointer type;so if you really like printf to print an address you 'd rather have a pointer as argument.
Nov 30 '07 #2
maybe an int declared outside the loop for a count? Makes sense to me
Nov 30 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: CoolPint | last post by:
I am trying to write a generic heapsort (of course as a self-exercise) with Iterator interface: something like blow.... But I got into trouble finding out the Iterator to the Child node. If...
4
by: steflhermitte | last post by:
Dear cpp-ians, I am working with a structure struct segment { .... vector <meta_segment>::iterator it_Z; .... };
13
by: Adam Hartshorne | last post by:
Hi All, I was wondering if anybody can tell me what is wrong with the following code, in a .h file I have std::list<std::vector<Site> > positions ; std::list<std::vector<Site> >::iterator...
2
by: Lorenzo Castelli | last post by:
This is an old problem of mine. Basically I have an abstract base class which represents a generic iterator over a collection of elements, and various derived classes that implement the...
18
by: silversurfer | last post by:
Ok, this should be fairly easy for most of you (at least I hope so), but not for me: Let us say we have got the following elements: std::vector<Entry> models; //Entry is a struct...
16
by: mailforpr | last post by:
How do I do that? The thing is, the only information I have about the iterator is the iterator itself. No container it is belonging to or anything. Like template<Iteratorvoid...
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
1
by: Scott Gifford | last post by:
Hello, I'm working on an providing an iterator interface to a database. The basic thing I'm trying to accomplish is to have my iterator read rows from the database and return constructed...
4
by: TBass | last post by:
Hi, I've got a class that uses a std::list to store tags that need to be written out to a device. I've had no problem with the lists in terms of iterating and reading values. My problem is when...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.