0

Can you tell me which basic operations on a list can cause an use of stack proportional to the size of the list? (I mean, looping on all elements...)

I have problems with stack size.

Is iterator post-incrementing dangerous in this sense?

4
Contributors
5
Replies
7
Views
8 Years
Discussion Span
Last Post by arenq
0

Can you tell me which basic operations on a list can cause an use of stack proportional to the size of the list? (I mean, looping on all elements...)

I have problems with stack size.

Is iterator post-incrementing dangerous in this sense?

Could you make your question clearer? Which Stack are you referring to? Do you mean STL's std::stack , or something of your own creation? Or do you mean a stack, implemented as a linked list?

0

Do you mean STL's std::stack , or something of your own creation?

As he's talking about iterators, I assume he means the stack template from STL :)

0

As he's talking about iterators, I assume he means the stack template from STL :)

Yeah, I see what you mean, but I wanted to make sure, because some people use incorrect terminology (he might have used the word "iterator" in place of "Index", as in Array index etc)

0

Can you tell me which basic operations on a list can cause an use of stack proportional to the size of the list? (I mean, looping on all elements...)
I have problems with stack size.
Is iterator post-incrementing dangerous in this sense?

No need in recursive implementation of basic list operations. Overloaded pre- and postincrement of list iterators have absolutely straitforward codes, I can't imagine stack-consumed implementation of these operators.

Can you present "bad" code fragment?

0

It's an embedded software application.

There are many loops on all elements of a very big list which (maybe) consumes all the stack reserved for its task.

Indeed, I have the Program Counter in stl_list.h

----------------------
operator->() const
{ return &static_cast<_Node*>(_M_node)->_M_data; }
----------------------

I don't want you to investigate it... just only if you know problematic issues again list and stack use.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.