Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overload +=, , operator #1558

Merged
merged 4 commits into from
Jul 17, 2023
Merged

Overload +=, , operator #1558

merged 4 commits into from
Jul 17, 2023

Conversation

varunagrawal
Copy link
Collaborator

Overloaded the += operator in the Ordering class so we can append keys as:

Ordering o;
o += key1;

Also overloaded the comma , operator, so we can append in a style similar to Boost's Assign module which was the previous way:

Ordering o;
o += key1, key2, key3;

Similarly overloaded operators for FactorGraph. Added relevant unit tests for both of these classes.

@varunagrawal varunagrawal self-assigned this Jun 29, 2023
@@ -53,45 +49,6 @@ class BayesTree;

class HybridValues;

/** Helper */
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got rid of all of these since they were needed for list_inserter only.

@@ -22,13 +22,6 @@

#include <gtsam/base/Testable.h>

#ifdef GTSAM_USE_BOOST_FEATURES
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did some cleaning up.

Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, but before I approve, is it still backwards compatible with boost? The list inserter pattern was in our code for a long time and, while we eradicated, users might have copied it in their code.

@varunagrawal
Copy link
Collaborator Author

@dellaert it should be backwards compatible with boost. From my understanding, list_inserter is a way to reconcile all the different "insert" methods across STL containers (insert vs push_back vs something else).

That being said, since we're killing boost in the current version, users would anyway have to update their code for this new release and this is just 1 extra, albeit small, change.

@dellaert
Copy link
Member

@dellaert it should be backwards compatible with boost. From my understanding, list_inserter is a way to reconcile all the different "insert" methods across STL containers (insert vs push_back vs something else).

That being said, since we're killing boost in the current version, users would anyway have to update their code for this new release and this is just 1 extra, albeit small, change.

Can you verify it is? We are not killing boost, we are allowing people to compile without boost. Users that are OK with boost should not have to update their code, as I remember.

@varunagrawal
Copy link
Collaborator Author

@dellaert I ran all unit tests with GTSAM_USE_BOOST_FEATURES set to both ON and OFF and they all pass.

Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, good additions !!!

@dellaert
Copy link
Member

@varunagrawal please merge and delete branch at your leisure.

@varunagrawal varunagrawal merged commit ef7bab8 into develop Jul 17, 2023
@varunagrawal varunagrawal deleted the ordering-helpers branch July 17, 2023 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants