Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix obscure MSVC error #593

Merged
merged 1 commit into from
Mar 29, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions common/include/pcl/point_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
#include <boost/mpl/bool.hpp>
#endif

// This is required for the workaround at line 109
#ifdef _MSC_VER
#include <Eigen/Core>
#include <Eigen/src/StlSupport/details.h>
#endif

namespace pcl
{

Expand Down Expand Up @@ -100,6 +106,24 @@ namespace pcl
typedef PointT type;
};

#ifdef _MSC_VER

/* Sometimes when calling functions like `copyPoint()` or `copyPointCloud`
* without explicitly specifying point types, MSVC deduces them to be e.g.
* `Eigen::internal::workaround_msvc_stl_support<pcl::PointXYZ>` instead of
* plain `pcl::PointXYZ`. Subsequently these types are passed to meta-
* functions like `has_field` or `fieldList` and make them choke. This hack
* makes use of the fact that internally `fieldList` always applies `POD` to
* its argument type. This specialization therefore allows to unwrap the
* contained point type. */
template<typename PointT>
struct POD<Eigen::internal::workaround_msvc_stl_support<PointT> >
{
typedef PointT type;
};

#endif

// name
/* This really only depends on Tag, but we go through some gymnastics to avoid ODR violations.
We template it on the point type PointT to avoid ODR violations when registering multiple
Expand Down