merge {cppcontainers} | R Documentation |
Merge two objects
Description
Merge two objects by reference.
Usage
merge(x, y, ...)
Arguments
x |
A CppSet, CppUnorderedSet, CppMultiset, CppUnorderedMultiset, CppMap, CppUnorderedMap, CppMultimap, CppUnorderedMultimap, CppForwardList, or CppList object. |
y |
A CppSet, CppUnorderedSet, CppMultiset, CppUnorderedMultiset, CppMap, CppUnorderedMap, CppMultimap, CppUnorderedMultimap, CppForwardList, or
CppList object of the same class and data type as |
... |
Ignored. Only included for compatibility with generic |
Details
In containers enforcing uniqueness (CppSet, CppUnorderedSet, CppMap, CppUnorderedMap), the function merges elements from y
that are not
in x
into x
and deletes them from y
. In other container types, it transfers all elements.
Value
Invisibly returns NULL
.
See Also
Examples
x <- cpp_set(c("hello", "there"))
y <- cpp_set(c("hello", "world"))
merge(x, y)
x
# "hello" "there" "world"
y
# "hello"
x <- cpp_forward_list(c(1, 3, 4, 3))
y <- cpp_forward_list(c(2, 3, 5))
merge(x, y)
x
# 1 2 3 3 4 3 5
y
#
[Package cppcontainers version 1.0.0 Index]