This source file includes following definitions.
- floordiv
 
- add_operators_with
 
- add_operators
 
#ifndef ADD_OPERATORS_H
#define ADD_OPERATORS_H
#include <boost/python/operators.hpp>
#include <boost/python/self.hpp>
template <typename A, typename B, typename WrappedType>
auto floordiv(A a, B b) -> decltype(a / b) {
    
    
    
    
    return a / b;
}
template <typename PythonClass, typename T>
void add_operators_with(PythonClass &class_instance) {
    using namespace boost::python;
    typedef typename PythonClass::wrapped_type wrapped_t;
    
    class_instance
        .def(self + other<T>())
        .def(other<T>() + self)
        .def(self - other<T>())
        .def(other<T>() - self)
        .def(self * other<T>())
        .def(other<T>() * self)
        .def(self / other<T>())
        .def(other<T>() / self)
        .def(self % other<T>())
        .def(other<T>() % self)
        .def(pow(self, other<T>()))
        .def(pow(other<T>(), self))
        .def(self & other<T>())  
        .def(other<T>() & self)
        .def(self | other<T>())  
        .def(other<T>() | self)
        .def(self < other<T>())
        .def(other<T>() < self)
        .def(self <= other<T>())
        .def(other<T>() <= self)
        .def(self == other<T>())
        .def(other<T>() == self)
        .def(self != other<T>())
        .def(other<T>() != self)
        .def(self > other<T>())
        .def(other<T>() > self)
        .def(self >= other<T>())
        .def(other<T>() >= self)
        .def(self >> other<T>())
        .def(other<T>() >> self)
        .def(self << other<T>())
        .def(other<T>() << self)
        .def("__floordiv__", &floordiv<wrapped_t, T, wrapped_t>)
        .def("__floordiv__", &floordiv<T, wrapped_t, wrapped_t>)
        ;
    return;
}
template <typename PythonClass>
void add_operators(PythonClass &class_instance) {
    using namespace boost::python;
    typedef typename PythonClass::wrapped_type wrapped_t;
    
    
    add_operators_with<PythonClass, wrapped_t>(class_instance);
    add_operators_with<PythonClass, float>(class_instance);
    add_operators_with<PythonClass, int>(class_instance);
    
    
    class_instance
        .def(-self)  
        
        .def(~self)  
        
        
        ;
    return;
}
#endif