powered by
Add elements to the top of a stack, to the back of a queue, or to a priority queue by reference.
push(x, values)
Invisibly returns NULL.
NULL
A CppStack, CppQueue, or CppPriorityQueue object.
Values to add to x.
x
The method iterates through values starting at the front of the vector. I.e., the last element of values is added last.
values
back, emplace, front, pop, push, top.
s <- cpp_stack(1:4) s # Top element: 4 push(s, 8:9) s # Top element: 9
Run the code above in your browser using DataLab