Ok, I have:
std::stack<char, vector<char>> opStack;
int i(0);
std::string tempStr;
Why cant I use opStack[index]?
The code:
if(opStack[ i ]=='/'||opStack[ i ]=='*')
tempStr+opStack[ i ];
The error:
source.cpp(156) : error C2676: binary '[' : 'class std::stack<char,class std::vector<char,class std::allocator<char> > >' does not define this operator or a conversion to a type acceptable to the predefined operator
I thought the whole point of an adaptor was to inherit methods from another class instead of being a strict stack. Otherwise, what is the point of even having it?
I need some way to iterate throught the stack in reverse, starting at 0 and going to stack.size()-1, please help me.
Edit: Part of it was being interpreted as bbcode
The stack needed to act like a stack except for one very specific instance. In this instance, the stack needed to be reversed and items in it taken out based on precedence (* or /) or (+ or -). I solved it by using two more stacks to reverse, and if statements to determine which stack to pop too.
std::stack<char, vector<char>> opStack;
int i(0);
std::string tempStr;
Why cant I use opStack[index]?
The code:
if(opStack[ i ]=='/'||opStack[ i ]=='*')
tempStr+opStack[ i ];
The error:
source.cpp(156) : error C2676: binary '[' : 'class std::stack<char,class std::vector<char,class std::allocator<char> > >' does not define this operator or a conversion to a type acceptable to the predefined operator
I thought the whole point of an adaptor was to inherit methods from another class instead of being a strict stack. Otherwise, what is the point of even having it?
I need some way to iterate throught the stack in reverse, starting at 0 and going to stack.size()-1, please help me.
Edit: Part of it was being interpreted as bbcode
The stack needed to act like a stack except for one very specific instance. In this instance, the stack needed to be reversed and items in it taken out based on precedence (* or /) or (+ or -). I solved it by using two more stacks to reverse, and if statements to determine which stack to pop too.