1
タプルのベクトルを作成しようとしていますが、このベクトルを関数から戻そうとしていますが、エラーが多数発生しています。引数としてpcl :: PointCloudColorHandlerをタプルに渡します。具体的には、関連するエラーは次のとおりです。boost :: shared_ptrにvalue_typeという名前の型がありません
error: no type named 'value_type' in 'boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> >'
私の質問は、なぜこの動作は許可されていないのですか?ここに私のコードは次のとおりです。
std::vector<std::tuple<std::string, pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr>, pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB>::Ptr > Map::getCloudColoredReal(){
std::vector<std::tuple<std::string, pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr, pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB>::Ptr > changed_clouds;
try{
for(int i = 0; i < addedFiles.size(); i++){
if(associatedClouds.find(addedFiles[i].getPCDFileName()) != associatedClouds.end()){
pcl::PointCloud<pcl::PointXYZRGB> cloud(associatedClouds.find(addedFiles[i].getPCDFileName())->second);
pcl::PointCloud<PointXYZRGBAI> cloudInfo(masterClouds.find(addedFiles[i].getPCDFileName())->second);
for(int j = 0; j < cloud.points.size(); j++){
uint32_t red = (cloudInfo.points[j].rgba >> 16) & (0x0000ff);
uint32_t green = (cloudInfo.points[j].rgba >> 8) & (0x0000ff);
uint32_t blue = (cloudInfo.points[j].rgba) & (0x0000ff);
cloud.points[j].r = red;
cloud.points[j].g = green;
cloud.points[j].b = blue;
}
pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr constCloud(&cloud);
pcl::visualization::PointCloudColorHandlerRGBField::Ptr rgbHandler(&constCloud);
std::tuple<std::string, pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr, pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB>::Ptr > tup = std::make_tuple(addedFiles[i].getPCDFileName(), constCloud, &rgbHandler);
changed_clouds.push_back(tup);
}
}
}
catch(std::exception& e){
std::cout << "Color Mode not set to real." << std::endl;
}
return changed_clouds;
}
全エラー:
In file included from /Users/wfehrnstrom/CmakeTest/dataViewerWidget.cpp:1:
In file included from /Users/wfehrnstrom/CmakeTest/dataViewerWidget.h:5:
In file included from /usr/local/include/vtk-7.0/QVTKWidget.h:39:
In file included from /usr/local/include/vtk-7.0/vtkGUISupportQtModule.h:36:
In file included from /usr/local/include/vtk-7.0/vtkInteractionStyleModule.h:36:
In file included from /usr/local/include/vtk-7.0/vtkRenderingCoreModule.h:40:
In file included from /usr/local/include/vtk-7.0/vtkAutoInit.h:18:
In file included from /usr/local/include/vtk-7.0/vtkDebugLeaksManager.h:26:
In file included from /usr/local/include/vtk-7.0/vtkSystemIncludes.h:36:
In file included from /usr/local/include/vtk-7.0/vtkIOStream.h:28:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iostream:38:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ios:216:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__locale:15:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:439:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:628:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1456:38: error: no type named 'value_type' in 'boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> >'
typedef typename allocator_type::value_type value_type;
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:337:22: note: in instantiation of template class 'std::__1::allocator_traits<boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > >' requested here
typedef typename __alloc_traits::size_type size_type;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:458:15: note: in instantiation of template class 'std::__1::__vector_base<std::__1::tuple<std::__1::basic_string<char>, boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> > >, boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > >' requested here
: private __vector_base<_Tp, _Allocator>
^
/Users/wfehrnstrom/CmakeTest/dataViewerWidget.cpp:56:196: note: in instantiation of template class 'std::__1::vector<std::__1::tuple<std::__1::basic_string<char>, boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> > >, boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > >' requested here
std::vector<std::tuple<std::string, pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr, pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > > clouds_in_map = m_maps.at(i).getCloudColoredReal();
^
In file included from /Users/wfehrnstrom/CmakeTest/dataViewerWidget.cpp:1:
In file included from /Users/wfehrnstrom/CmakeTest/dataViewerWidget.h:5:
In file included from /usr/local/include/vtk-7.0/QVTKWidget.h:40:
In file included from /usr/local/include/vtk-7.0/QVTKInteractor.h:43:
In file included from /Users/wfehrnstrom/Qt5/5.7/clang_64/lib/QtCore.framework/Headers/QObject:1:
In file included from /Users/wfehrnstrom/Qt5/5.7/clang_64/lib/QtCore.framework/Headers/qobject.h:54:
In file included from /Users/wfehrnstrom/Qt5/5.7/clang_64/lib/QtCore.framework/Headers/qmetatype.h:55:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:467:30: error: '__alloc_traits' is a protected member of 'std::__1::__vector_base<std::__1::tuple<std::__1::basic_string<char>, boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> > >, boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > >'
typedef typename __base::__alloc_traits __alloc_traits;
^
/Users/wfehrnstrom/CmakeTest/dataViewerWidget.cpp:56:196: note: in instantiation of template class 'std::__1::vector<std::__1::tuple<std::__1::basic_string<char>, boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> > >, boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > >' requested here
std::vector<std::tuple<std::string, pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr, pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > > clouds_in_map = m_maps.at(i).getCloudColoredReal();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:334:54: note: declared protected here
typedef allocator_traits<allocator_type> __alloc_traits;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:468:30: error: 'reference' is a protected member of 'std::__1::__vector_base<std::__1::tuple<std::__1::basic_string<char>, boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> > >, boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > >'
typedef typename __base::reference reference;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:335:54: note: declared protected here
typedef value_type& reference;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:469:30: error: 'const_reference' is a protected member of 'std::__1::__vector_base<std::__1::tuple<std::__1::basic_string<char>, boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> > >, boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > >'
typedef typename __base::const_reference const_reference;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:336:54: note: declared protected here
typedef const value_type& const_reference;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:470:30: error: 'size_type' is a protected member of 'std::__1::__vector_base<std::__1::tuple<std::__1::basic_string<char>, boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> > >, boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > >'
typedef typename __base::size_type size_type;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:337:54: note: declared protected here
typedef typename __alloc_traits::size_type size_type;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:471:30: error: 'difference_type' is a protected member of 'std::__1::__vector_base<std::__1::tuple<std::__1::basic_string<char>, boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> > >, boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > >'
typedef typename __base::difference_type difference_type;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:338:54: note: declared protected here
typedef typename __alloc_traits::difference_type difference_type;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:472:30: error: 'pointer' is a protected member of 'std::__1::__vector_base<std::__1::tuple<std::__1::basic_string<char>, boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> > >, boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > >'
typedef typename __base::pointer pointer;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:339:54: note: declared protected here
typedef typename __alloc_traits::pointer pointer;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:473:30: error: 'const_pointer' is a protected member of 'std::__1::__vector_base<std::__1::tuple<std::__1::basic_string<char>, boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> > >, boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> > >'
typedef typename __base::const_pointer const_pointer;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:340:54: note: declared protected here
typedef typename __alloc_traits::const_pointer const_pointer;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:479:53: error: no type named 'value_type' in 'boost::shared_ptr<pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> >'
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
9 errors generated.
はどうもありがとうございました。
に変更しなければならない問題を軽減しようとすると、例えばタプルのベクトルを使って実験する。表示されていないインスタンス化コード( 'clouds_in_map')は関連しているかもしれません。私はここに何も見ない、申し訳ありません。 –