1 #ifndef CPP_FUNCTION_LIB_H
2 #define CPP_FUNCTION_LIB_H
3 
4 #include <functional>
5 
6 // Functions, functor and a holder of std::function used by cpp_stl_function.pyx tests.
7 
8 double add_one(double a, int b);
9 double add_two(double a, int b);
10 
11 class AddAnotherFunctor
12 {
13     double to_add;
14 
15 public:
16     AddAnotherFunctor(double to_add);
17     double operator()(double a, int b) const;
18 };
19 
20 
21 class FunctionKeeper
22 {
23     std::function<double(double, int)> my_function;
24 
25 public:
26     FunctionKeeper(std::function<double(double, int)> user_function);
27     virtual ~FunctionKeeper();
28 
29     void set_function(std::function<double(double, int)> user_function);
30     std::function<double(double, int)> get_function() const;
31 
32     double call_function(double a, int b) const;
33 };
34 
35 #endif
36