From b4b99605c754200b9e7521cc8f17365e882ad65d Mon Sep 17 00:00:00 2001 From: Alexander Pushin Date: Wed, 13 Feb 2019 13:35:23 +0300 Subject: [PATCH] Fix compile error of the GCC with IndexLandmark braces initializer. GCC compiler raise an error when it try to compile braces initializer of IndexLandmark struct. This commit add explicit definition of intializers for this struct. --- include/eos/core/Landmark.hpp | 5 +++++ include/eos/core/LandmarkMapper.hpp | 3 +-- include/eos/fitting/ceres_nonlinear.hpp | 6 +----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/eos/core/Landmark.hpp b/include/eos/core/Landmark.hpp index ebe8aa948..4939d51a1 100644 --- a/include/eos/core/Landmark.hpp +++ b/include/eos/core/Landmark.hpp @@ -46,6 +46,11 @@ struct Landmark template struct IndexedLandmark : Landmark { + IndexedLandmark(const Landmark& landmark, int model_index) + : Landmark(landmark), model_index(model_index) {} + IndexedLandmark(const std::string& name, const LandmarkType& coordinates, int model_index) + : Landmark{name, coordinates}, model_index(model_index) {} + int model_index; ///< Index of landmark in mesh }; diff --git a/include/eos/core/LandmarkMapper.hpp b/include/eos/core/LandmarkMapper.hpp index b750cd47f..98a9dd058 100644 --- a/include/eos/core/LandmarkMapper.hpp +++ b/include/eos/core/LandmarkMapper.hpp @@ -168,8 +168,7 @@ class LandmarkMapper vertex_idx = std::stoi(converted_name.value()); } - IndexedLandmark indexed_landmark{landmark.name, landmark.coordinates, vertex_idx}; - indexed_landmarks.emplace_back(std::move(indexed_landmark)); + indexed_landmarks.emplace_back(landmark, vertex_idx); } return indexed_landmarks; } diff --git a/include/eos/fitting/ceres_nonlinear.hpp b/include/eos/fitting/ceres_nonlinear.hpp index 0e678aed4..c2ba63e94 100644 --- a/include/eos/fitting/ceres_nonlinear.hpp +++ b/include/eos/fitting/ceres_nonlinear.hpp @@ -680,11 +680,7 @@ class ModelFitter auto contour_landmarks = core::IndexedLandmarkCollection(); for (int i = 0; i < image_points_contour.size(); ++i) { - core::IndexedLandmark landmark; - landmark.coordinates = image_points_contour[i]; - landmark.model_index = vertex_indices_contour[i]; - - contour_landmarks.emplace_back(std::move(landmark)); + contour_landmarks.emplace_back("", image_points_contour[i], vertex_indices_contour[i]); } return contour_landmarks;