From 8254e91e386447c7f4ad0bb09c5189dc252a8a66 Mon Sep 17 00:00:00 2001 From: NAUD Maxence <maxence.naud@cea.fr> Date: Tue, 27 Aug 2024 14:32:09 +0000 Subject: [PATCH] make const value to const ref parameters --- python_binding/data/pybind_Tensor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python_binding/data/pybind_Tensor.cpp b/python_binding/data/pybind_Tensor.cpp index d4d6edc9c..73a55d461 100644 --- a/python_binding/data/pybind_Tensor.cpp +++ b/python_binding/data/pybind_Tensor.cpp @@ -257,7 +257,7 @@ static void addScalarCtor(pyTensorClass& mTensor) { // though it is not merged: https://github.com/pybind/pybind11/pull/3544/. // Hence we use some helper functions defined above to try matching the different numpy scalar types. mTensor.def(py::init([](py::object obj, - const std::string backend="cpu") { + const std::string& backend = "cpu") { NativeValue native_val; DataType native_dtype; bool found = getScalarNativeVal(obj, &native_val, &native_dtype); @@ -283,7 +283,7 @@ static void addScalarCtor(pyTensorClass& mTensor) { template<typename T> void addArrayCtor(pyTensorClass& mTensor) { mTensor.def(py::init([](const py::array_t<T, py::array::c_style|py::array::forcecast> b, - const std::string backend = "cpu") { + const std::string& backend = "cpu") { /* Request a buffer descriptor from Python */ py::buffer_info info = b.request(); Tensor* newTensor = new Tensor(); -- GitLab