How to traverse stack in C

0 votes

Is traversing std::stack possible in C++?

It is not possible to traverse using the following method. 

Because there is no member end in std::stack.

std::stack<int> foo;

// ..

for (__typeof(foo.begin()) it = foo.begin(); it != foo.end();  it++)
{
    // ...
}
Jun 1, 2022 in C++ by Nicholas
• 7,760 points
1,624 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In C++

0 votes
1 answer

How to use std::sort to sort an array in C++

We receive std::begin and std::end in C++0x/11, which are overloaded for arrays: #include <algorithm> int main(){ int v[2000]; ...READ MORE

answered Jun 1, 2022 in C++ by Damon
• 4,960 points
889 views
0 votes
1 answer

How to use new[ ] and delete[ ] operator in C++

int main(){ char *str; ...READ MORE

answered Jun 20, 2022 in C++ by Damon
• 4,960 points
357 views
0 votes
1 answer

How to use enums in C++

This will be sufficient to declare your ...READ MORE

answered Jun 20, 2022 in C++ by Damon
• 4,960 points
393 views
0 votes
1 answer

How to convert string to char array in C++?

Simplest way I can think of doing ...READ MORE

answered Jun 20, 2022 in C++ by Damon
• 4,960 points
4,787 views
0 votes
0 answers

How to use setprecision in C++

I'm new to C++ and all I want to do is print my point number up to two digits.  For example, if the number is 3.444, the output should be 3.44, and if the number is 99999.4234, the output should be 99999.42.  How am I going to do that?  The value changes over time.  This is my code. #include <iomanip.h> #include <iomanip> int main() { ...READ MORE

Jul 5, 2022 in C++ by Nicholas
• 7,760 points
493 views
0 votes
0 answers

How to use enums in C++

Suppose we have an enum like the following: enum Days ...READ MORE

Jul 7, 2022 in C++ by Nicholas
• 7,760 points
383 views
0 votes
0 answers

Infix to Postfix notation C++

Hello there, Stack.  I'm currently learning C++ and trying to create an RPN converter.  But I'm having difficulties.  Hopefully, I'll be able to describe the issues in detail.  For stacking my operators, I'm using an array.  Let's look at the example "5 + 8."  When it comes down to: else if(infix[i] == '+' or infix[i] == ...READ MORE

Jun 29, 2022 in C++ by Nicholas
• 7,760 points
659 views
0 votes
1 answer

setuptools: build shared libary from C++ code, then build Cython wrapper linked to shared libary

There is a seemingly undocumented feature of setup that ...READ MORE

answered Sep 11, 2018 in Python by Priyaj
• 58,090 points
491 views
0 votes
1 answer

setuptools: build shared libary from C++ code, then build Cython wrapper linked to shared libary

There is a seemingly undocumented feature of setup that ...READ MORE

answered Sep 21, 2018 in Python by Priyaj
• 58,090 points
2,134 views
0 votes
1 answer

How to pass large records to map/reduce tasks?

Hadoop is not designed for records about ...READ MORE

answered Sep 25, 2018 in Big Data Hadoop by Frankie
• 9,830 points
1,210 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP