<initializer_list> in Cython

Viewed 105

Can <initializer_list>s be directly declared for use in Cython constructors?

As I understand, this is possible:

# Cython
cdef int[3] li = [1, 2, 3]  

# C++
int[3] li = {1, 2, 3}

But similar syntax for the std::vector class like

cdef vector[int] * li = new vector[int]([1,2,3]) 

that uses the <initializer_list> constructor (6) seems unsupported by libcpp.vector.

Can one declare Cython constructors like the one above, in which [1, 2, 3] is interpreted as <initializer_list>? If so, how?

0 Answers
Related