Learn R Programming

cppcontainers (version 1.0.4)

front: Access first element

Description

Access first element in a container without removing it.

Usage

front(x)

Value

Returns the front element.

Arguments

x

A CppQueue, CppVector, CppDeque, CppForwardList, or CppList object.

See Also

back, emplace_front, pop, pop_front, push_front.

Examples

Run this code
q <- cpp_queue(4:6)
q
# First element: 4

front(q)
# [1] 4

q
# First element: 4

v <- cpp_vector(c(TRUE, FALSE, FALSE))
v
# TRUE FALSE FALSE

front(v)
# [1] TRUE

Run the code above in your browser using DataLab