From f2efe97f418b63a5facb0f8b8dfdfb6e76ed268e Mon Sep 17 00:00:00 2001 From: kartik arcot Date: Wed, 4 Jan 2023 16:50:47 -0800 Subject: [PATCH] type checking works now --- gtsam/nonlinear/NonlinearFactor.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/gtsam/nonlinear/NonlinearFactor.h b/gtsam/nonlinear/NonlinearFactor.h index 5409920d3..3be0a5f7c 100644 --- a/gtsam/nonlinear/NonlinearFactor.h +++ b/gtsam/nonlinear/NonlinearFactor.h @@ -40,7 +40,7 @@ namespace gtsam { #ifdef NO_BOOST_CPP17 // These typedefs and aliases will help with making the evaluateError interface // independent of boost -#define OptionalNone nullptr +using OptionalNone = nullptr; template using OptionalMatrixT = Matrix*; using OptionalMatrix = Matrix*; @@ -49,6 +49,7 @@ using OptionalMatrix = Matrix*; using OptionalMatrixVec = std::vector*; #else // creating a none value to use when declaring our interfaces +using OptionalNoneType = boost::none_t; #define OptionalNone boost::none template using OptionalMatrixT = boost::optional; @@ -618,16 +619,11 @@ protected: */ template > inline Vector evaluateError(const ValueTypes&... x, OptionalJacArgs&&... H) const { - /* constexpr bool are_all_opt_mat = (... && std::is_same>::value); */ - constexpr bool are_all_mat = - (... && (std::is_same>::value || - std::is_same>::value)); - static_assert(are_all_mat, "ERRORRR"); - /* if constexpr ((... && std::is_same>::value)) { */ - /* return evaluateError(x..., std::forward(H)..., boost::none); */ - /* } else if constexpr ((... && std::is_same>::value)) { */ - return evaluateError(x..., std::forward(H)..., boost::none); - /* } */ + constexpr bool are_all_mat = (... && (std::is_same>::value || + std::is_same>::value || + std::is_same>::value)); + static_assert(are_all_mat, "ERRORRR"); + return evaluateError(x..., std::forward(H)..., boost::none); } /// @}