pop {cppcontainers} | R Documentation |
Remove top element
Description
Remove top element in a stack or priority queue or the first element in a queue by reference.
Usage
pop(x)
Arguments
x |
A CppStack, CppQueue, or CppPriorityQueue object. |
Details
In a stack, it is the last inserted element. In a queue, it is the first inserted element. In a descending (ascending) priority queue, it is the largest (smallest) value.
Value
Invisibly returns NULL
.
See Also
back, emplace, front, push, top.
Examples
s <- cpp_stack(4:6)
s
# Top element: 6
pop(s)
s
# Top element: 5
q <- cpp_queue(4:6)
q
# First element: 4
pop(q)
q
# First element: 5
p <- cpp_priority_queue(4:6)
p
# First element: 6
pop(p)
p
# First element: 5
[Package cppcontainers version 1.0.0 Index]