blob: ba6694cb943abb07b34ff48807c5ee3959ad7783 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
from libcpp.functional cimport function
cdef extern from "cpp_function_lib.cpp":
# CPP is include here so that it doesn't need to be compiled externally
pass
cdef extern from "cpp_function_lib.h":
double add_one(double, int)
double add_two(double a, int b)
cdef cppclass AddAnotherFunctor:
AddAnotherFunctor(double to_add)
double call "operator()"(double a, int b)
cdef cppclass FunctionKeeper:
FunctionKeeper(function[double(double, int) noexcept] user_function)
void set_function(function[double(double, int) noexcept] user_function)
function[double(double, int) noexcept] get_function()
double call_function(double a, int b) except +
|