s <- cpp_set(11:20)
to_r(s)
# [1] 11 12 13 14 15 16 17 18 19 20
to_r(s, n = 4)
# [1] 11 12 13 14
to_r(s, n = -4)
# [1] 20 19 18 17
to_r(s, from = 14)
# [1] 14 15 16 17 18 19 20
to_r(s, to = 18)
# [1] 11 12 13 14 15 16 17 18
to_r(s, from = 14, to = 18)
# [1] 14 15 16 17 18
m <- cpp_unordered_multimap(c("hello", "hello", "there"), 4:6)
to_r(m)
# key value
# 1 there 6
# 2 hello 4
# 3 hello 5
s <- cpp_stack(11:20)
to_r(s, n = 3)
# [1] 20 19 18
s
# Top element: 17
Run the code above in your browser using DataLab