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

update boost::bind usage #796

Merged
merged 7 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
89 changes: 55 additions & 34 deletions gtsam/base/numericalDerivative.h

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions gtsam/geometry/tests/testCalibratedCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
#include <gtsam/base/Testable.h>
#include <gtsam/base/numericalDerivative.h>

#include <boost/bind/bind.hpp>
#include <CppUnitLite/TestHarness.h>

#include <iostream>

using namespace boost::placeholders;
using namespace std;
using namespace gtsam;

Expand Down
1 change: 0 additions & 1 deletion gtsam/geometry/tests/testCameraSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <gtsam/geometry/Pose3.h>
#include <gtsam/base/numericalDerivative.h>
#include <CppUnitLite/TestHarness.h>
#include <boost/bind.hpp>

using namespace std;
using namespace gtsam;
Expand Down
3 changes: 3 additions & 0 deletions gtsam/geometry/tests/testEssentialMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
#include <gtsam/geometry/CalibratedCamera.h>
#include <gtsam/base/numericalDerivative.h>
#include <gtsam/base/Testable.h>

#include <boost/bind/bind.hpp>
#include <CppUnitLite/TestHarness.h>
#include <sstream>

using namespace boost::placeholders;
using namespace std;
using namespace gtsam;

Expand Down
2 changes: 2 additions & 0 deletions gtsam/geometry/tests/testOrientedPlane3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
#include <gtsam/base/numericalDerivative.h>
#include <CppUnitLite/TestHarness.h>
#include <boost/assign/std/vector.hpp>
#include <boost/bind/bind.hpp>

using namespace boost::assign;
using namespace boost::placeholders;
using namespace gtsam;
using namespace std;
using boost::none;
Expand Down
2 changes: 2 additions & 0 deletions gtsam/geometry/tests/testPinholeCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
#include <gtsam/base/Testable.h>
#include <gtsam/base/numericalDerivative.h>

#include <boost/bind/bind.hpp>
#include <CppUnitLite/TestHarness.h>

#include <cmath>
#include <iostream>

using namespace boost::placeholders;
acxz marked this conversation as resolved.
Show resolved Hide resolved
using namespace std;
using namespace gtsam;

Expand Down
1 change: 0 additions & 1 deletion gtsam/geometry/tests/testPinholeSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <gtsam/geometry/Pose3.h>
#include <gtsam/base/numericalDerivative.h>
#include <CppUnitLite/TestHarness.h>
#include <boost/bind.hpp>

acxz marked this conversation as resolved.
Show resolved Hide resolved
using namespace std;
using namespace gtsam;
Expand Down
3 changes: 3 additions & 0 deletions gtsam/geometry/tests/testPoint3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
#include <gtsam/geometry/Point3.h>
#include <gtsam/base/Testable.h>
#include <gtsam/base/numericalDerivative.h>

#include <boost/bind/bind.hpp>
#include <CppUnitLite/TestHarness.h>

using namespace boost::placeholders;
using namespace gtsam;

GTSAM_CONCEPT_TESTABLE_INST(Point3)
Expand Down
2 changes: 2 additions & 0 deletions gtsam/geometry/tests/testPose3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include <boost/assign/std/vector.hpp> // for operator +=
using namespace boost::assign;
#include <boost/bind/bind.hpp>
using namespace boost::placeholders;

#include <CppUnitLite/TestHarness.h>
#include <cmath>
Expand Down
2 changes: 2 additions & 0 deletions gtsam/geometry/tests/testSO3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
#include <gtsam/base/Testable.h>
#include <gtsam/base/testLie.h>

#include <boost/bind/bind.hpp>
#include <CppUnitLite/TestHarness.h>

using namespace boost::placeholders;
using namespace std;
using namespace gtsam;

Expand Down
3 changes: 2 additions & 1 deletion gtsam/geometry/tests/testSimilarity3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@

#include <CppUnitLite/TestHarness.h>

#include <boost/bind/bind.hpp>
#include <boost/function.hpp>
#include <boost/bind.hpp>

using namespace boost::placeholders;
using namespace gtsam;
using namespace std;
using symbol_shorthand::X;
Expand Down
3 changes: 2 additions & 1 deletion gtsam/geometry/tests/testUnit3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@

#include <CppUnitLite/TestHarness.h>

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

#include <cmath>
#include <random>

using namespace boost::assign;
using namespace boost::placeholders;
using namespace gtsam;
using namespace std;
using gtsam::symbol_shorthand::U;
Expand Down
1 change: 0 additions & 1 deletion gtsam/inference/EliminationTree-inst.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#pragma once

#include <boost/make_shared.hpp>
#include <boost/bind.hpp>
#include <stack>

#include <gtsam/base/timing.h>
Expand Down
2 changes: 0 additions & 2 deletions gtsam/inference/FactorGraph-inst.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

#include <gtsam/inference/FactorGraph.h>

#include <boost/bind.hpp>

#include <stdio.h>
#include <algorithm>
#include <iostream> // for cout :-(
Expand Down
1 change: 0 additions & 1 deletion gtsam/inference/FactorGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <Eigen/Core> // for Eigen::aligned_allocator

#include <boost/assign/list_inserter.hpp>
#include <boost/bind.hpp>
#include <boost/make_shared.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/vector.hpp>
Expand Down
10 changes: 5 additions & 5 deletions gtsam/inference/LabeledSymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

#include <iostream>

#include <boost/bind/bind.hpp>
#include <boost/format.hpp>
#include <boost/bind.hpp>

#include <boost/lexical_cast.hpp>

Expand Down Expand Up @@ -110,16 +110,16 @@ bool LabeledSymbol::operator!=(gtsam::Key comp) const {
static LabeledSymbol make(gtsam::Key key) { return LabeledSymbol(key);}

boost::function<bool(gtsam::Key)> LabeledSymbol::TypeTest(unsigned char c) {
return boost::bind(&LabeledSymbol::chr, boost::bind(make, _1)) == c;
return boost::bind(&LabeledSymbol::chr, boost::bind(make, boost::placeholders::_1)) == c;
}

boost::function<bool(gtsam::Key)> LabeledSymbol::LabelTest(unsigned char label) {
return boost::bind(&LabeledSymbol::label, boost::bind(make, _1)) == label;
return boost::bind(&LabeledSymbol::label, boost::bind(make, boost::placeholders::_1)) == label;
}

boost::function<bool(gtsam::Key)> LabeledSymbol::TypeLabelTest(unsigned char c, unsigned char label) {
return boost::bind(&LabeledSymbol::chr, boost::bind(make, _1)) == c &&
boost::bind(&LabeledSymbol::label, boost::bind(make, _1)) == label;
return boost::bind(&LabeledSymbol::chr, boost::bind(make, boost::placeholders::_1)) == c &&
boost::bind(&LabeledSymbol::label, boost::bind(make, boost::placeholders::_1)) == label;
}

/* ************************************************************************* */
Expand Down
4 changes: 2 additions & 2 deletions gtsam/inference/Symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#include <gtsam/inference/Symbol.h>

#include <boost/bind/bind.hpp>
#include <boost/format.hpp>
#include <boost/bind.hpp>

#include <limits.h>
#include <list>
Expand Down Expand Up @@ -63,7 +63,7 @@ Symbol::operator std::string() const {
static Symbol make(gtsam::Key key) { return Symbol(key);}

boost::function<bool(Key)> Symbol::ChrTest(unsigned char c) {
return bind(&Symbol::chr, bind(make, _1)) == c;
return boost::bind(&Symbol::chr, boost::bind(make, boost::placeholders::_1)) == c;
}

GTSAM_EXPORT std::ostream &operator<<(std::ostream &os, const Symbol &symbol) {
Expand Down
1 change: 0 additions & 1 deletion gtsam/inference/inference-inst.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#pragma once

#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
#include <utility>

#include <gtsam/base/treeTraversal-inst.h>
Expand Down
8 changes: 0 additions & 8 deletions gtsam/linear/HessianFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
#include <boost/format.hpp>
#include <boost/make_shared.hpp>
#include <boost/tuple/tuple.hpp>
#ifdef __GNUC__
acxz marked this conversation as resolved.
Show resolved Hide resolved
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#include <boost/bind.hpp>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include <boost/assign/list_of.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <boost/range/adaptor/map.hpp>
Expand Down
8 changes: 0 additions & 8 deletions gtsam/linear/JacobianFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@
#include <boost/format.hpp>
#include <boost/make_shared.hpp>
#include <boost/array.hpp>
#ifdef __GNUC__
acxz marked this conversation as resolved.
Show resolved Hide resolved
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#include <boost/bind.hpp>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include <boost/range/algorithm/copy.hpp>
#include <boost/range/adaptor/indirected.hpp>
#include <boost/range/adaptor/map.hpp>
Expand Down
5 changes: 3 additions & 2 deletions gtsam/linear/VectorValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <gtsam/linear/VectorValues.h>

#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/range/combine.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptor/transformed.hpp>
Expand All @@ -38,7 +38,8 @@ namespace gtsam {
{
// Merge using predicate for comparing first of pair
merge(first.begin(), first.end(), second.begin(), second.end(), inserter(values_, values_.end()),
boost::bind(&less<Key>::operator(), less<Key>(), boost::bind(&KeyValuePair::first, _1), boost::bind(&KeyValuePair::first, _2)));
boost::bind(&less<Key>::operator(), less<Key>(), boost::bind(&KeyValuePair::first, boost::placeholders::_1),
boost::bind(&KeyValuePair::first, boost::placeholders::_2)));
if(size() != first.size() + second.size())
throw invalid_argument("Requested to merge two VectorValues that have one or more variables in common.");
}
Expand Down
2 changes: 2 additions & 0 deletions gtsam/linear/tests/testGaussianBayesNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <boost/assign/list_of.hpp>
#include <boost/assign/std/list.hpp> // for operator +=
using namespace boost::assign;
#include <boost/bind/bind.hpp>
using namespace boost::placeholders;
acxz marked this conversation as resolved.
Show resolved Hide resolved

// STL/C++
#include <iostream>
Expand Down
2 changes: 2 additions & 0 deletions gtsam/linear/tests/testGaussianBayesTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <boost/assign/std/list.hpp> // for operator +=
#include <boost/assign/std/set.hpp> // for operator +=
using namespace boost::assign;
#include <boost/bind/bind.hpp>
using namespace boost::placeholders;
acxz marked this conversation as resolved.
Show resolved Hide resolved

#include <gtsam/base/debug.h>
#include <gtsam/base/numericalDerivative.h>
Expand Down
3 changes: 2 additions & 1 deletion gtsam/navigation/tests/testAHRSFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
#include <gtsam/base/debug.h>
#include <CppUnitLite/TestHarness.h>

#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <list>

using namespace boost::placeholders;
using namespace std;
using namespace gtsam;

Expand Down
3 changes: 3 additions & 0 deletions gtsam/navigation/tests/testAttitudeFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
#include <gtsam/base/numericalDerivative.h>
#include <gtsam/base/serialization.h>
#include <gtsam/base/serializationTestHelpers.h>

#include <boost/bind/bind.hpp>
#include <CppUnitLite/TestHarness.h>

using namespace boost::placeholders;
using namespace std;
using namespace gtsam;

Expand Down
1 change: 0 additions & 1 deletion gtsam/navigation/tests/testCombinedImuFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

#include <CppUnitLite/TestHarness.h>

#include <boost/bind.hpp>
#include <list>

#include "imuFactorTesting.h"
Expand Down
3 changes: 3 additions & 0 deletions gtsam/navigation/tests/testGPSFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
#include <gtsam/base/Testable.h>
#include <gtsam/base/numericalDerivative.h>

#include <boost/bind/bind.hpp>

#include <CppUnitLite/TestHarness.h>

#include <GeographicLib/Config.h>
#include <GeographicLib/LocalCartesian.hpp>

using namespace boost::placeholders;
using namespace std;
using namespace gtsam;
using namespace GeographicLib;
Expand Down
3 changes: 2 additions & 1 deletion gtsam/navigation/tests/testImuBias.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#include <gtsam/base/numericalDerivative.h>

#include <CppUnitLite/TestHarness.h>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>

using namespace boost::placeholders;
using namespace std;
using namespace gtsam;

Expand Down
Loading