py::builtins::list::pop¶
value_type pop(long index = -1);
Removes the element at given index (the last element by default).
Parameters¶
index: The index of the element.
Return value¶
The removed element.
Complexity¶
Same as the complexity of std::vector::erase.
Example¶
#include <pypp/builtins/list.hpp>
#include <pypp/builtins/print.hpp>
int main()
{
py::list<int> list = {0, 1};
py::print(list);
list.pop();
py::print(list);
}
Output:
{0, 1}
{0}