gpt4 book ai didi

c++ - 了解 C++ 模板

转载 作者:行者123 更新时间:2023-11-30 02:04:25 27 4
gpt4 key购买 nike

这是我类中的函数声明:

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

下面是实现的部分:

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

这是编译器的提示:

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]

我不明白的是,为什么候选人在第一个参数中使用PointOutT而不是PointNT

谢谢

最佳答案

您在调用函数时使用 boost::shared_ptr 作为参数。尝试使用类似 *my_shared_ptr 的方式调用该函数。

关于c++ - 了解 C++ 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10698166/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com