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); } /// @}