First of all , I can't understand the error message.
Code:
error: invalid initialization of non-const
reference of type ‘stack&’ from a temporary of
type ‘std::vector<sub, std::allocator<sub> >
The function call looks like:
Code:
flag = operate(&stack,&temp);
//where stack is a vector<sub>
//and temp is an object of class 'sub'
And the declaration of the function looks like:
Code:
bool operate(std::vector<sub>&,sub&);
I am literally at my wits end.. But this works fine if the whole stack is passed and returned from the function , which would have a large overhead in case the stack is big enough.