Skip to content

Commit 3e36c87

Browse files
musshornwjakob
authored andcommitted
Add Size to lambda capture
1 parent 07a8424 commit 3e36c87

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/vector.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ auto register_vector_type(py::module &m, const char *name) {
1717

1818
array.def(py::init<Value>())
1919
.def(py::init<const Array &>())
20-
.def(py::init([](const std::array<Value, Size> &arr) {
20+
.def(py::init([Size](const std::array<Value, Size> &arr) {
2121
Array a;
2222
for (size_t i = 0; i < Size; ++i)
2323
a[i] = arr[i];
@@ -37,12 +37,12 @@ auto register_vector_type(py::module &m, const char *name) {
3737
.def(py::self -= py::self)
3838
.def(py::self *= py::self)
3939
.def(py::self /= py::self)
40-
.def("__getitem__", [](const Array &a, size_t index) -> Value {
40+
.def("__getitem__", [Size](const Array &a, size_t index) -> Value {
4141
if (index >= Size)
4242
throw py::index_error();
4343
return a[index];
4444
}, "index"_a)
45-
.def("__setitem__", [](Array &a, size_t index, Value value) {
45+
.def("__setitem__", [Size](Array &a, size_t index, Value value) {
4646
if (index >= Size)
4747
throw py::index_error();
4848
a[index] = value;
@@ -51,7 +51,7 @@ auto register_vector_type(py::module &m, const char *name) {
5151
[](Array &a, const Value &v) { a.x() = v; })
5252
.def_property("y", [](const Array &a) { return a.y(); },
5353
[](Array &a, const Value &v) { a.y() = v; })
54-
.def_buffer([](Array &m) -> py::buffer_info {
54+
.def_buffer([Size](Array &m) -> py::buffer_info {
5555
return py::buffer_info(
5656
m.v, // Pointer to buffer
5757
sizeof(Value), // Size of one scalar

0 commit comments

Comments
 (0)