py::builtins::list::reverse

void reverse();

Reverses 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, 0, 1, 3};
    py::print(list);

    list.reverse(true);

    py::print(list);
}

Output:

{0, 0, 1, 3}
{3, 1, 0, 0}