top {cppcontainers}R Documentation

Access top element

Description

Access the top element in a container without removing it.

Usage

top(x)

Arguments

x

A CppStack or CppPriorityQueue object.

Value

Returns the top element.

See Also

emplace, pop, push.

Examples

s <- cpp_stack(1:4)
s
# Top element: 4

top(s)
# [1] 4

s
# Top element: 4


[Package cppcontainers version 1.0.0 Index]