Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Cython / tests / build / cpp_cythonize.srctree
Size: Mime:
# tag: cpp

PYTHON setup.py build_ext --inplace
PYTHON -c "import a; a.use_vector([1,2,3])"

######## setup.py ########

from Cython.Build.Dependencies import cythonize

from distutils.core import setup

setup(
    ext_modules = cythonize("*.pyx"),
)

######## a.pyx ########

# distutils: language=c++

from libcpp.vector cimport vector

def use_vector(L):
    try:
        v = new vector[int]()
        for a in L:
            v.push_back(a)
        return v.size()
    finally:
        del v