Here’s the deal. I am trying to build an EditorBuffer class (for text editing of a single line).
The class consists of two stacks of characters (stack<char> before , stack<char> after) where the before stack represents all the characters which are situated before the “cursor” while the after stack represents all the characters after the “cursor”. In the declaration shown below i got the error error: Invalid use of void expression which is totally alien to me.
Here is the method declaration:
void EditorBuffer::moveCursorToEnd()
{
while (!after.empty())
{
before.push(after.pop());
}
}
std::stack::pop()doesn’t return anything (its return type isvoid). You probably want to do: