Add an ifdef to handle tr1 namespace in sparse_cholesky_test.cc Parametric tests in gunit use tuple, which can be in the std::tr1 or the std namespaces depending on the version of STL one is using. This change adds conditions the choice of namespace on whether CXX11 mode is enabled or not. It is entirely possible that we will have to come back and add detection for this along the lines of shared_ptr. Change-Id: I7fc85a32cf9f3f3bf30f86d9ba972ac67c6635fb
diff --git a/internal/ceres/sparse_cholesky_test.cc b/internal/ceres/sparse_cholesky_test.cc index 0c6e126..e4efc66 100644 --- a/internal/ceres/sparse_cholesky_test.cc +++ b/internal/ceres/sparse_cholesky_test.cc
@@ -148,15 +148,23 @@ << eigen_lhs; } -typedef ::std::tr1::tuple<SparseLinearAlgebraLibraryType, OrderingType, bool> +#ifdef CERES_USE_CXX11 +using std::tuple; +using std::get; +#else +using std::tr1::tuple; +using std::tr1::get; +#endif + +typedef tuple<SparseLinearAlgebraLibraryType, OrderingType, bool> Param; std::string ParamInfoToString(testing::TestParamInfo<Param> info) { Param param = info.param; std::stringstream ss; - ss << SparseLinearAlgebraLibraryTypeToString(std::tr1::get<0>(param)) << "_" - << (std::tr1::get<1>(param) == AMD ? "AMD" : "NATURAL") << "_" - << (std::tr1::get<2>(param) ? "UseBlockStructure" : "NoBlockStructure"); + ss << SparseLinearAlgebraLibraryTypeToString(get<0>(param)) << "_" + << (get<1>(param) == AMD ? "AMD" : "NATURAL") << "_" + << (get<2>(param) ? "UseBlockStructure" : "NoBlockStructure"); return ss.str(); } @@ -175,9 +183,9 @@ for (int trial = 0; trial < kNumTrials; ++trial) { const double block_density = std::max(0.1, RandDouble()); Param param = GetParam(); - SparseCholeskySolverUnitTest(std::tr1::get<0>(param), - std::tr1::get<1>(param), - std::tr1::get<2>(param), + SparseCholeskySolverUnitTest(get<0>(param), + get<1>(param), + get<2>(param), num_blocks, kMinBlockSize, kMaxBlockSize,