front: Access first element

frontR Documentation

Access first element

Description

Access first element in a container without removing it.

Usage

front(x)

Arguments

x

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

Value

Returns the front element.

See Also

back, emplace_front, pop, pop_front, push_front.

Examples

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


cppcontainers documentation built on Sept. 9, 2025, 5:55 p.m.