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

Get rid of boost::assign #1375

Merged
merged 38 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2fe4c83
Make base class constructors available (including initializer lists).
dellaert Jan 7, 2023
c4fb764
Removed boost headers in DecisionTree-inl.h that are no longer needed.
dellaert Jan 7, 2023
d2f0cf5
Inherit constructors for CameraSets to switch to initializer lists.
dellaert Jan 7, 2023
017cd8f
Got rid of boost::assign in many tests
dellaert Jan 7, 2023
313ab01
Got rid of Boost cref_list_of
dellaert Jan 7, 2023
8013779
Removed unused headers
dellaert Jan 7, 2023
d3380bc
Convert to initializer lists
dellaert Jan 7, 2023
f9ccf11
Rid gtsam/linear of boost::assign (a Herculean task made easier with …
dellaert Jan 8, 2023
6cbd7c2
Add initializer list constructors
dellaert Jan 8, 2023
8527b39
Removed copy/pasted but unused boost::assign headers.
dellaert Jan 8, 2023
7e4b033
Using initializers for almost everything in gtsam now.
dellaert Jan 8, 2023
4e078e4
Heavy lift on removing boost::assign from symbolic tests.
dellaert Jan 8, 2023
9b5321c
Remove unused boost::assign headers
dellaert Jan 8, 2023
d3a40fb
Use initializer lists in tests and gtsam_unstable
dellaert Jan 8, 2023
9675761
Merge branch 'develop' into feature/Ordering_initializers
dellaert Jan 8, 2023
276394d
Moved ListOf helper and MakeKeys to common header.
dellaert Jan 8, 2023
edec6f3
Renamed MakeKeys to Keys and cleaned up tests.
dellaert Jan 8, 2023
5164d6f
Cleaned up etree tests
dellaert Jan 8, 2023
ddf86d8
Fix compilation issue on Linux
dellaert Jan 8, 2023
638726f
An attempt to fix Windows issue.
dellaert Jan 8, 2023
73754f2
Fix typo
dellaert Jan 8, 2023
15802e5
Address review comments
dellaert Jan 9, 2023
fa3a810
Fix issues with gcc compiler.
dellaert Jan 9, 2023
1e99f68
Renamed ListOf to something more descriptive
dellaert Jan 9, 2023
9a6b0dd
Add FactorGraph-inst.h
dellaert Jan 9, 2023
c486472
Attempts at fixing CI gcc/windows
dellaert Jan 9, 2023
36d6b70
Fix gcc compilation errors by using correct allocator.
dellaert Jan 10, 2023
3b369e5
Define Errors as a typedef to FastList<Vector>.
dellaert Jan 10, 2023
a9409ac
Kill errors wrapper - internal class not used in any tests.
dellaert Jan 10, 2023
98f3c96
Replace blanket inclusion of constructors (giving trouble on Windows)…
dellaert Jan 10, 2023
b51f176
Simplify initializer list constructors.
dellaert Jan 10, 2023
0e01ea6
Fix issue with initializer constructors
dellaert Jan 10, 2023
353a5b3
Forgot to add correct type in elimination tree (needed for compilatio…
dellaert Jan 10, 2023
874f0de
One last omission
dellaert Jan 10, 2023
6a035b8
Two more tbb compile issues
dellaert Jan 10, 2023
416cb65
Remove const, use size_t everywhere.
dellaert Jan 10, 2023
61ff43f
Yet another issue with gcc-tbb
dellaert Jan 10, 2023
d41d4c2
Another gcc issue, switch to FastList
dellaert Jan 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions examples/CreateSFMExampleData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
#include <gtsam/geometry/CalibratedCamera.h>
#include <gtsam/slam/dataset.h>

#include <boost/assign/std/vector.hpp>

using namespace boost::assign;
using namespace std;
using namespace gtsam;

Expand Down
2 changes: 0 additions & 2 deletions examples/TimeTBB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
#include <gtsam/global_includes.h>
#include <gtsam/base/Matrix.h>

#include <boost/assign/list_of.hpp>
#include <map>
#include <iostream>

using namespace std;
using namespace gtsam;
using boost::assign::list_of;

#ifdef GTSAM_USE_TBB

Expand Down
10 changes: 2 additions & 8 deletions gtsam/base/FastSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,9 @@ class FastSet: public std::set<VALUE, std::less<VALUE>,
typedef std::set<VALUE, std::less<VALUE>,
typename internal::FastDefaultAllocator<VALUE>::type> Base;

/** Default constructor */
FastSet() {
}
using Base::Base; // Inherit the set constructors

/** Constructor from a range, passes through to base class */
template<typename INPUTITERATOR>
explicit FastSet(INPUTITERATOR first, INPUTITERATOR last) :
Base(first, last) {
}
FastSet() = default; ///< Default constructor

/** Constructor from a iterable container, passes through to base class */
template<typename INPUTCONTAINER>
Expand Down
45 changes: 15 additions & 30 deletions gtsam/base/tests/testDSFMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@
* @brief unit tests for DSFMap
*/

#include <gtsam/base/DSFMap.h>

#include <boost/assign/std/list.hpp>
#include <boost/assign/std/set.hpp>
using namespace boost::assign;

#include <CppUnitLite/TestHarness.h>
#include <gtsam/base/DSFMap.h>

#include <iostream>
#include <list>
#include <map>
#include <set>

using namespace std;
using namespace gtsam;

/* ************************************************************************* */
Expand Down Expand Up @@ -65,9 +62,8 @@ TEST(DSFMap, merge3) {
TEST(DSFMap, mergePairwiseMatches) {

// Create some "matches"
typedef pair<size_t,size_t> Match;
list<Match> matches;
matches += Match(1,2), Match(2,3), Match(4,5), Match(4,6);
typedef std::pair<size_t, size_t> Match;
const std::list<Match> matches{{1, 2}, {2, 3}, {4, 5}, {4, 6}};

// Merge matches
DSFMap<size_t> dsf;
Expand All @@ -86,18 +82,17 @@ TEST(DSFMap, mergePairwiseMatches) {
TEST(DSFMap, mergePairwiseMatches2) {

// Create some measurements with image index and feature index
typedef pair<size_t,size_t> Measurement;
typedef std::pair<size_t,size_t> Measurement;
Measurement m11(1,1),m12(1,2),m14(1,4); // in image 1
Measurement m22(2,2),m23(2,3),m25(2,5),m26(2,6); // in image 2

// Add them all
list<Measurement> measurements;
measurements += m11,m12,m14, m22,m23,m25,m26;
const std::list<Measurement> measurements{m11, m12, m14, m22, m23, m25, m26};

// Create some "matches"
typedef pair<Measurement,Measurement> Match;
list<Match> matches;
matches += Match(m11,m22), Match(m12,m23), Match(m14,m25), Match(m14,m26);
typedef std::pair<Measurement, Measurement> Match;
const std::list<Match> matches{
{m11, m22}, {m12, m23}, {m14, m25}, {m14, m26}};

// Merge matches
DSFMap<Measurement> dsf;
Expand All @@ -114,26 +109,16 @@ TEST(DSFMap, mergePairwiseMatches2) {
/* ************************************************************************* */
TEST(DSFMap, sets){
// Create some "matches"
typedef pair<size_t,size_t> Match;
list<Match> matches;
matches += Match(1,2), Match(2,3), Match(4,5), Match(4,6);
using Match = std::pair<size_t,size_t>;
const std::list<Match> matches{{1, 2}, {2, 3}, {4, 5}, {4, 6}};

// Merge matches
DSFMap<size_t> dsf;
for(const Match& m: matches)
dsf.merge(m.first,m.second);

map<size_t, set<size_t> > sets = dsf.sets();
set<size_t> s1, s2;
s1 += 1,2,3;
s2 += 4,5,6;

/*for(key_pair st: sets){
cout << "Set " << st.first << " :{";
for(const size_t s: st.second)
cout << s << ", ";
cout << "}" << endl;
}*/
std::map<size_t, std::set<size_t> > sets = dsf.sets();
const std::set<size_t> s1{1, 2, 3}, s2{4, 5, 6};

EXPECT(s1 == sets[1]);
EXPECT(s2 == sets[4]);
Expand Down
60 changes: 30 additions & 30 deletions gtsam/base/tests/testDSFVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
#include <CppUnitLite/TestHarness.h>

#include <boost/make_shared.hpp>
#include <boost/assign/std/list.hpp>
#include <boost/assign/std/set.hpp>
#include <boost/assign/std/vector.hpp>
using namespace boost::assign;

#include <iostream>
#include <set>
#include <list>
#include <utility>

using namespace std;
using std::pair;
using std::map;
using std::vector;
using namespace gtsam;

/* ************************************************************************* */
Expand Down Expand Up @@ -64,8 +65,8 @@ TEST(DSFBase, mergePairwiseMatches) {

// Create some "matches"
typedef pair<size_t,size_t> Match;
vector<Match> matches;
matches += Match(1,2), Match(2,3), Match(4,5), Match(4,6);
const vector<Match> matches{Match(1, 2), Match(2, 3), Match(4, 5),
Match(4, 6)};

// Merge matches
DSFBase dsf(7); // We allow for keys 0..6
Expand All @@ -85,7 +86,7 @@ TEST(DSFBase, mergePairwiseMatches) {
/* ************************************************************************* */
TEST(DSFVector, merge2) {
boost::shared_ptr<DSFBase::V> v = boost::make_shared<DSFBase::V>(5);
std::vector<size_t> keys; keys += 1, 3;
const std::vector<size_t> keys {1, 3};
DSFVector dsf(v, keys);
dsf.merge(1,3);
EXPECT(dsf.find(1) == dsf.find(3));
Expand All @@ -95,10 +96,10 @@ TEST(DSFVector, merge2) {
TEST(DSFVector, sets) {
DSFVector dsf(2);
dsf.merge(0,1);
map<size_t, set<size_t> > sets = dsf.sets();
map<size_t, std::set<size_t> > sets = dsf.sets();
LONGS_EQUAL(1, sets.size());

set<size_t> expected; expected += 0, 1;
const std::set<size_t> expected{0, 1};
EXPECT(expected == sets[dsf.find(0)]);
}

Expand All @@ -109,7 +110,7 @@ TEST(DSFVector, arrays) {
map<size_t, vector<size_t> > arrays = dsf.arrays();
LONGS_EQUAL(1, arrays.size());

vector<size_t> expected; expected += 0, 1;
const vector<size_t> expected{0, 1};
EXPECT(expected == arrays[dsf.find(0)]);
}

Expand All @@ -118,10 +119,10 @@ TEST(DSFVector, sets2) {
DSFVector dsf(3);
dsf.merge(0,1);
dsf.merge(1,2);
map<size_t, set<size_t> > sets = dsf.sets();
map<size_t, std::set<size_t> > sets = dsf.sets();
LONGS_EQUAL(1, sets.size());

set<size_t> expected; expected += 0, 1, 2;
const std::set<size_t> expected{0, 1, 2};
EXPECT(expected == sets[dsf.find(0)]);
}

Expand All @@ -133,18 +134,18 @@ TEST(DSFVector, arrays2) {
map<size_t, vector<size_t> > arrays = dsf.arrays();
LONGS_EQUAL(1, arrays.size());

vector<size_t> expected; expected += 0, 1, 2;
const vector<size_t> expected{0, 1, 2};
EXPECT(expected == arrays[dsf.find(0)]);
}

/* ************************************************************************* */
TEST(DSFVector, sets3) {
DSFVector dsf(3);
dsf.merge(0,1);
map<size_t, set<size_t> > sets = dsf.sets();
map<size_t, std::set<size_t> > sets = dsf.sets();
LONGS_EQUAL(2, sets.size());

set<size_t> expected; expected += 0, 1;
const std::set<size_t> expected{0, 1};
EXPECT(expected == sets[dsf.find(0)]);
}

Expand All @@ -155,18 +156,18 @@ TEST(DSFVector, arrays3) {
map<size_t, vector<size_t> > arrays = dsf.arrays();
LONGS_EQUAL(2, arrays.size());

vector<size_t> expected; expected += 0, 1;
const vector<size_t> expected{0, 1};
EXPECT(expected == arrays[dsf.find(0)]);
}

/* ************************************************************************* */
TEST(DSFVector, set) {
DSFVector dsf(3);
dsf.merge(0,1);
set<size_t> set = dsf.set(0);
std::set<size_t> set = dsf.set(0);
LONGS_EQUAL(2, set.size());

std::set<size_t> expected; expected += 0, 1;
const std::set<size_t> expected{0, 1};
EXPECT(expected == set);
}

Expand All @@ -175,10 +176,10 @@ TEST(DSFVector, set2) {
DSFVector dsf(3);
dsf.merge(0,1);
dsf.merge(1,2);
set<size_t> set = dsf.set(0);
std::set<size_t> set = dsf.set(0);
LONGS_EQUAL(3, set.size());

std::set<size_t> expected; expected += 0, 1, 2;
const std::set<size_t> expected{0, 1, 2};
EXPECT(expected == set);
}

Expand All @@ -195,27 +196,26 @@ TEST(DSFVector, isSingleton) {
TEST(DSFVector, mergePairwiseMatches) {

// Create some measurements
vector<size_t> keys;
keys += 1,2,3,4,5,6;
const vector<size_t> keys{1, 2, 3, 4, 5, 6};

// Create some "matches"
typedef pair<size_t,size_t> Match;
vector<Match> matches;
matches += Match(1,2), Match(2,3), Match(4,5), Match(4,6);
const vector<Match> matches{Match(1, 2), Match(2, 3), Match(4, 5),
Match(4, 6)};

// Merge matches
DSFVector dsf(keys);
for(const Match& m: matches)
dsf.merge(m.first,m.second);

// Check that we have two connected components, 1,2,3 and 4,5,6
map<size_t, set<size_t> > sets = dsf.sets();
map<size_t, std::set<size_t> > sets = dsf.sets();
LONGS_EQUAL(2, sets.size());
set<size_t> expected1; expected1 += 1,2,3;
set<size_t> actual1 = sets[dsf.find(2)];
const std::set<size_t> expected1{1, 2, 3};
std::set<size_t> actual1 = sets[dsf.find(2)];
EXPECT(expected1 == actual1);
set<size_t> expected2; expected2 += 4,5,6;
set<size_t> actual2 = sets[dsf.find(5)];
const std::set<size_t> expected2{4, 5, 6};
std::set<size_t> actual2 = sets[dsf.find(5)];
EXPECT(expected2 == actual2);
}

Expand Down
6 changes: 1 addition & 5 deletions gtsam/base/tests/testFastContainers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@
#include <gtsam/base/FastSet.h>
#include <gtsam/base/FastVector.h>

#include <boost/assign/std/vector.hpp>
#include <boost/assign/std/set.hpp>

#include <CppUnitLite/TestHarness.h>

using namespace boost::assign;
using namespace gtsam;

/* ************************************************************************* */
Expand All @@ -25,7 +21,7 @@ TEST( testFastContainers, KeySet ) {
KeyVector init_vector {2, 3, 4, 5};

KeySet actSet(init_vector);
KeySet expSet; expSet += 2, 3, 4, 5;
KeySet expSet{2, 3, 4, 5};
EXPECT(actSet == expSet);
}

Expand Down
Loading