push {cppcontainers}R Documentation

Add elements

Description

Add elements to the top of a stack, to the back of a queue, or to a priority queue by reference.

Usage

push(x, values)

Arguments

x

A CppStack, CppQueue, or CppPriorityQueue object.

values

Values to add to x.

Details

The method iterates through values starting at the front of the vector. I.e., the last element of values is added last.

Value

Invisibly returns NULL.

See Also

back, emplace, front, pop, push, top.

Examples

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

push(s, 8:9)
s
# Top element: 9


[Package cppcontainers version 1.0.0 Index]