py::builtins::list::list¶
list(); // 1
template <class array_t>
explicit list(const array_t& array); // 2
list(const std::initializer_list<type>& array); // 3
list(const list& other); // 4
list(list&& other); // 5
Constructs an empty list.
Constructs a list from another iterable object.
Constructs a list from a initializer list.
Copy constructs a list.
Move constructs a list.
Template parameters¶
array_t: The type of another iterable object.
Parameters¶
array: (2): another iterable object, (3): an initializer
list.
other: Another py::builtins::list object.
Complexity¶
Constant.
Linear in the size of
array.Same as (2).
Linear in the size of
other.Constant.
Example¶
#include <pypp/builtins/list.hpp>
#include <pypp/builtins/print.hpp>
int main()
{
// Default constructor
py::list<int> list;
py::print(list); // No output...
py::list<int> list2 = {0, 1, 2, 3, 4, 5, 6};
py::print(list2);
}
Output:
{}
{0, 1, 2, 3, 4, 5, 6}