Learn R Programming

cppcontainers (version 1.0.4)

emplace_after: Add an element

Description

Add an element to a forward list by reference in place.

Usage

emplace_after(x, value, position)

Value

Invisibly returns NULL.

Arguments

x

A CppForwardList object.

value

Value to add to x.

position

Index after which to insert the element. Indices start at 1. The function does not perform bounds checks. Indices outside x crash the program.

Details

The emplace methods only add single elements. Use insert to add multiple elements in one call.

See Also

emplace, emplace_back, emplace_front, insert.

Examples

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

emplace_after(l, 10L, 2)
l
# 4 5 10 6

Run the code above in your browser using DataLab