From cb708fa377a793c2375f75434c64e727f0cf4504 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Tue, 23 May 2023 08:20:06 +0200 Subject: [PATCH] Fix compat with cxx98 standard --- json/sample-json-vpHomogeneousMatrix.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/json/sample-json-vpHomogeneousMatrix.cpp b/json/sample-json-vpHomogeneousMatrix.cpp index 0bc3eef..fe92aeb 100644 --- a/json/sample-json-vpHomogeneousMatrix.cpp +++ b/json/sample-json-vpHomogeneousMatrix.cpp @@ -5,7 +5,14 @@ int main() #if defined(VISP_HAVE_NLOHMANN_JSON) std::string filename = "homo-mat.json"; { - vpHomogeneousMatrix M(vpTranslationVector(0.1, 0.2, 0.3), vpRotationMatrix({ 0, 0, -1, 0, -1, 0, -1, 0, 0 })); +#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) + vpHomogeneousMatrix M(vpTranslationVector(0.1, 0.2, 0.3), vpRotationMatrix({ 0, 0, 1, 0, -1, 0, -1, 0, 0 })); +#else + vpHomogeneousMatrix M; + M[0][0] = 0; M[0][1] = 0; M[0][2] = 1; M[0][2] = 0.1; + M[1][0] = 0; M[1][1] = -1; M[1][2] = 0; M[1][2] = 0.2; + M[2][0] = -1; M[2][1] = 0; M[2][2] = 0; M[2][2] = 0.3; +#endif std::ofstream file(filename); const nlohmann::json j = M; file << j;