py::builtins::list::append

void append(const_reference element);                   // 1

void append(value_type&& element);                      // 2

Appends given element to the list.

Parameters

element: The element to append.

Complexity

Constant, plus linear in the size of the list if the insertion causes the memory to be reallocated.

Example

#include <pypp/builtins/list.hpp>
#include <pypp/builtins/print.hpp>

int main()
{
    py::list<int> list = {0, 1};

    py::print(list);

    list.append(2);

    py::print(list);
}

Output:

{0, 1}
{0, 1, 2}