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

null stl iterator ?


I need to create an object that contains an iterator. The iterator may
or may not be valid in which case I would also need to store a flag
indicating that the iterator is invalid.

Am I missing somthing ?

This object is created way before a container is created so setting it
to end() or somthing does not make sense.
Jul 19 '05 #1
4 6767
Hi,

Why not set variables for beginiing end one past end of array.. These var
will be returned by end() and begin().

Then when you assign an array make the 'end' var equal to one past the end
of the array and the other 'begin' var to begining of the array.

Regards, Ron AF Greve

"Gianni Mariani" <gi*******@mariani.ws> wrote in message
news:bn********@dispatch.concentric.net...

I need to create an object that contains an iterator. The iterator may
or may not be valid in which case I would also need to store a flag
indicating that the iterator is invalid.

Am I missing somthing ?

This object is created way before a container is created so setting it
to end() or somthing does not make sense.

Jul 19 '05 #2

"Gianni Mariani" <gi*******@mariani.ws> wrote in message news:bn********@dispatch.concentric.net...
This object is created way before a container is created so setting it
to end() or somthing does not make sense.


Then you will need to have an external flag, or create a container specifically
so you can use it's end() (even if you never put anything in it).

The standard provides no "default" value for iterators.
Jul 19 '05 #3
Hi,

Forgot to say, initially these variables should be set to zero.

Regards, Ron.

"Moonlit" <al******@jupiter.universe> wrote in message
news:3f***********************@news.xs4all.nl...
Hi,

Why not set variables for beginiing end one past end of array.. These var
will be returned by end() and begin().

Then when you assign an array make the 'end' var equal to one past the end
of the array and the other 'begin' var to begining of the array.

Regards, Ron AF Greve

"Gianni Mariani" <gi*******@mariani.ws> wrote in message
news:bn********@dispatch.concentric.net...

I need to create an object that contains an iterator. The iterator may
or may not be valid in which case I would also need to store a flag
indicating that the iterator is invalid.

Am I missing somthing ?

This object is created way before a container is created so setting it
to end() or somthing does not make sense.


Jul 19 '05 #4

"Moonlit" <al******@jupiter.universe> wrote in message news:3f***********************@news.xs4all.nl...
Hi,

Forgot to say, initially these variables should be set to zero.

If these "variables" are iterators, then there's no guarantee you can
assign (even a constant) zero to them.
Jul 19 '05 #5

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

Similar topics

17
by: Douglas Alan | last post by:
Is there a canonical way of iterating over the lines of a file that are null-separated rather than newline-separated? Sure, I can implement my own iterator using read() and split(), etc., but...
15
by: sandwich_eater | last post by:
I want to know how to set an std::list iterator variable to make it null or nil. If this is not possible what is the value of an uninitialised std::list iterator and is it ok to assign this value...
7
by: andreas | last post by:
Hello, I have a problem with iterators in a fairly complex polygonal mesh data structure which is implemented using lists of geometric entities. However, the problem in itself is fairly simple:...
6
by: marcwentink | last post by:
Dear Sirs, Dear Newsgroup, Imagine I have some function that only gives me an iterator to a vector, but not the vector itself. Unfortunately this vector can be empty and the iterator can point...
3
by: Amit Bhatia | last post by:
User-Agent: OSXnews 2.081 Xref: number1.nntp.dca.giganews.com comp.lang.c++:818044 Hi, I am wondering if I can assign a list iterator = NULL. Suppose I have a class A: A.h class A{ //ctors...
0
by: mailforpr | last post by:
Hi. Let me introduce an iterator to you, the so-called "Abstract Iterator" I developed the other day. I actually have no idea if there's another "Abstract Iterator" out there, as I have never...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
3
by: toton | last post by:
Hi, In some cases when my function returns, I need to return a object of null state. This is when I return object by value. (Just like for by pointer, I can return a null pointer ). It has to be...
7
by: Mohitz | last post by:
How do you write a function in C++ which returns a class object in some cases and in others, returns something like a NULL pointer so that i can know in the callee function that the object doesnt...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.