|
I want to make a generic stack using the c++ templates. The prototype of the push method of stack is given by Void push( t* ptr) Where t is the template argument. Now the pointer ptr may point to an integer, or an array of integers, it may point to a ...
Started by Zia ur Rahman on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Consider having your stack type take a pair of pointers, one to the first element, like most "add" operations on stl containers? And while you're at it, do you know that std::stack, but the two need to be treated differently....
To a pointer.
|
|
Hello,
Unfortunately an item can only be removed from the stack by "pop". The stack has no "remove" method or something similar, but I have a stack (yes I need a stack!) from which I need to remove some elements between.
Is there a trick to do this?
Started by Enyra on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Then you can use
AddFirst AddLast RemoveLast....
Then you get to implement your own push.
Try making your own implementation of a stack from a List.
If you need to remove items that aren't on the top, then you need something other than a stack.
|
|
Is the kernel stack a different structure to the user-mode stack that is used by applications we (programmers) write?
Can you explain the differences?
Started by Tony on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
When switching to kernel mode, a different stack....
The reason why there are two different stack per thread is because in user mode, code must not be allowed to mess up kernel memory.
Conceptually, both are the same data structure: a stack.
|
Ask your Facebook Friends
|
Many C/C++/Fortran and other programmers would have come across "stack overflow" errors. My question is, Is there a tool, a program or a simple code snippet, that allow us to monitor or check the size of the stack while the program is running? This may...
Started by c.Chee on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
This will give you the maximum stack size used, not the current ....
AA) and monitor the position of the first byte that doesn't have this value .
One easy trick is to fill the stack with a known byte value (e.g.
Will be platform dependent.
|
|
Hi, There is a stack of activity i want to call the activity from that stack , My question is that is it possible to check from that stack and call that intent . When i press home button and again when i press the executable it should start the activity...
Started by Sam97305421562 on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
I kept a Stack of Intent objects in memory in and reconstructed the stack of activities....
This is what I had to do for a tabbed application that required long-term state .
Your own state file and presumably your own stack of intents.
|
|
I have a class that calls
traceback.extract_stack()
in its __init__() , but whenever I do that, the value of traceback.extract_stack() is [] .
What are some reasons that this could be the case? Is there another way to get a traceback that will be more...
Started by Josh Gibson on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
>>> func() [('<....
Print tb.extract_stack() ...
Following shows traceback.extract_stack_stack() [('<stdin>', 1, '<module>', None)] >>> def func(): ...
Set to zero, though that seems like a longshot...
|
|
I've confirmed this same behavior in VS2005, so I was wrong to call it a .NET (1.1) bug.
I'm leaving the original question below, but my revised question is this: how do I get Visual Studio to give me the stack trace of the exception I've caught and re...
Started by Mark Rushakoff on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Visual Studio will show the call stack of the place where it stops message, there is confusion (maybe not by you, but by others reading your message) between the stack trace of the error which is ....
The stacktrace of the inner exception.
|
|
I am running a program that I've written in Java in Eclipse. The program has a very deep level of recursion for very large inputs. For smaller inputs the program runs fine however when large inputs are given, I get the following error:
Exception in thread...
Started by tree-hacker on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
It may be curable by increasing the stack size - but a better solution would really be guessing at how much stack to....
You can also increase stack size in mb by using -Xss1m for example .
Add the flag -Xss1024k in the VM Arguments.
|
|
I've been trying to find an answer to this question for a few hours now on the web and on this site, and I'm not quite there.
I understand that .NET allocates 1MB to apps, and that it's best to avoid stack overflow by recoding instead of forcing stack...
Started by NateD on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
I would first....
The classic technique to avoid deep recursive stack dives is to simply avoid recursion by writing the algorithm iteratively and managing your own "stack the recursion completely.
On the heap instead of on the stack.
|
|
I'm trying to solve the problem of stacking objects into the most convenient size for postage. The size and shape of objects will be varied. Length, width and height of all objects is known.
For example a customer may order a (length x width x height)...
Started by Thrash on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
I believe the proper name for....
I don't think this is trivial.
You seem to have some nice ideas though! I would recommend reading about the Knapsack problem to get some more theory and new ideas .
This is not an easy problem and I guess it's even NP-hard .
|