Learn R Programming

cppcontainers (version 1.0.4)

erase_after: Erase elements

Description

Delete elements from a forward list by reference.

Usage

erase_after(x, from, to)

Value

Invisibly returns NULL.

Arguments

x

A CppForwardList object.

from

Index after which to delete.

to

Index until including which to delete. Indices start at 1. The function does not perform bounds checks. Indices outside x crash the program.

See Also

clear, empty, erase, remove..

Examples

Run this code
l <- cpp_forward_list(4:9)
l
# 4 5 6 7 8 9

erase_after(l, 2L, 4L)
l
# 4 5 8 9

Run the code above in your browser using DataLab