Properly export size() in python if static or instance member
Exporting the size() member function of LocalFiniteElement classes is problematic if this function is either implemented as an instance member function or as a static class function. Pybind11 cannot handle this directly. The instance member expects the object as first argument, where the static function does not. This results in a python error
TypeError: size(): incompatible function arguments.
The proposed solution is to wrap the class in a lambda function with the object as first argument and then call the size() function. In c++, this is possible in both cases with the same syntax, as an instance member function.
Edited by Simon Praetorius