mirror of
https://github.com/pybind/pybind11.git
synced 2026-05-05 14:11:43 +00:00
@@ -74,6 +74,11 @@ private:
|
||||
float *m_data;
|
||||
};
|
||||
|
||||
class SquareMatrix : public Matrix {
|
||||
public:
|
||||
SquareMatrix(ssize_t n) : Matrix(n, n) { }
|
||||
};
|
||||
|
||||
struct PTMFBuffer {
|
||||
int32_t value = 0;
|
||||
|
||||
@@ -141,6 +146,10 @@ test_initializer buffers([](py::module &m) {
|
||||
})
|
||||
;
|
||||
|
||||
// Derived classes inherit the buffer protocol and the buffer access function
|
||||
py::class_<SquareMatrix, Matrix>(m, "SquareMatrix")
|
||||
.def(py::init<ssize_t>());
|
||||
|
||||
py::class_<PTMFBuffer>(m, "PTMFBuffer", py::buffer_protocol())
|
||||
.def(py::init<>())
|
||||
.def_readwrite("value", &PTMFBuffer::value)
|
||||
|
||||
Reference in New Issue
Block a user