From 4708d7ad0e502e62cc88c38f1c1049c52dad1c35 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Mon, 17 May 2021 14:40:17 -0400 Subject: [PATCH] Add comment on functor signature --- gtsam/nonlinear/CustomFactor.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gtsam/nonlinear/CustomFactor.h b/gtsam/nonlinear/CustomFactor.h index 9d9db9eda..34cb5ad51 100644 --- a/gtsam/nonlinear/CustomFactor.h +++ b/gtsam/nonlinear/CustomFactor.h @@ -27,6 +27,14 @@ typedef std::vector JacobianVector; class CustomFactor; +/* + * NOTE + * ========== + * pybind11 will invoke a copy if this is `JacobianVector &`, and modifications in Python will not be reflected. + * + * This is safe because this is passing a const pointer, and pybind11 will maintain the `std::vector` memory layout. + * Thus the pointer will never be invalidated. + */ typedef std::function CustomErrorFunction; /**