Skip to content

Commit

Permalink
Fix compile error of the GCC with IndexLandmark braces initializer.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Alpus committed Feb 13, 2019
1 parent 8c6137c commit 3fc3fb5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
9 changes: 6 additions & 3 deletions include/eos/core/Landmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@ struct Landmark
* @brief Representation of a landmark with mesh index.
*/
template <class LandmarkType>
struct IndexedLandmark: Landmark<LandmarkType>
struct IndexedLandmark : Landmark<LandmarkType>
{
int model_index; ///< Index of landmark in mesh
IndexedLandmark(const Landmark<LandmarkType>& landmark, int model_index)
: Landmark<LandmarkType>(landmark), model_index(model_index) {}
IndexedLandmark(const std::string& name, const LandmarkType& coordinates, int model_index)
: Landmark<LandmarkType>{name, coordinates}, model_index(model_index) {}
int model_index; ///< Index of landmark in mesh
};


/**
* @brief A trivial collection of landmarks that belong together.
*/
Expand Down
3 changes: 1 addition & 2 deletions include/eos/core/LandmarkMapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ class LandmarkMapper
vertex_idx = std::stoi(converted_name.value());
}

IndexedLandmark<LandmarkType> 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;
}
Expand Down
9 changes: 3 additions & 6 deletions include/eos/fitting/ceres_nonlinear.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,12 +661,9 @@ class ModelFitter {
camera.get_viewport());

auto contour_landmarks = core::IndexedLandmarkCollection<LandmarkType>();
for (int i = 0; i < image_points_contour.size(); ++i) {
core::IndexedLandmark<LandmarkType> landmark;
landmark.coordinates = image_points_contour[i];
landmark.model_index = vertex_indices_contour[i];

contour_landmarks.emplace_back(std::move(landmark));
for (int i = 0; i < image_points_contour.size(); ++i)
{
contour_landmarks.emplace_back("", image_points_contour[i], vertex_indices_contour[i]);
}

return contour_landmarks;
Expand Down

0 comments on commit 3fc3fb5

Please sign in to comment.