0
我想做一個元組的元組,pcl :: visualization :: PointCloudColorHandler>但是當我將相應類型的參數傳遞到std :: make_tuple,它說,作爲pcl :: PointCloud傳遞的參數實際上是pcl :: PointCloud & &,如果我正確的話是一個右值引用。我不明白類型pcl :: PointCloud如何成爲右值引用。下面是代碼:make_tuple傳遞類型T作爲T &&,當期待T作爲模板化參數
pcl::PointCloud<pcl::PointXYZRGB> cloud;
pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr constCloud(&cloud);
pcl::io::loadPCDFile<pcl::PointXYZRGB>(file.getPCDFilePath().string(), cloud);
pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgbHandler(constCloud);
associatedClouds.insert(std::make_tuple<std::string, pcl::PointCloud<pcl::PointXYZRGB>, pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> >(file.getPCDFileName(), cloud, rgbHandler));
visualizedFiles.push_back(cloud);
我得到的錯誤是:
/Users/wfehrnstrom/CmakeTest/map.cpp:53:29: error: no matching function for call to 'make_tuple'
associatedClouds.insert(std::make_tuple<std::string, pcl::PointCloud<pcl::PointXYZRGB>, pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> >(file.getPCDFileName(), cloud, rgbHandler));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/tuple:868:1: note: candidate function [with _Tp = <std::__1::basic_string<char>, pcl::PointCloud<pcl::PointXYZRGB>, pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB>>] not viable: no known conversion from 'pcl::PointCloud<pcl::PointXYZRGB>' to 'pcl::PointCloud<pcl::PointXYZRGB> &&' for 2nd argument
make_tuple(_Tp&&... __t)
我幾乎失去了。謝謝。
從'make_tuple'中刪除'''',只是'std :: make_tuple(file.getPCDFileName(),cloud,rgbHandler);'讓模板參數扣除完成它的工作。 – 101010
請格式化您的問題。它看起來像一隻狗吃了一半。嵌入式代碼片段介於反引號之間,例如:'\'foo \''。 –