ARTS 打卡 -05

Algorithm
Question: Reverse String
Performance: runtime beats 66.27%, memory beats 62.28%.
Review
Simplified Wrapper and Interface Generator (SWIG) is an interface compiler that connects programs written in C and C++ with scripting languages such as Perl, Python, Ruby, and Tcl. It works by taking the declarations found in C/C++ header files and using them to generate the wrapper code that scripting languages need to access the underlying C/C++ code. In addition, SWIG provides a variety of customization features that let you tailor the wrapping process to suit your application.
John Ousterhout (creator of Tcl) has written a paper that describes the benefits of scripting languages. SWIG makes it fairly easy to connect scripting languages with C/C++ code.
Tips
Some useful commands when debugging the building errors:


Share
How to use SWIG to call OpenCV c++ code in python
c++ code: postprocess.cpp, postprocess.hpp
SWIG file: postprocess.i
setup.py
Command:
So far, folder looks like this:

Now you can use postprocess like below:
评论