py::builtins::list::clear

void clear();

Clears the list.

Complexity

Linear in the size of the list.

Example

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

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

    list.clear();

    py::print(list);
}

Output:

{0, 1}
{}