From 4cc2e22b59515767f79d41934c99749116521fa0 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Tue, 29 Apr 2025 00:20:04 -0400 Subject: [PATCH] Add value to concepts --- gtsam/base/Lie.h | 6 +++++- gtsam/base/Manifold.h | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gtsam/base/Lie.h b/gtsam/base/Lie.h index 5b3173b37..4248f16b2 100644 --- a/gtsam/base/Lie.h +++ b/gtsam/base/Lie.h @@ -277,6 +277,10 @@ inline Class expmap_default(const Class& t, const Vector& d) { template class IsLieGroup: public IsGroup, public IsManifold { public: + // Concept marker: allows checking IsLieGroup::value in templates + static constexpr bool value = + std::is_base_of::structure_category>::value; + typedef typename traits::structure_category structure_category_tag; typedef typename traits::ManifoldType ManifoldType; typedef typename traits::TangentVector TangentVector; @@ -284,7 +288,7 @@ public: GTSAM_CONCEPT_USAGE(IsLieGroup) { static_assert( - (std::is_base_of::value), + value, "This type's trait does not assert it is a Lie group (or derived)"); // group operations with Jacobians diff --git a/gtsam/base/Manifold.h b/gtsam/base/Manifold.h index 80a9cd166..18ae9b616 100644 --- a/gtsam/base/Manifold.h +++ b/gtsam/base/Manifold.h @@ -138,10 +138,13 @@ public: static const int dim = traits::dimension; typedef typename traits::ManifoldType ManifoldType; typedef typename traits::TangentVector TangentVector; + // Concept marker: allows checking IsManifold::value in templates + static constexpr bool value = + std::is_base_of::value; GTSAM_CONCEPT_USAGE(IsManifold) { static_assert( - (std::is_base_of::value), + value, "This type's structure_category trait does not assert it as a manifold (or derived)"); static_assert(TangentVector::SizeAtCompileTime == dim);