Commit ec8089cd authored by Alexander Dielen's avatar Alexander Dielen
Browse files

placement-new constructors are deprecated

parent dbcca72f
...@@ -195,12 +195,12 @@ void expose_vec(py::module& m, const char *_name) { ...@@ -195,12 +195,12 @@ void expose_vec(py::module& m, const char *_name) {
.def_static("size", &Vector::size) .def_static("size", &Vector::size)
.def_static("vectorized", &Vector::vectorized) .def_static("vectorized", &Vector::vectorized)
.def("__init__", [](Vector& _self, py::array_t<Scalar, py::array::c_style | py::array::forcecast> _arr) { .def(py::init([](py::array_t<Scalar, py::array::c_style | py::array::forcecast> _arr) {
if (_arr.size() != N) { if (_arr.size() != N) {
throw std::runtime_error("Incompatible array size!"); throw std::runtime_error("Incompatible array size!");
} }
new (&_self) Vector(_arr.data()); return Vector(_arr.data());
}); }));
; ;
defInitMod<Scalar, Vector>(m, classVector); defInitMod<Scalar, Vector>(m, classVector);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment