Learn R Programming

cppcontainers (version 1.0.4)

push: 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)

Value

Invisibly returns NULL.

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.

See Also

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

Examples

Run this code
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