Merged in feature/BAD_generic_value_traits_no_cpp11 (pull request #27)

reclaced std::type_traits with boost::type_traits
release/4.3a0
Michael Bosse 2014-10-29 11:00:50 +01:00
commit 18ad04970a
25 changed files with 67 additions and 67 deletions

View File

@ -178,7 +178,7 @@ private:
namespace traits { namespace traits {
template<> template<>
struct is_manifold<LieMatrix> : public std::true_type { struct is_manifold<LieMatrix> : public boost::true_type {
}; };
template<> template<>

View File

@ -116,15 +116,15 @@ namespace gtsam {
namespace traits { namespace traits {
template<> template<>
struct is_group<LieScalar> : public std::true_type { struct is_group<LieScalar> : public boost::true_type {
}; };
template<> template<>
struct is_manifold<LieScalar> : public std::true_type { struct is_manifold<LieScalar> : public boost::true_type {
}; };
template<> template<>
struct dimension<LieScalar> : public std::integral_constant<int, 1> { struct dimension<LieScalar> : public boost::integral_constant<int, 1> {
}; };
} }

View File

@ -133,7 +133,7 @@ private:
namespace traits { namespace traits {
template<> template<>
struct is_manifold<LieVector> : public std::true_type { struct is_manifold<LieVector> : public boost::true_type {
}; };
template<> template<>

View File

@ -20,7 +20,7 @@
#include <gtsam/base/Matrix.h> #include <gtsam/base/Matrix.h>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <type_traits> #include <boost/type_traits.hpp>
#include <string> #include <string>
namespace gtsam { namespace gtsam {
@ -50,7 +50,7 @@ namespace traits {
// is group, by default this is false // is group, by default this is false
template<typename T> template<typename T>
struct is_group: public std::false_type { struct is_group: public boost::false_type {
}; };
// identity, no default provided, by default given by default constructor // identity, no default provided, by default given by default constructor
@ -63,11 +63,11 @@ struct identity {
// is manifold, by default this is false // is manifold, by default this is false
template<typename T> template<typename T>
struct is_manifold: public std::false_type { struct is_manifold: public boost::false_type {
}; };
// dimension, can return Eigen::Dynamic (-1) if not known at compile time // dimension, can return Eigen::Dynamic (-1) if not known at compile time
typedef std::integral_constant<int, Eigen::Dynamic> Dynamic; typedef boost::integral_constant<int, Eigen::Dynamic> Dynamic;
template<typename T> template<typename T>
struct dimension : public Dynamic {}; //default to dynamic struct dimension : public Dynamic {}; //default to dynamic
@ -83,15 +83,15 @@ template<typename T> struct zero: public identity<T> {
// double // double
template<> template<>
struct is_group<double> : public std::true_type { struct is_group<double> : public boost::true_type {
}; };
template<> template<>
struct is_manifold<double> : public std::true_type { struct is_manifold<double> : public boost::true_type {
}; };
template<> template<>
struct dimension<double> : public std::integral_constant<int, 1> { struct dimension<double> : public boost::integral_constant<int, 1> {
}; };
template<> template<>
@ -104,11 +104,11 @@ struct zero<double> {
// Fixed size Eigen::Matrix type // Fixed size Eigen::Matrix type
template<int M, int N, int Options> template<int M, int N, int Options>
struct is_group<Eigen::Matrix<double, M, N, Options> > : public std::true_type { struct is_group<Eigen::Matrix<double, M, N, Options> > : public boost::true_type {
}; };
template<int M, int N, int Options> template<int M, int N, int Options>
struct is_manifold<Eigen::Matrix<double, M, N, Options> > : public std::true_type { struct is_manifold<Eigen::Matrix<double, M, N, Options> > : public boost::true_type {
}; };
// TODO: Could be more sophisticated using Eigen traits and SFINAE? // TODO: Could be more sophisticated using Eigen traits and SFINAE?
@ -126,12 +126,12 @@ struct dimension<Eigen::Matrix<double, Eigen::Dynamic, N, Options> > : public Dy
}; };
template<int M, int N, int Options> template<int M, int N, int Options>
struct dimension<Eigen::Matrix<double, M, N, Options> > : public std::integral_constant< struct dimension<Eigen::Matrix<double, M, N, Options> > : public boost::integral_constant<
int, M * N> { int, M * N> {
}; };
template<int M, int N, int Options> template<int M, int N, int Options>
struct zero<Eigen::Matrix<double, M, N, Options> > : public std::integral_constant< struct zero<Eigen::Matrix<double, M, N, Options> > : public boost::integral_constant<
int, M * N> { int, M * N> {
BOOST_STATIC_ASSERT_MSG((M!=Eigen::Dynamic && N!=Eigen::Dynamic), BOOST_STATIC_ASSERT_MSG((M!=Eigen::Dynamic && N!=Eigen::Dynamic),
"traits::zero is only supported for fixed-size matrices"); "traits::zero is only supported for fixed-size matrices");
@ -140,7 +140,7 @@ struct zero<Eigen::Matrix<double, M, N, Options> > : public std::integral_consta
} }
}; };
template <typename T> struct is_chart : public std::false_type {}; template <typename T> struct is_chart : public boost::false_type {};
} // \ namespace traits } // \ namespace traits
@ -164,7 +164,7 @@ struct DefaultChart {
namespace traits { namespace traits {
// populate default traits // populate default traits
template <typename T> struct is_chart<DefaultChart<T> > : public std::true_type {}; template <typename T> struct is_chart<DefaultChart<T> > : public boost::true_type {};
template <typename T> struct dimension<DefaultChart<T> > : public dimension<T> {}; template <typename T> struct dimension<DefaultChart<T> > : public dimension<T> {};
} }

View File

@ -189,11 +189,11 @@ private:
namespace traits { namespace traits {
template<> template<>
struct is_manifold<Cal3Bundler> : public std::true_type { struct is_manifold<Cal3Bundler> : public boost::true_type {
}; };
template<> template<>
struct dimension<Cal3Bundler> : public std::integral_constant<int, 3> { struct dimension<Cal3Bundler> : public boost::integral_constant<int, 3> {
}; };
template<> template<>

View File

@ -171,11 +171,11 @@ private:
namespace traits { namespace traits {
template<> template<>
struct is_manifold<Cal3DS2> : public std::true_type { struct is_manifold<Cal3DS2> : public boost::true_type {
}; };
template<> template<>
struct dimension<Cal3DS2> : public std::integral_constant<int, 9> { struct dimension<Cal3DS2> : public boost::integral_constant<int, 9> {
}; };
} }

View File

@ -142,11 +142,11 @@ private:
namespace traits { namespace traits {
template<> template<>
struct is_manifold<Cal3Unified> : public std::true_type { struct is_manifold<Cal3Unified> : public boost::true_type {
}; };
template<> template<>
struct dimension<Cal3Unified> : public std::integral_constant<int, 10> { struct dimension<Cal3Unified> : public boost::integral_constant<int, 10> {
}; };
template<> template<>

View File

@ -243,11 +243,11 @@ private:
namespace traits { namespace traits {
template<> template<>
struct is_manifold<Cal3_S2> : public std::true_type { struct is_manifold<Cal3_S2> : public boost::true_type {
}; };
template<> template<>
struct dimension<Cal3_S2> : public std::integral_constant<int, 5> { struct dimension<Cal3_S2> : public boost::integral_constant<int, 5> {
}; };
template<> template<>

View File

@ -226,15 +226,15 @@ private:
namespace traits { namespace traits {
template<> template<>
struct is_group<CalibratedCamera> : public std::true_type { struct is_group<CalibratedCamera> : public boost::true_type {
}; };
template<> template<>
struct is_manifold<CalibratedCamera> : public std::true_type { struct is_manifold<CalibratedCamera> : public boost::true_type {
}; };
template<> template<>
struct dimension<CalibratedCamera> : public std::integral_constant<int, 6> { struct dimension<CalibratedCamera> : public boost::integral_constant<int, 6> {
}; };
} }

View File

@ -199,11 +199,11 @@ private:
namespace traits { namespace traits {
template<> template<>
struct is_manifold<EssentialMatrix> : public std::true_type { struct is_manifold<EssentialMatrix> : public boost::true_type {
}; };
template<> template<>
struct dimension<EssentialMatrix> : public std::integral_constant<int, 5> { struct dimension<EssentialMatrix> : public boost::integral_constant<int, 5> {
}; };
template<> template<>

View File

@ -663,11 +663,11 @@ private:
namespace traits { namespace traits {
template<typename Calibration> template<typename Calibration>
struct is_manifold<PinholeCamera<Calibration> > : public std::true_type { struct is_manifold<PinholeCamera<Calibration> > : public boost::true_type {
}; };
template<typename Calibration> template<typename Calibration>
struct dimension<PinholeCamera<Calibration> > : public std::integral_constant< struct dimension<PinholeCamera<Calibration> > : public boost::integral_constant<
int, dimension<Pose3>::value + dimension<Calibration>::value> { int, dimension<Pose3>::value + dimension<Calibration>::value> {
}; };

View File

@ -253,15 +253,15 @@ inline Point2 operator*(double s, const Point2& p) {return p*s;}
namespace traits { namespace traits {
template<> template<>
struct is_group<Point2> : public std::true_type { struct is_group<Point2> : public boost::true_type {
}; };
template<> template<>
struct is_manifold<Point2> : public std::true_type { struct is_manifold<Point2> : public boost::true_type {
}; };
template<> template<>
struct dimension<Point2> : public std::integral_constant<int, 2> { struct dimension<Point2> : public boost::integral_constant<int, 2> {
}; };
} }

View File

@ -245,15 +245,15 @@ namespace gtsam {
namespace traits { namespace traits {
template<> template<>
struct is_group<Point3> : public std::true_type { struct is_group<Point3> : public boost::true_type {
}; };
template<> template<>
struct is_manifold<Point3> : public std::true_type { struct is_manifold<Point3> : public boost::true_type {
}; };
template<> template<>
struct dimension<Point3> : public std::integral_constant<int, 3> { struct dimension<Point3> : public boost::integral_constant<int, 3> {
}; };
} }

View File

@ -324,11 +324,11 @@ GTSAM_EXPORT boost::optional<Pose2> align(const std::vector<Point2Pair>& pairs);
namespace traits { namespace traits {
template<> template<>
struct is_manifold<Pose2> : public std::true_type { struct is_manifold<Pose2> : public boost::true_type {
}; };
template<> template<>
struct dimension<Pose2> : public std::integral_constant<int, 3> { struct dimension<Pose2> : public boost::integral_constant<int, 3> {
}; };
} }

View File

@ -357,15 +357,15 @@ GTSAM_EXPORT boost::optional<Pose3> align(const std::vector<Point3Pair>& pairs);
namespace traits { namespace traits {
template<> template<>
struct is_group<Pose3> : public std::true_type { struct is_group<Pose3> : public boost::true_type {
}; };
template<> template<>
struct is_manifold<Pose3> : public std::true_type { struct is_manifold<Pose3> : public boost::true_type {
}; };
template<> template<>
struct dimension<Pose3> : public std::integral_constant<int, 6> { struct dimension<Pose3> : public boost::integral_constant<int, 6> {
}; };
} }

View File

@ -246,15 +246,15 @@ namespace gtsam {
namespace traits { namespace traits {
template<> template<>
struct is_group<Rot2> : public std::true_type { struct is_group<Rot2> : public boost::true_type {
}; };
template<> template<>
struct is_manifold<Rot2> : public std::true_type { struct is_manifold<Rot2> : public boost::true_type {
}; };
template<> template<>
struct dimension<Rot2> : public std::integral_constant<int, 1> { struct dimension<Rot2> : public boost::integral_constant<int, 1> {
}; };
} }

View File

@ -493,15 +493,15 @@ namespace gtsam {
namespace traits { namespace traits {
template<> template<>
struct is_group<Rot3> : public std::true_type { struct is_group<Rot3> : public boost::true_type {
}; };
template<> template<>
struct is_manifold<Rot3> : public std::true_type { struct is_manifold<Rot3> : public boost::true_type {
}; };
template<> template<>
struct dimension<Rot3> : public std::integral_constant<int, 3> { struct dimension<Rot3> : public boost::integral_constant<int, 3> {
}; };
} }

View File

@ -158,11 +158,11 @@ private:
namespace traits { namespace traits {
template<> template<>
struct is_manifold<StereoCamera> : public std::true_type { struct is_manifold<StereoCamera> : public boost::true_type {
}; };
template<> template<>
struct dimension<StereoCamera> : public std::integral_constant<int, 6> { struct dimension<StereoCamera> : public boost::integral_constant<int, 6> {
}; };
template<> template<>

View File

@ -176,15 +176,15 @@ namespace gtsam {
namespace traits { namespace traits {
template<> template<>
struct is_group<StereoPoint2> : public std::true_type { struct is_group<StereoPoint2> : public boost::true_type {
}; };
template<> template<>
struct is_manifold<StereoPoint2> : public std::true_type { struct is_manifold<StereoPoint2> : public boost::true_type {
}; };
template<> template<>
struct dimension<StereoPoint2> : public std::integral_constant<int, 3> { struct dimension<StereoPoint2> : public boost::integral_constant<int, 3> {
}; };
} }

View File

@ -159,11 +159,11 @@ private:
namespace traits { namespace traits {
template<> template<>
struct is_manifold<Unit3> : public std::true_type { struct is_manifold<Unit3> : public boost::true_type {
}; };
template<> template<>
struct dimension<Unit3> : public std::integral_constant<int, 2> { struct dimension<Unit3> : public boost::integral_constant<int, 2> {
}; };
template<> template<>

View File

@ -221,15 +221,15 @@ namespace imuBias {
namespace traits { namespace traits {
template<> template<>
struct is_group<imuBias::ConstantBias> : public std::true_type { struct is_group<imuBias::ConstantBias> : public boost::true_type {
}; };
template<> template<>
struct is_manifold<imuBias::ConstantBias> : public std::true_type { struct is_manifold<imuBias::ConstantBias> : public boost::true_type {
}; };
template<> template<>
struct dimension<imuBias::ConstantBias> : public std::integral_constant<int, 6> { struct dimension<imuBias::ConstantBias> : public boost::integral_constant<int, 6> {
}; };
} }

View File

@ -393,7 +393,7 @@ namespace gtsam {
// supplied \c filter function. // supplied \c filter function.
template<class ValueType> template<class ValueType>
static bool filterHelper(const boost::function<bool(Key)> filter, const ConstKeyValuePair& key_value) { static bool filterHelper(const boost::function<bool(Key)> filter, const ConstKeyValuePair& key_value) {
BOOST_STATIC_ASSERT((!std::is_same<ValueType, Value>::value)); BOOST_STATIC_ASSERT((!boost::is_same<ValueType, Value>::value));
// Filter and check the type // Filter and check the type
return filter(key_value.key) && (dynamic_cast<const GenericValue<ValueType>*>(&key_value.value)); return filter(key_value.key) && (dynamic_cast<const GenericValue<ValueType>*>(&key_value.value));
} }

View File

@ -64,9 +64,9 @@ public:
namespace gtsam { namespace gtsam {
namespace traits { namespace traits {
template <> template <>
struct is_manifold<TestValue> : public std::true_type {}; struct is_manifold<TestValue> : public boost::true_type {};
template <> template <>
struct dimension<TestValue> : public std::integral_constant<int, 0> {}; struct dimension<TestValue> : public boost::integral_constant<int, 0> {};
} }
} }

View File

@ -187,11 +187,11 @@ private:
namespace traits { namespace traits {
template<> template<>
struct is_manifold<PoseRTV> : public std::true_type { struct is_manifold<PoseRTV> : public boost::true_type {
}; };
template<> template<>
struct dimension<PoseRTV> : public std::integral_constant<int, 9> { struct dimension<PoseRTV> : public boost::integral_constant<int, 9> {
}; };
template<> template<>

View File

@ -144,11 +144,11 @@ private:
namespace traits { namespace traits {
template<> template<>
struct is_manifold<Pose3Upright> : public std::true_type { struct is_manifold<Pose3Upright> : public boost::true_type {
}; };
template<> template<>
struct dimension<Pose3Upright> : public std::integral_constant<int, 4> { struct dimension<Pose3Upright> : public boost::integral_constant<int, 4> {
}; };
} }