C++ 11 code to automatically create Matlab mex function based on generic C++ functions