c++ - Templated constructor, parenthesis expected -
this question has answer here:
i have class template:
template <class t> class normalestimator { public: normalestimator(pcl::pointcloud<t>::ptr cloud) : _cloud(cloud) {} void computenormals(); pcl::pointcloud<pcl::normal>::ptr getnormals(); private: typename pcl::pointcloud<t>::ptr _cloud; pcl::pointcloud<pcl::normal>::ptr _normals; int _kneighbours; }; the member functions declared in header file well. when compiling, gives me error:
.../normal_estimator.h:12: error: expected ')' before 'cloud' am forgetting something? need specify 'typename' on constructor in way or form?
yes, need typename in constructor parameter because t dependent type:
normalestimator(typename pcl::pointcloud<t>::ptr cloud) // ^^^^^^^^
Comments
Post a Comment