| cpp_deque | R Documentation |
Create a deque, i.e. a double-ended queue.
cpp_deque(x)
x |
An integer, numeric, character, or logical vector. |
C++ deque methods implemented in this package are assign, at, back, clear, emplace, emplace_back, emplace_front, empty, erase, front, insert, max_size, pop_back, pop_front, push_back, push_front, resize, shrink_to_fit, and size. The package also adds the == and [ operators and various helper functions (print, to_r, type).
All object-creating methods in this package begin with cpp_ to avoid clashes with functions from other packages, such as utils::stack and
base::vector.
Returns a CppDeque object referencing a deque in C++.
cpp_vector, cpp_forward_list, cpp_list.
d <- cpp_deque(4:6)
d
# 4 5 6
push_back(d, 1L)
d
# 4 5 6 1
push_front(d, 2L)
d
# 2 4 5 6 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.