Merge pull request #2047 from borglab/fix/concept-usage

Use `GTSAM_CONCEPT_USAGE` in lieu of `BOOST_CONCEPT_USAGE`
release/4.3a0
Varun Agrawal 2025-03-14 16:11:53 -04:00 committed by GitHub
commit 528c2ee58d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 10 additions and 9 deletions

View File

@ -45,7 +45,7 @@ public:
typedef typename traits<G>::group_flavor flavor_tag; typedef typename traits<G>::group_flavor flavor_tag;
//typedef typename traits<G>::identity::value_type identity_value_type; //typedef typename traits<G>::identity::value_type identity_value_type;
BOOST_CONCEPT_USAGE(IsGroup) { GTSAM_CONCEPT_USAGE(IsGroup) {
static_assert( static_assert(
(std::is_base_of<group_tag, structure_category_tag>::value), (std::is_base_of<group_tag, structure_category_tag>::value),
"This type's structure_category trait does not assert it as a group (or derived)"); "This type's structure_category trait does not assert it as a group (or derived)");

View File

@ -282,7 +282,7 @@ public:
typedef typename traits<T>::TangentVector TangentVector; typedef typename traits<T>::TangentVector TangentVector;
typedef typename traits<T>::ChartJacobian ChartJacobian; typedef typename traits<T>::ChartJacobian ChartJacobian;
BOOST_CONCEPT_USAGE(IsLieGroup) { GTSAM_CONCEPT_USAGE(IsLieGroup) {
static_assert( static_assert(
(std::is_base_of<lie_group_tag, structure_category_tag>::value), (std::is_base_of<lie_group_tag, structure_category_tag>::value),
"This type's trait does not assert it is a Lie group (or derived)"); "This type's trait does not assert it is a Lie group (or derived)");

View File

@ -61,7 +61,7 @@ struct HasManifoldPrereqs {
Eigen::Matrix<double, dim, 1> v; Eigen::Matrix<double, dim, 1> v;
OptionalJacobian<dim, dim> Hp, Hq, Hv; OptionalJacobian<dim, dim> Hp, Hq, Hv;
BOOST_CONCEPT_USAGE(HasManifoldPrereqs) { GTSAM_CONCEPT_USAGE(HasManifoldPrereqs) {
v = p.localCoordinates(q); v = p.localCoordinates(q);
q = p.retract(v); q = p.retract(v);
} }
@ -139,7 +139,7 @@ public:
typedef typename traits<T>::ManifoldType ManifoldType; typedef typename traits<T>::ManifoldType ManifoldType;
typedef typename traits<T>::TangentVector TangentVector; typedef typename traits<T>::TangentVector TangentVector;
BOOST_CONCEPT_USAGE(IsManifold) { GTSAM_CONCEPT_USAGE(IsManifold) {
static_assert( static_assert(
(std::is_base_of<manifold_tag, structure_category_tag>::value), (std::is_base_of<manifold_tag, structure_category_tag>::value),
"This type's structure_category trait does not assert it as a manifold (or derived)"); "This type's structure_category trait does not assert it as a manifold (or derived)");

View File

@ -61,7 +61,7 @@ namespace gtsam {
bool r1,r2; bool r1,r2;
public: public:
BOOST_CONCEPT_USAGE(IsTestable) { GTSAM_CONCEPT_USAGE(IsTestable) {
// check print function, with optional string // check print function, with optional string
traits<T>::Print(t, std::string()); traits<T>::Print(t, std::string());
traits<T>::Print(t); traits<T>::Print(t);
@ -134,7 +134,7 @@ namespace gtsam {
template<typename T> template<typename T>
struct HasTestablePrereqs { struct HasTestablePrereqs {
BOOST_CONCEPT_USAGE(HasTestablePrereqs) { GTSAM_CONCEPT_USAGE(HasTestablePrereqs) {
t->print(str); t->print(str);
b = t->equals(*s,tol); b = t->equals(*s,tol);
} }

View File

@ -177,7 +177,7 @@ struct HasVectorSpacePrereqs {
Class p, q; Class p, q;
Vector v; Vector v;
BOOST_CONCEPT_USAGE(HasVectorSpacePrereqs) { GTSAM_CONCEPT_USAGE(HasVectorSpacePrereqs) {
p = Class::Identity(); // identity p = Class::Identity(); // identity
q = p + p; // addition q = p + p; // addition
q = p - p; // subtraction q = p - p; // subtraction
@ -492,7 +492,7 @@ public:
typedef typename traits<T>::structure_category structure_category_tag; typedef typename traits<T>::structure_category structure_category_tag;
BOOST_CONCEPT_USAGE(IsVectorSpace) { GTSAM_CONCEPT_USAGE(IsVectorSpace) {
static_assert( static_assert(
(std::is_base_of<vector_space_tag, structure_category_tag>::value), (std::is_base_of<vector_space_tag, structure_category_tag>::value),
"This type's trait does not assert it as a vector space (or derived)"); "This type's trait does not assert it as a vector space (or derived)");

View File

@ -17,9 +17,10 @@
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
#define GTSAM_CONCEPT_ASSERT(concept) BOOST_CONCEPT_ASSERT((concept)) #define GTSAM_CONCEPT_ASSERT(concept) BOOST_CONCEPT_ASSERT((concept))
#define GTSAM_CONCEPT_REQUIRES(concept, return_type) BOOST_CONCEPT_REQUIRES(((concept)), (return_type)) #define GTSAM_CONCEPT_REQUIRES(concept, return_type) BOOST_CONCEPT_REQUIRES(((concept)), (return_type))
#define GTSAM_CONCEPT_USAGE BOOST_CONCEPT_USAGE
#else #else
// This does something sensible: // This does something sensible:
#define BOOST_CONCEPT_USAGE(concept) void check##concept() #define GTSAM_CONCEPT_USAGE(concept) void check##concept()
// These just ignore the concept checking for now: // These just ignore the concept checking for now:
#define GTSAM_CONCEPT_ASSERT(concept) static_assert(true, "") #define GTSAM_CONCEPT_ASSERT(concept) static_assert(true, "")
#define GTSAM_CONCEPT_REQUIRES(concept, return_type) return_type #define GTSAM_CONCEPT_REQUIRES(concept, return_type) return_type