misg

Untitled

May 13th, 2016
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <boost/python.hpp>
  2. #include <string>
  3.  
  4. #define MODULE BOOST_PYTHON_MODULE
  5.  
  6. namespace py = boost::python;
  7.  
  8. namespace Export
  9. {
  10.     template<typename T>
  11.     void class_aux(T& cls)
  12.     {
  13.         return;
  14.     }
  15.  
  16.     template<typename T, typename F0_str, typename F0, typename... Fn>
  17.     void class_aux(T& cls, F0_str f0_str, F0 f0, Fn... fn)
  18.     {
  19.         cls = cls.def(f0_str, f0);
  20.  
  21.         class_aux(cls, fn...);
  22.     }
  23.    
  24.     template<typename T, typename... Fn>
  25.     void class_(std::string name, Fn... fn)
  26.     {
  27.         py::class_<T> cls(name.c_str());
  28.  
  29.         class_aux(cls, fn...);
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment