Skip to main content
11 events
when toggle format what by license comment
May 23, 2017 at 12:41 history edited CommunityBot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Jul 26, 2013 at 4:38 comment added Lstor @AnmolSinghJaggi std::stack is by default implemented on top of a std::deque, which uses an array. (C++11 standard section 23.3.3.1.1: A deque is a sequence container that, like a vector , supports random access iterators.) Using an array gives locality of reference, random access (accessing index n is O(1) instead of O(n)), and so on.
Jul 26, 2013 at 4:13 vote accept Anmol Singh Jaggi
Jul 26, 2013 at 4:15
Jul 26, 2013 at 4:07 history edited Jamal CC BY-SA 3.0
added 2027 characters in body
Jul 26, 2013 at 3:40 comment added Anmol Singh Jaggi Some other things too! -: 4). Will there be any performance gain if i use a dynamic array instead of a "linked list type structure"?? ( besides the 3x performance gain in the copy constructor) 5). What difference does it make if I use empty() instead of comparison with NULL
Jul 26, 2013 at 3:39 comment added Jamal @AnmolSinghJaggi: I'll follow-up on this right now.
Jul 26, 2013 at 3:32 comment added Anmol Singh Jaggi @Jamal Thanks for taking the time to review my code!!.. Your answer was very helpful.However,I am not able to understand few things in it -: 1). What is this full you are talking about?? 2). How can iterators be used to improve the output process?? 3). Could you please show me a demo on how to make mystack_node as a private struct of mystack?? [ I tried to shift the structure inside the class (as a normal struct and not as a template ), but then the output operator wasn't able to see mystack_node *temp!! ( and i don't know how to fix it )]
Jul 26, 2013 at 2:13 history edited Jamal CC BY-SA 3.0
added 1199 characters in body
Jul 26, 2013 at 1:46 comment added Jamal @Lstor: Oh, right. Forgot about that. I'm still working on my answer.
Jul 26, 2013 at 1:45 comment added Lstor op= taking a parameter by value and then swapping it is the copy-and-swap idiom he is talking about. It should be like he wrote.
Jul 26, 2013 at 1:41 history answered Jamal CC BY-SA 3.0