简体   繁体   English

了解C ++模板

[英]Understanding C++ templates

here is the function declaration in my class: 这是我班级的函数声明:

template <typename PointInT, typename PointNT, typename PointOutT>
class WrinklednessEstimation: public FeatureFromNormals<PointInT, PointNT, PointOutT>
{
    ...
    void normalsToSpherical(const PointCloud<PointNT> &input, PointCloud<Normal> &output);
    ...
}

here is the part of the implementation: 这是实施的一部分:

template <typename PointInT, typename PointNT, typename PointOutT> void
pcl::WrinklednessEstimation<PointInT, PointNT, PointOutT>::normalsToSpherical(const PointCloud<PointNT> &input, PointCloud<Normal> &output)
{
    ...
}

and here is the compiler complaining: 这是编译器抱怨:

wrinkledness.cpp: In member function ‘void pcl::WrinklednessEstimation<PointInT, PointNT, pointOutT>::computeFeature(typename pcl::Feature<PointInT, PointOutT>::PointCloudOut&) [with PointInT = pcl::PointWithViewpoint, PointNT = pcl::Normal, PointOutT = pcl::InterestPoint]’:
wrinkledness.cpp:76:   instantiated from here
wrinkledness.cpp:40: error: no matching function for call to ‘pcl::WrinklednessEstimation<pcl::PointWithViewpoint, pcl::Normal, pcl::InterestPoint>::normalsToSpherical(boost::shared_ptr<const pcl::PointCloud<pcl::Normal> >&, boost::shared_ptr<pcl::PointCloud<pcl::Normal> >&)’
wrinkledness.cpp:45: note: candidates are: void pcl::WrinklednessEstimation<PointInT, PointNT, PointOutT>::normalsToSpherical(const pcl::PointCloud<PointOutT>&, pcl::PointCloud<pcl::Normal>&) [with PointInT = pcl::PointWithViewpoint, PointNT = pcl::Normal, PointOutT = pcl::InterestPoint]

what I do not understand is that why the candidate has PointOutT instead of PointNT in the first parameter? 我不明白的是,为什么候选人有PointOutT代替PointNT在第一个参数?

Thanks 谢谢

You are using boost::shared_ptr as arguments when calling the functions. 调用函数时,您使用boost::shared_ptr作为参数。 Try calling the function with something like *my_shared_ptr instead. 尝试使用类似*my_shared_ptr的函数调用函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM