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

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -