Utilities.hh 314 Bytes
Newer Older
Alexander Dielen's avatar
Alexander Dielen committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef OPENMESH_PYTHON_UTILITIES_HH
#define OPENMESH_PYTHON_UTILITIES_HH

#include <pybind11/pybind11.h>
namespace py = pybind11;


template<class dtype>
py::capsule free_when_done(dtype *data) {
	return 	py::capsule(data, [](void *f) {
		dtype *ptr = reinterpret_cast<dtype *>(f);
		delete[] ptr;
	});
}

#endif