Error while passing a reference of a vector to a function.
First of all , I can't understand the error message.
The function call looks like:
error: invalid initialization of non-const
reference of type ‘stack&’ from a temporary of
type ‘std::vector<sub, std::allocator<sub> >
And the declaration of the function looks like:
flag = operate(&stack,&temp);
//where stack is a vector<sub>
//and temp is an object of class '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.